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

Set start position of robot within amcl

asked 2019-02-13 05:12:16 -0500

FaliRey gravatar image

updated 2019-02-15 05:52:11 -0500

mgruhler gravatar image

Hi, I'm working with a mobile robot. Every time I start it I have to start at the same point(the point which is the origin in the map_server map config file). But I want to save the last position of the base_link(to a file for example, no problem with that) when I shutdown the system to let him know at restarting where it was. Is there any way to set a default value for a transform beetween 2 frames with tf2?

Thank you

edit retag flag offensive close merge delete

Comments

1

This is not really anything to do with the TF2 system, but the localisation system that is being used on the robot. There will probably be a method to set the initial pose of the robot there.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-02-13 06:08:14 -0500 )edit

do you use your own localisation system, or something provided as debian pkg, like amcl? If you let us know, we can help more.

mgruhler gravatar image mgruhler  ( 2019-02-13 06:18:03 -0500 )edit

Yes, sorry, I use amcl localisation system with a front laser.

FaliRey gravatar image FaliRey  ( 2019-02-13 06:19:38 -0500 )edit

FYI: I took the liberty of rephrasing your question to better reflect the actual problem.

mgruhler gravatar image mgruhler  ( 2019-02-15 05:52:49 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2019-02-13 06:28:50 -0500

mgruhler gravatar image

updated 2019-02-13 06:31:04 -0500

For amcl you have to options:

Publish to initalpose (after startup) or set the intial_pose_x/y/a parameters (before startup of amcl). Check the wiki for details.

You can obviously use those by writing your own node which does the saving to file, loading from file and publish/set parameters. Only thing to somehow keep track of is wether this has the desired effect, i.e. some kind of state checking which distinguishes between "amcl started, but at origin location" and "amcl started and read start parameters / got initialpose". As both, setting the parameters before amcl starts and sending to a topic is not easy to get feedback on, you'd need to be creative :-)

Edit:

actually, there is a third option, which is calling the set_map service. This allows you to send a map together with the inital pose. As this is a service, you'll receive notifications about wether this has been successfull.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-02-13 05:12:16 -0500

Seen: 1,237 times

Last updated: Feb 15 '19