atenpas / handle_detector

ROS package to localize handles in 3D point clouds
BSD 2-Clause "Simplified" License
25 stars 6 forks source link

terminate called after throwing an instance of 'tf2::LookupException' #5

Closed arunavanag591 closed 8 years ago

arunavanag591 commented 8 years ago

I am using a Kinect. I am trying to use the sensor and perform the steps as given in 4.2. It throws me the following error.

what(): "kinect_l_rgb_optical_frame" passed to lookupTransform argument source_frame does not exist. [localization-1] process has died [pid 22362, exit code -6, cmd /home/owner/baxter_ws/devel/lib/handle_detector/handle_detector_localization __name:=localization __log:=/home/owner/.ros/log/35ab47c0-191b-11e6-bed3-000af72dcfab/localization-1.log]. log file: /home/owner/.ros/log/35ab47c0-191b-11e6-bed3-000af72dcfab/localization-1*.log all processes on machine have died, roslaunch will exit shutting down processing monitor... ... shutting down processing monitor complete done

atenpas commented 8 years ago

Is kinect_l_rgb_optical_frame in your TF tree (_rosrun tf viewframes)?

arunavanag591 commented 8 years ago

These are my camera frames. I am using Kinect xbox 360.

screenshot from 2016-06-02 11 33 06

atenpas commented 8 years ago

You're trying to use _kinect_l_rgb_opticalframe. However, this frame does not exist in your TF tree. The frame you want is _camera_rgb_opticalframe. There are two ways to solve this (the 1st is easier):

  1. If you're using _openni_launch/openni2launch, you can set the sensor's name by using the argument camera.
  2. Modify the code: https://github.com/atenpas/handle_detector/blob/master/src/localization.cpp#L29-L30
arunavanag591 commented 8 years ago

Thanks, I suspected that, however did not know which file to edit. I should have checked the CMakeLists.txt. But now on doing that, it talks about some base:

terminate called after throwing an instance of 'tf2::ConnectivityException' what(): Could not find a connection between 'base' and 'camera_rgb_optical_frame' because they are not part of the same tree.Tf has two or more unconnected trees.

atenpas commented 8 years ago

The code assumes that the robot and the camera are connected in the TF tree. It also assumes that /base is the base frame of the robot. See: https://github.com/atenpas/handle_detector/blob/master/src/localization.cpp#L162-L165

arunavanag591 commented 8 years ago

So why does it report that they are not in the same tree. It does not make sense to me. ( i am using openni_launch).

atenpas commented 8 years ago

What kind of robot are you using? You probably have to connect them. Looking at the picture that you posted above, there needs to be a connection from _cameralink to some frame on your robot.

arunavanag591 commented 8 years ago

I am using a Baxter. My Baxter and my workstation is connected over the same subnet. The kinect is connected to my workstation. I tried getting them together and now I get this: terminate called after throwing an instance of 'tf2::LookupException' what(): "camera_rgb_optical_frame" passed to lookupTransform argument source_frame does not exist.

arunavanag591 commented 8 years ago

Solved that too. Reading point cloud data from sensor topic: /camera/depth_registered/points Input frame camera_rgb_optical_frame is not equivalent to output frame /camera_rgb_optical_frame ! Exiting ...

arunavanag591 commented 8 years ago

Solved

jsalfity commented 8 years ago

I'm been working through this with the Turtlebot 2 and coming across the same errors, this thread helped me get past some roadblocks.

@BlackMamba591 and/or @atenpas how did you solve that last error ... Input frame camera_rgb_optical_frame is not equivalent to output frame /camera_rgb_optical_frame ! Exiting ...

Much appreciated. Thanks

atenpas commented 8 years ago

@mopperHopper What kind of sensor are you using? The code was written for a sensor running on openni_launch with the point cloud being on the /depth_registered/points topic.

jsalfity commented 8 years ago

@atenpas Using the Xbox Kinect 2 sensor. I'm opening the camera with roslaunch freenect_launch freenect.launch

The graph output by rosrun tf view_frames is exactly the same as above, so I assumed that the freenect and openni are very similiar. The openni did not work for my Xbox camera, although I didn't give it that valiant of a try after seeing "camera not connected"

atenpas commented 8 years ago

So, you're using camera/depth_registered/points for the input point cloud topic?

jsalfity commented 8 years ago

Yes, at least I think so. In the localization.cpp I have:

const std::string RANGE_SENSOR_FRAME = "/camera_rgb_optical_frame"; const std::string RANGE_SENSOR_TOPIC = "/camera/depth_registered/points";

Do I need to alter any other files?

atenpas commented 8 years ago

I think you need to remove the initial slashes (/) from the strings.

jsalfity commented 8 years ago

Yup, that was the fix! That's not intuitive to me, I would have thought the topic started with /. Thanks a lot.

jsalfity commented 8 years ago

For this to work, I had to have: const std::string RANGE_SENSOR_FRAME = "camera_rgb_optical_frame"; const std::string RANGE_SENSOR_TOPIC = "/camera/depth_registered/points";

The topic needs the '/' but the frame does not.

atenpas commented 8 years ago

That's correct. The use of '/' in ROS is very confusing.