Ask Your Question

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

asked 2019-02-27 16:35:54 -0500

geistmate gravatar image

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-02-27 23:24:30 -0500

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:

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:

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-02-27 16:35:54 -0500

Seen: 683 times

Last updated: Feb 27 '19