code-iai / iai_kinect2

Tools for using the Kinect One (Kinect v2) in ROS
Apache License 2.0
874 stars 519 forks source link

Connecting kinect2_bridge published TF's, with real robot TF's #519

Closed RossPLloyd closed 5 years ago

RossPLloyd commented 5 years ago

Hello there

Just a quick thanks for this great piece of software, it lets me do so much that I wouldnt otherwise!

I am trying to get kinect2_bridge working with a real world robot, alongside rtabmap. At the moment my tf tree looks like the attached view_frames output. I have publish_tf=true enabled in my launch file. I would like the published frames to link with the shelf1_kinect2_rgb_optical_frame as this is where I have the kinect2 specified in my urdf. At the moment I cannot get the kinect2 output in RViz and rtabmap complains of lack of input, presumably because the tf's do not line up.

Do I need to add another line to my launch file to somehow link the two sets of frames?

frames.pdf

rtabmaptxt.txt

Thank you!

Oh I should add, when building my robot urdf I used your iai_robots/iai_kinect2_description/urdf/kinect2.urdf.xacro where shelf1 is my prefix and parent, which is what you see at left bottom of my tf tree.

RossPLloyd commented 5 years ago

The solution appears to be to add a static transform to the launch file. I got this from the rtabmap forums:

   <arg name="optical_rotate" value="0 0 0 -$(arg pi/2) 0 -$(arg pi/2)" />
   <node pkg="tf" type="static_transform_publisher" name="kinect2_base_link"
   args="$(arg optical_rotate) shelf1_kinect2_rgb_optical_frame kinect2_link 100" />