Ask Your Question

switch between GPS and AMCL based on location

asked 2018-09-10 17:26:44 -0600

billy gravatar image

Background on my robot situation:

  • Outdoor robot. Not waterproof. Not submersible.

  • In-ground swimming pool. No fence between robot and pool.

  • GPS that is very accurate (5 cm) when not near the house but terrible near the house (2 - 5 meter jumps near house).

  • Laser scanner that's good to about 4 - 5 meters.

  • ODOM is pretty good and have IMU with mag.

  • Strong preference to keep robot out of the pool.

I would like to be able to use the NAV Stack relying on AMCL near the house, and then transition to using primarily the GPS when away from the house (the map is empty away from house so AMCL provides no location data there). GPS should be ignored near the house. There is nothing near the pool for laser scanner to see so must rely primarily on GPS around the pool.


Have any of you had success with a NAV Stack setup that used different "weighting" on AMCL or GPS based on location within the map? If so, how did you approach?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-09-11 01:09:59 -0600

mgruhler gravatar image

I don't have experience with this use case. But in an at least similar situation (having to run multiple SLAM algorithms simultaneously, but only using one), we did something I could imagine could help here as well.

I'm assuming you have both, navigation with amcl and navigation with GPS setup and working. I.e. both run perfectly fine seperatly. Also, you need to have the origin of both aligned.

The most important thing is to handle tf then. Best would be if you remap the tf output of the localization nodes to nirvana (something like tf_disabled) or disable it altogether (amcl has the tf_broadcast parameter). Then create a node that subscribes to both pose topics of your localization algorithms (i.e. amcl_pose and equivalent). With those two topics you have the relevant information in your node. Your node then needs to evaluate your conditions (whether if this is a simple "if-in-here-than-this-localization" check or something more fancy like weighted average with adjustable weight or even something like a Kalman-Filter with dynamic covariances) and publish the result on a topic and broadcast the relevant transform to tf.

There are still some issues that need to be resolved:

  • you should avoid larger jumps, as this could badly influence the navigation/path_planning within move_base.
  • If you use a static costmap layer, the origins are again important
  • if you want to do some gps fencing around the pool, this obviously needs to be handleded in path_planning as well.
edit flag offensive delete link more


Thanks mgruhler. I have nav with AMCL working. I will follow your advice and get GPS nav working stand alone. Then work through how to get them running side by side. I like the idea of GPS fencing. That should be easy to set up in a simple disable-robot-if-in-the-box way.

billy gravatar image billy  ( 2018-09-11 11:50:56 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-09-10 17:26:44 -0600

Seen: 392 times

Last updated: Sep 11 '18