# Ros, stage, gmapping --> tf

Hello!

I am trying to use ros with stage and gmapping. I can move my robot in stage around, and with rostopic echo I can see, that the sensor readings change. But when I start gmapping, the GridMap values stay at -1.

I guess that is, because I did not compute tf. But rostopic info tells me, that stage is a publisher to tf, so now I am not sure, if I must calculate it myself, or if that is done for me.

If I have to do it myself, i guess i got to do the following:

Create a TransformListener

tf::StampedTransform transform;

listener.lookupTransform("/odom", "/map",ros::Time(0), transform);

And then publish the transform to tf?

Would be really glad if someone could help me!

edit retag close merge delete

Sort by » oldest newest most voted

I'm not familiar with stage, but gmapping will require your robot (simulator) to publish transforms between the odometry and robot base frames, and between the robot base and laser frames. The default frame names expected by gmapping are "odom" for the odometry frame, "base_link" for the robot base frame, and whichever frame the laser is being published on.

The transform between "odom" and "map" will be then published by gmapping itself.

Check sections 5.1.1 and 5.1.5 in gmapping docs.

more

You should follow this tutorial: Robot Setup It explains what the prerequisites for navigation are, i.e. what you have to set up. Stage publishing /tf doesn't mean it publishes all transforms necessary. You can look at the tf tree by rosrun tf view_frames.

more

Thx for the links, don't know how I could have overseen section 5.1.5! Now I do at least have a clue, what gmapping needs, and why. But there are still some things that bother me:

1) Do I have to transform the actual values, or is that than by gmapping, if I just give it the right transformation?

2) Do I have to broadcast the transformations or shall I just publish them in the tf topic?

Regards, Lotoreo

more

You should publish via the tf library and not directly to the tf topic.
( 2011-06-07 04:25:13 -0500 )edit
What you mean with 1? You need to make sure that stage publishes the transform between the odometry frame and the robot base frame. Also, someone must be publishing the transform between the robot base frame and the laser frame, I ignore if stage does it too. Also configure gmapping with frame names
( 2011-06-07 21:44:51 -0500 )edit

Stage publishes all the necessary tf data. The problem is likely that you don't have gmapping correctly configured (in particular, remapping the input scan topic). The navigation_stage package has example of using both gmapping and amcl with stage. For example, see this launch file.

more