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

How to position OccupancyGrid in RVis - understanding TF

asked 2020-02-12 19:59:03 -0500

Leonti gravatar image

updated 2020-02-13 02:39:19 -0500

gvdhoorn gravatar image

Hi! I've just started with ROS and I need help understanding how TF works.

I'm trying to run this simulation on ROS2 Eloquent:
https://github.com/chapulina/dolly
and I'd like to use SLAM from Slam Toolbox:
https://github.com/SteveMacenski/slam...

The robot has 2 frames:
https://github.com/chapulina/dolly/bl....

  <!-- output -->
  <publish_odom>true</publish_odom>
  <publish_odom_tf>true</publish_odom_tf>

  <odometry_frame>odom_demo</odometry_frame>
  <robot_base_frame>chassis</robot_base_frame>

The robot is positioned at -37 5.6 in the "world":
https://github.com/chapulina/dolly/bl...

<!-- Dolly -->
<include>
  <pose>-37 5.6 0.33 0 0 0</pose>
  <uri>model://dolly</uri>
</include>

When I run slam_toolbox it outputs /map topic with OccupancyGrid messages.
I'm using static_transform_publisher to transform map frame to chassis with all zeroes.

Now in RViz I see all 3 frames in the center of the grid (map, chassis and odom_demo).
I can also see the laser scan results which start from the center of the grid.

However I see the map display way outside of the grid.
I suspect it's because robot position is at -37 5.6, chassis and map are statically linked through static_transform_publisher, which "pushes" map away from center. Here is how it looks(don't have enough point to post an image directly):
https://imgur.com/a/xFMjuOj

What I'd like to see is map being in the center and see robot move on the grid as I move the robot in simulation.
Something like the last gif on https://github.com/SteveMacenski/slam...

Am I correct in assuming that I need:

  1. Make map a "fixed frame" in Rviz
  2. Somehow make transformation between map and odom_demo dynamic so it would take position calculated via slam_toolbox and transform it to the robot position on the grid.

This way "OccupancyGrid" will stay at the center of RViz grid and when robot moves it will change odom_demo position which will change chassis frame with it.
How do I do that? Does slam_toolbox already have this transformation?
Is this even a correct understanding of what TF means?

Another question:
I've been reading https://www.ros.org/reps/rep-0105.html and I think my frames correspond to:
earth -> don't have one, I've also seen world in a couple of places, how do I create one?
map -> map
odom -> odom_demo
chassis -> base_link

Is this correct?

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-02-22 19:19:52 -0500

Leonti gravatar image

It seems like my initial understanding was correct - chassis -> map transforms were already published by Slam Toolbox, I just had to select map as a Fixed Frame in Rviz.

The second problem was not using the sim time in Slam Toolbox, so the map was published with the system's timestamp, so the transform only worked in one direction (I could select odom_demo as a fixed frame in RViz, but not the map).
Switching to sim time and checking Use Timestamp in RViz for the Map solved the problem.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-02-12 19:59:03 -0500

Seen: 1,208 times

Last updated: Feb 22 '20