How to position OccupancyGrid in RVis - understanding TF
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:
- Make
map
a "fixed frame" in Rviz - Somehow make transformation between
map
andodom_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!