ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Doing several things at the same time in Rviz

asked 2012-09-19 20:05:57 -0500

Brioche gravatar image

updated 2016-10-24 08:59:27 -0500

ngrennan gravatar image

Hi all,

I wrote a program to move my urdf model around Rviz. It works fine when I have /odom (xyz yaw) on Fixed Frame and /base_link (principal link of my urdf model) on Target Frame thanks to this tutorial.

I would like to add a point cloud from a Kinect but when I add a point cloud with any topics from the /openni_camera, I have an error on my pointcloud2 topic:

No transform to fixed frame [/odom]. TF error: [Unable to lookup transform, cache is empty, when looking up transform from frame [/openni_rgb_optical_frame] to frame [/odom]]

That is quite understandable but how can I add a point cloud if I want to move my robot? Should I send everything on the same topic? kind of messy and not even sure it will work...

Thank you for giving me any leads


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-09-19 22:26:30 -0500

Lorenz gravatar image

You need a valid tf tree that also contains the frame /openni_rgb_optical_frame. This is normally done by creating a urdf file of your robot (have a look at these tutorials) and running the robot_state_publisher. The state publisher will read your urdf file and publish the links in it as tf frames. Then rviz will visualize the point cloud in the right frame.

edit flag offensive delete link more


Yes but I also make my robot move by publishing its position on /odom ( so I don't understand how I can connect my /odom and /openni_rgb_optical_frame ... When I read tf it's not really clear for me... sorry

Brioche gravatar image Brioche  ( 2012-09-20 20:21:03 -0500 )edit

I assume the node for publishing your odometry information is publishing a transform from /odom to your robot's root link, e.g. /base_link. As Lorenz says, you then need to have a transform from the point cloud's reference frame (e.g. /openni_rgb_optical_frame) to your robot's root frame. ...

bit-pirate gravatar image bit-pirate  ( 2012-09-20 21:25:40 -0500 )edit

You can do this by using the mentioned robot_state_publisher in combination with a URDF file. Or, for a simple test, you can also use the static transform publisher to publish the transform robot's root frame -> point cloud's reference frame

bit-pirate gravatar image bit-pirate  ( 2012-09-20 21:30:18 -0500 )edit

RViz will combine the provided information to visualise the point cloud linked to the moving robot.

bit-pirate gravatar image bit-pirate  ( 2012-09-20 21:31:15 -0500 )edit

Thanks, so if I well understood, I should modify my cpp to have /optical_..._frame as my header.frame_id and odom and base_link as child_frame_id. (according to the robot state publisher tuto) I will try it tomorrow

Brioche gravatar image Brioche  ( 2012-10-01 20:12:57 -0500 )edit

It is ok to set openni_optical_frame as header.frame_id of your point cloud. But make sure that your urdf file contains a link that is also named openni_optical frame. Then make sure you run the robot_state_publisher node. It will publish a tf tree generated from your urdf.

Lorenz gravatar image Lorenz  ( 2012-10-01 22:23:04 -0500 )edit

For the curious: I've tranformed my /odom in /openni_rgb_optical_frame and not my base_link this /odom was my and now I have my robot moving and my kinect point cloud! Thanks a lot bit-pirate and Lorenz

Brioche gravatar image Brioche  ( 2012-10-04 14:24:06 -0500 )edit

Question Tools

1 follower


Asked: 2012-09-19 20:05:57 -0500

Seen: 1,030 times

Last updated: Sep 19 '12