h2r / baxter_h2r_packages

18 stars 16 forks source link

Calibration #4

Open sburdet5 opened 9 years ago

sburdet5 commented 9 years ago

Hey I am really excited about your package and I'm hoping it is what I'm looking for to help with my project. I have an ASUS XtionPro instead of a kinect. Is there anything specific I will need to change to in your package to let it run with a Xtion?

The question I'm working on now is when I'm calibrating the Xtion with baxter (maybe it is because I'm using the Xtion that I'm having this issue). I'm following the README in the calibration folder and when I run "rosrun baxter_kinect_calibration setup_robot_left.sh" it throws a handful of errors:

Traceback (most recent call last): File "/home/sethburdette/catkin_ws/src/baxter_tools/scripts/camera_control.py", line 159, in sys.exit(main()) File "/home/sethburdette/catkin_ws/src/baxter_tools/scripts/camera_control.py", line 155, in main action(camera, res) File "/home/sethburdette/catkin_ws/src/baxter_tools/scripts/camera_control.py", line 88, in open_camera cam = CameraController(camera) File "/home/sethburdette/catkin_ws/src/baxter_interface/src/baxter_interface/camera.py", line 81, in init "Close a different camera first and try again.".format(self._id))) AttributeError: Cannot locate a service for camera name 'left_hand_camera'. Close a different camera first and try again. [INFO] [WallTime: 1426180367.726818] Robot Enabled

Additionally, after I run this and I check to see what cameras are open it always shows only the head and right hand camera being open. Even if I set it up beforehand to specifically have the left hand camera open.

Let me know what you think and thanks,

Seth

brawner commented 9 years ago

It should work just fine with a Xtion, but you'll need to change the topics located in the launch file to the correct frames with the xtion.

https://github.com/h2r/baxter_h2r_packages/blob/indigo-devel/baxter_kinect_calibration/launch/baxter_bundle_calibrate.launch

Your current problem has to do with the cameras on baxter. You can only enable two cameras at the same time. It sounds like you have the right camera and head camera open. Try closing one, and then opening the left hand camera.

The script just closes the left camera and opens it to the max resolution. rosrun baxter_tools camera_control.py -c left_hand_camera rosrun baxter_tools camera_control.py -o left_hand_camera -r 1280x800 rosrun baxter_tools enable_robot.py -e

So before doing that, try: rosrun baxter_tools camera_control.py -c head_camera

On Thu, Mar 12, 2015 at 1:19 PM, sburdet5 notifications@github.com wrote:

Hey I am really excited about your package and I'm hoping it is what I'm looking for to help with my project. I have an ASUS XtionPro instead of a kinect. Is there anything specific I will need to change to in your package to let it run with a Xtion?

The question I'm working on now is when I'm calibrating the Xtion with baxter (maybe it is because I'm using the Xtion that I'm having this issue). I'm following the README in the calibration folder and when I run "rosrun baxter_kinect_calibration setup_robot_left.sh" it throws a handful of errors:

Traceback (most recent call last): File "/home/sethburdette/catkin_ws/src/baxter_tools/scripts/camera_control.py", line 159, in sys.exit(main()) File "/home/sethburdette/catkin_ws/src/baxter_tools/scripts/camera_control.py", line 155, in main action(camera, res) File "/home/sethburdette/catkin_ws/src/baxter_tools/scripts/camera_control.py", line 88, in open_camera cam = CameraController(camera) File "/home/sethburdette/catkin_ws/src/baxter_interface/src/baxter_interface/camera.py", line 81, in init "Close a different camera first and try again.".format(self._id))) AttributeError: Cannot locate a service for camera name 'left_hand_camera'. Close a different camera first and try again. [INFO] [WallTime: 1426180367.726818] Robot Enabled

Additionally, after I run this and I check to see what cameras are open it always shows only the head and right hand camera being open. Even if I set it up beforehand to specifically have the left hand camera open.

Let me know what you think and thanks,

Seth

— Reply to this email directly or view it on GitHub https://github.com/h2r/baxter_h2r_packages/issues/4.

sburdet5 commented 9 years ago

I tried doing that before but it didn't work. This time I tried it having the left camera be the only one open, and then having the left and right cameras both being open to start. I still got the same error with both configurations.

Seth

sburdet5 commented 9 years ago

I got it working finally. For some reason when the script told the left camera to close it would not leave it available for opening again. I added a close to the head camera in between the left hand close and left hand open and now it works fine.

However, now when I run roslaunch baxter_kinect_calibration baxter_bundle_calibrate.launch it works for a bit and then gives me this error:

[ERROR] [1426528905.880922885]: Lookup would require extrapolation into the future. Requested time 1426528904.879392967 but the latest data is at time 1426528901.825926421, when looking up transform from frame [left_hand_camera] to frame [world]

I'm not sure if you've seen this before or not. It will keep running and giving me errors like this but with different time stamps as it runs.

Hope you can help, Seth

wjchen84 commented 9 years ago

Hello @sburdet5 , I am also excited to find and try on this package. But I am also getting the same error on the extrapolation (except that my error said about the 'earliest' data instead of the 'latest'). Any findings to your case? I am not sure if there is anything to do with the time synchronization between baxter and my PC.

Thanks!

wjchen84 commented 9 years ago

Hello, I got back to this issue today and confirmed that the above issue (extrapolation in tf) is due to the time discrepancy between baxter and host PC. I was connecting the baxter and my PC directly within local network and thus the time on baxter is gradually drifting from my PC without time sync. Now I am connecting baxter and my PC both to a network with access to NTP servers. Their times are now sync'ed and the tf extrapolation issue is resolved.

FYI, https://github.com/RethinkRobotics/sdk_docs_archive/wiki/Time-and-NTP http://wiki.ros.org/ROS/NetworkSetup#Timing_issues.2C_TF_complaining_about_extrapolation_into_the_future.3F

arpit15 commented 7 years ago

@wjchen84 I tried the steps mentioned in your suggested post. However I wasn't able to sync baxter and my machine. I kept getting the following error no server suitable for synchronisation found I am connected to baxter via link local ethernet connection. Could you tell me what is going wrong? I really want to make it work.

cristipiticul commented 7 years ago

Hello!

If anyone still have problems with the synchronization (not the one arpit15 is mentioning), this is a way to solve it in Ubuntu 14.04, without connecting Baxter to the internet.

First, find the time difference between the computer and Baxter robot (see http://sdk.rethinkrobotics.com/wiki/Time_and_NTP for details). To do that, run this command in the terminal: ntpdate -q baxter_ip or ntpdate -q baxter_hostname The important field is the offset, which tells how many seconds are between computer time and robot time.

Then update the time of your computer to match the time of the robot. This small C++ program can do that. See this for reference.

#include <sys/time.h>
#include <stdlib.h>
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
    if (argc != 2)
    {
        cout << "Usage: time offset\n";
        return 1;
    }
    int offset = atoi(argv[1]);
    struct timeval tv;
    struct timezone tz;
    gettimeofday(&tv, &tz);

    tv.tv_sec += offset;
    settimeofday(&tv, &tz);
    return 0;
}

You can put this code in a file, call it time.cpp. Then compile it using the command: g++ time.cpp -o time (this will create an executable called time). Then execute it like this sudo ./time 2 (if the offset is 2 seconds). Without sudo, it will not change the time. You can check if the time is correct by using the ntpdate -q command again.