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

gmapping: base_link to odom missing

asked 2013-03-01 00:08:51 -0500

superawesomepandacat gravatar image

updated 2013-03-01 00:09:18 -0500

The simulated robot I'm using does not define a transformation from \base_link to \odom. When I started Gazebo and load the robot, the top most node of the frames tree is the \base_link.

When I run gmapping, \odom is automatically created with a \map parent, on a separate tree from the rest of the robot's frames.

So I'm manually writing a transformation from \base_link to \odom. However, there's a nav_msgs::odometry topic published by the robot which I suspect is the odometry of the robot in the world frame. I can't figure out how to make use of that topic.

Do I just read from it and broadcast the transform like in How would gmapping know which is the odometry frame? Is it the name?

If it's the name then the \base_link frame of my robot isn't named "base_link". Is that a problem?

On a related note, does the transformation from base_link to laser has to be direct? Or as long as a path on the tree exists, it's fine?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-03-01 00:20:48 -0500

dornhege gravatar image

First make sure there isn't any odometry tf transform that you might be able to use.

If there isn't: Yes, take the odometry message and publish tf from that.

The frames are /odom -> /base_link by convention. If your robot has different ones, gmapping has parameters that allow you to define the frames to use.

The laser transform just needs to exist. It doesn't need to be direct.

edit flag offensive delete link more


I assumed that there is no odometry transform because the base_link is the single root in a fully connected frame tree. So, I need the name of the frames to be odom, base_link and laser? How do I define other names then?

superawesomepandacat gravatar image superawesomepandacat  ( 2013-03-01 00:24:29 -0500 )edit

If there is an odometry message published, you have odometry. The message and tf are usually redundant. The frame names are odom and base_link by convention. You can use whatever you want. gmapping will only look for two frames to determine the odom tf. Check gmapping docs what the params are.

dornhege gravatar image dornhege  ( 2013-03-01 01:36:39 -0500 )edit

Got it to work thanks to your direction but it's not doing anything after "Registering first scan.". That's for another topic I guess.

superawesomepandacat gravatar image superawesomepandacat  ( 2013-03-01 04:59:55 -0500 )edit

Maybe, just to check: Make sure that you are actually getting odom tf to gmappings (besides having a sender also having data).

dornhege gravatar image dornhege  ( 2013-03-01 06:20:34 -0500 )edit

What I did was create a fake odom tf using "rosrun tf static_transform_publisher 0 0 0 0 0 0 odom base_link 100", and run gmapping using the correct parameters. When I display the map on rviz, the map from the first laser scan is displayed but gmapping is stuck at "Registering first scan".

superawesomepandacat gravatar image superawesomepandacat  ( 2013-03-01 06:25:57 -0500 )edit

And when I rotate the robot, nothing, still "Registering first scan" and no map update. I'm now going to write a node to read the odometry topic I mentioned in my original post and broadcast a TF using that to see how it goes.

superawesomepandacat gravatar image superawesomepandacat  ( 2013-03-01 06:27:15 -0500 )edit

That explains everything. gmapping will only integrate more scans if the robot moves a certain amount. As the static publisher never "moves" the robot, you only get the first update. Implementing real odom should fix that.

dornhege gravatar image dornhege  ( 2013-03-01 06:57:33 -0500 )edit

By move, do you mean translation, rotation or both? I wrote a new node which: subscribes to odometry data, publish it and broadcast a tf with the same child. Still, when the robot rotates,the map doesn't update.

superawesomepandacat gravatar image superawesomepandacat  ( 2013-03-01 10:27:06 -0500 )edit

Question Tools


Asked: 2013-03-01 00:08:51 -0500

Seen: 1,869 times

Last updated: Mar 01 '13