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

using move_base recovery for initial pose estimation

asked 2014-04-10 01:02:46 -0600

stfn gravatar image

updated 2014-04-11 02:12:10 -0600


I want my robot to find its initial pose on its own rather than providing it with rviz "2d pose estimate". For that I already figured out that you can call AMCLs /global_localization service, whicht distributes the particles over the whole map. Second I'd need to rotate the robot. Therefore move_base already has the recovery behaviour, but how to trigger that? I know there is the C++ API, but isn't there a service call for that? Something that smoothly integrates with move_base resp. nav stack? Or can I use the actionlib for that? Anything any trigger despite the cpp api?

I'm wondering for a long time why there isn't something out there for initial pose estimation with the widely used combination of amcl and move_base. Are you guys all using the rviz-button? all the time you start demos?

Update 1

As I could not find an answer to this, I wrote a node triggering a recovery-behaviour similar to the move_base.cpp implementation. However those behaviours (rotate_recovery, clear_costmap_recovery) need the global and local costmap as parameters. Just creating your own as suggested in the code snipples from the wiki doesnt seem to work as intended since those maps are not the ones used by move_base: Running clear_costmap_recovery then does not clear the costmap used by move_base. However, and this is strange, rotate_recovery sometimes is not carried out due to potential collision. How can there be collisions if the costmap is empty? Or IS there a connection between a costmap you create and name ('local_costmap', 'global_costmap') and the ones used by move_base? This is confusing ...

An alternative solution would be to use actionlib and send move_base_msgs/MoveBaseActionGoal, but how can I tell move_base to just use the local planner and ignore the global one?

edit retag flag offensive close merge delete


so .. nobody has the problem of initial pose estimation with amcl?

stfn gravatar image stfn  ( 2014-05-22 00:42:04 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2014-04-10 14:20:48 -0600

Carlos Hdz gravatar image

updated 2014-04-10 14:26:51 -0600


What robot are you using?

In my case, I'm working with Turtlebot II robots. I avoid using the rviz-button on my demos by using first the autocking sequence. Turtlebot have a docking (battery recharger) with infra-red emitters and the robot base have IR-receptors ( ). You can make the robot to search and find this base automatically. I take advantage of this by using the dock position as reference (putting it in an known place on the map) When the robot reach it, it publish a message to the topic 'initialpose' (PoseWithCovarianceStamped) with the reference position and AMCL now can work normally.

Maybe this is not precisely what you are searching to do, but what I recommed is that you search for a way in which therobot reaches a known position looking for some kind of landmark first, and use that reference to give the AMCL algorithm the initial position. I think that without some help (initial position), the AMCL probably will not work.

edit flag offensive delete link more


Thanks, landmarks are one way to do it. But I want to keep it generic as the demo scenario changes often.

stfn gravatar image stfn  ( 2014-04-10 23:02:49 -0600 )edit

good advice !

jiashiwei gravatar image jiashiwei  ( 2017-07-18 03:35:08 -0600 )edit

answered 2019-01-28 01:53:21 -0600

rajmohan747 gravatar image

updated 2019-08-01 08:36:04 -0600

Hi ,

Initialize your robot for the very first time only(from Rviz)

Write a node which take care of two things.

1.Subscribes /robot_pose and updates it in a local .txt file. So at any instant of time, you will have robot's current position saved in the local file.

2.Publish the value to /initial_pose one time when you execute the node (probably at the time of initialization of robot position)

So at any point even if the robot's battery turn off or any issue happens, on relaunching the nodes again, the robot will be spawned in the last known position

Note: It will work fine, in case if the robot is not moved manually, ie for robot kidnap problems this won't help

edit flag offensive delete link more

Question Tools



Asked: 2014-04-10 01:02:46 -0600

Seen: 2,244 times

Last updated: Aug 01 '19