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

How to set the initial pose for the robot in navigation?

asked 2014-03-26 03:02:33 -0500

Yuichi Chu gravatar image

updated 2014-03-26 16:05:58 -0500

Hi! I followed the tutorials of navigation , but I meet some problems. I joysticked the robot and used Gmapping to generate a map . Next I turn off the robot and restart it . The laser scan and odometry work well. Then I use that map with AMCL. When I load the map with Map_Sever,the rviz shows that the robot always stays in the original point of the map by defalut although the robot is in other places actually.I donot know how to set the initial pose for the robot . Can the robot match the laser date with the environment of the map and make itself localized autonomously ? Or do I need to set the initialpose for the robot manully? Any suggestion will be appreciated!Thank you very much!

edit retag flag offensive close merge delete

4 Answers

Sort by » oldest newest most voted

answered 2014-03-26 22:23:06 -0500

ahendrix gravatar image

Having the robot figure out where it is on startup is known as the "kidnapped robot problem" in robotics. AMCL does not solve it, so you'll have to set the pose manually or find a different localization package that does solve this problem.

You can set the robot's pose manually using the "2D Pose Estimate" tool in rviz.

edit flag offensive delete link more


Is there a solution for this in ROS? It's something I would like my robot to achieve.

MarkyMark2012 gravatar image MarkyMark2012  ( 2017-09-27 11:34:43 -0500 )edit

answered 2014-03-27 02:18:56 -0500

AMCL provides the "global_localization" service for this use case (see AMCL wiki page). It disperses particles randomly in the given map and hopefully finds the correct robot pose after the robot moved around a little bit, pruning "bad" particles. You´ll have to test how well that works for your scenario, though. I haven´t played around with it much, but I´d expect that huge and redundant looking environment (e.g. with lot of places looking the same) will be a challenge. If you are able to set the initial_pose, that definitely would be the more reliable method.

edit flag offensive delete link more


@Stefan Kohlbrecher - Thanks for the answer. I was thinking about creating a Wi-Fi map using odometry along with a gmapping map. And then use the x,y co-ordinate from the Wi-Fi map as input to initial position to the gmapping map. I can get the Wi-Fi x,y coordinates based on the Wi-Fi id at that pnt

pallavbakshi gravatar image pallavbakshi  ( 2017-02-07 06:46:39 -0500 )edit

Do you have any suggestions about accomplishing that? How can I create a 2D map using odometry and the Wi-Fi unique ID at that particular point in that map. If a map won't be possible then I was thinking about a 2D array containing a unique ID as the value and x,y as the indices. Any thoughts?

pallavbakshi gravatar image pallavbakshi  ( 2017-02-07 06:48:10 -0500 )edit

@pallavbakshi, it would be better if you create a new question with your doubts and reference this one. Bear in mind that this is actually an old question, already marked as answered, so you will get better visibility creating a new one.

Procópio gravatar image Procópio  ( 2017-02-07 10:36:22 -0500 )edit

answered 2020-08-09 01:59:21 -0500

Sanjuna Mariam Mathews gravatar image

This is the method to automatically position the robot on the map. (Alternative of 2D pose button)

Open RViz. Using pose estimate position the robot to the required pose.

rostopic echo /amcl_pose

note x and y of posotion

pose: pose: position: x: 0.2692 y: 0.0218 z: 0.0

give x as initial x pose give y as initial y pose

<include file="$(find v1robot_description)/launch/amcl.launch" &gt;="" <arg="" name="initial_pose_x" value="0.2692"/> <arg name="initial_pose_y" value="0.0218"/> </include>

add these values as the arguments initial_pose_x, initial_pose_y In my case orientation was not needed(so I have not tried changing orientation)

So from the next time when we load gazebo+amcl, the mobile robot automatically positions itself on the map. So no need to manually set the home pose using 2D pose estimate button once initial pose arguments are set.

edit flag offensive delete link more

answered 2014-03-27 03:04:39 -0500

Yantian_Zha gravatar image

Yep, set robot's initial pose and goal pose manually, by choosing 2D Pose Estimate and 2D Nav Goal to mark it(your robot's location and pose).

edit flag offensive delete link more

Question Tools



Asked: 2014-03-26 03:02:33 -0500

Seen: 8,052 times

Last updated: Mar 27 '14