Robotics StackExchange | Archived questions

How to connect odom and laser_frame to view on a single RVIZ?

Hi, beginner at ROS here needing some help.

I created a odometetry system using rosserial that publishes odom to base_link which is my differential drive robot. I'm able to view the robot movement on RVIZ as it drives in a circle. I also bought a YDLIDAR from amazon that comes with its own ROS package that publishes laserscan data, and then I can view that on RVIZ by running the node provided from the company.

What I am trying to do is run both of the at the same time on the same RVIZ., but when I try to add a LaserScan display to my RVIZ with my odometry system, I get the error:

For frame [laser_frame]: No transform to fixed frame [odom]. TF error: [Could not find a connection between 'odom' and 'laser_frame' because they are not part of the same tree. TF has two or more unconnected trees.] 

I ran rosrun tf view_frames and this is what I see, and I do see that my TF trees are indeed unconnected.

image description

My end goal is to run SLAM gmapping and I know I need both /tf and /scan in order to do that, so I'm sure I need to connect these TF trees first before I do that.

Also, here is my rqt_graph.

image description

If you could kindly help me figure out this issue, I will greatly appreciate it. Thanks very much.

Best, Matthew

Asked by geistmate on 2019-02-27 17:35:54 UTC

Comments

Answers

Usually, the base_footprint is the projection into the ground floor of base_link (which usually represents the middle point in between the two wheels of the differential drive system).

The simplest solution would be to publish a static transformation between base_link and base_footprint so that base_footprint hangs from base_link on the TF tree (odom->base_link->base_footprint->laser_frame). If, for example, the radius of your wheels is 5cm then you can publish the transformation with this command:

rosrun tf static_transform_publisher 0 0 -0.05 0 0 0 base_frame base_footprint 100

In this example the base_footprint is located exactly 5cm below base_frame, that is why the third argument to the command is negative. You can find the details of this command here: http://wiki.ros.org/tf#static_transform_publisher

A more advanced solution would be to create an URDF file to describe all the joints and links of your robot and then use a robot state publisher to publish the TF tree for you: http://wiki.ros.org/urdf/Tutorials

Asked by Martin Peris on 2019-02-28 00:24:30 UTC

Comments