Ask Your Question

How to follow a nav_msgs/path ?

asked 2018-06-27 09:54:23 -0500

aarontan gravatar image


I am using this package to publish an astroid path.

I would like my robot to be able to follow this published path, I was wondering if anyone have a clue about how to approach this problem?

If I would like to redefine the path to something similar to a sine wave, how would I go about that?

Thank you, Aaron

edit retag flag offensive close merge delete


Have you taken a look at the navigation stack?

jayess gravatar image jayess  ( 2018-06-27 13:59:16 -0500 )edit

Please don't crosspost. It wastes time and effort of everyone. Please see our support page.

jayess gravatar image jayess  ( 2018-06-27 14:01:46 -0500 )edit

Oh okay, sorry I did not know about that but I understand now.

And yes I have looked at the navigation stack however I am not sure how to integrate move_base with a published path message. I am wondering if anyone have experience with this before and could provide me with some pointers.


aarontan gravatar image aarontan  ( 2018-06-27 14:48:14 -0500 )edit

I have the same problem. Are you finished and solve this problem? Thanks

Ahmed_Desoky gravatar image Ahmed_Desoky  ( 2020-07-20 13:04:00 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-06-28 01:06:49 -0500

mgruhler gravatar image

updated 2018-06-29 01:43:01 -0500

Basically, you have three options.

  1. Write your own "planner" that follows the path. This can actually be a simple controller without any collision avoidance and should be straightforward.
  2. You can write a GlobalPlannerPlugin to move_base that subscribes to the path you create (or creates it itself) and then passes it down to the local planner. There are quite some questions about this (e.g. here or here). Then you have the full capabilities of move_base available later on
  3. Use move_base_flex. This exposes additional actions which should let you do what you want directly. See this question for details.

I personally have done 1 (pretty easy) and 2 (works quite will). EVen though I haven't tested it, I'd say 3 would be the way to go now (though move_base_flex is currently still not very stable, but quite actively developed).


About option 1: No, there are no tutorials (that I know of). Just create a subscriber to your path message, and try to follow this using a simple controller. Most basic way would be to implement a simple P[I][D]-controller that trys to stay on the path with a fixed x-velocity (in my experience, PD is totally fine for such a task). If your robot is a differential drive, this is the easiest way.

About option 2: The link to the tutorial is in one of the linked answers above. For reference.

edit flag offensive delete link more


Thank you for your reply, I am interested in the first two options, do you have any tutorials on how to achieve this?

aarontan gravatar image aarontan  ( 2018-06-28 15:08:00 -0500 )edit

see edit above.

mgruhler gravatar image mgruhler  ( 2018-06-29 01:43:12 -0500 )edit

@mgruhler Hey, I have created a package that computes a global path and I want to execute option 2 from your answer where the global plugin subscribes to this path being published and passes it down to the local planner but am unable to implement it. Here is the code of the plugin I've written to subscribe to the global path and use it but it doesn't work -

Please let me know what should I do to solve this.

hanks gravatar image hanks  ( 2021-03-19 09:35:47 -0500 )edit

no. Post a new question including your code, describe what you are trying to do, what you have tried so far and where you are stuck...

mgruhler gravatar image mgruhler  ( 2021-03-19 11:12:45 -0500 )edit
hanks gravatar image hanks  ( 2021-03-19 11:17:06 -0500 )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-06-27 09:54:23 -0500

Seen: 2,403 times

Last updated: Jun 29 '18