Implementation of anytime navigation algorithms in ROS 2

Hello everyone!

I hope I’m asking this in the right place.

Our team is moving towards using Nav2 for our autonomy system, and we have some plans to use anytime algorithms (e.g. Monte-Carlo Tree Search) to produce waypoints for the robot to follow. We think NavigateThroughPoses is the right things to use here as this will allow the robot to move through waypoints without stopping.

Right now Nav2 uses ROS actions, so we could send a goal containing the best sequence of waypoints so far to Nav2 to execute, however when the sequence of waypoints updates we would have to cancel the existing action, and re-send the goal to Nav 2. This can happen both fairly often or not often at all. Are there any suggestions as to how we should approach this problem?

  • It feels like it’d be nice to have a “feedforward” topic in ROS actions that provides updates or something.
  • Should we try to write a variant of Nav2 that uses topics instead?

Neat! I’d be interested in taking a glance at that if its going to be open-sourced.


You don’t need to cancel and re-submit. You can request a new goal to the action server even though there’s a currently executing one. In the action server language, we call this preemption and is very common. You can try this out yourself in a trivial example with the default bringup of Nav2 and request a goal. Then request another without canceling navigation. You should see that things update to that new goal instantly. In fact, that mechanic is what we use internal to Nav2 to stream updates to the controller server with new path plans at 1hz (or whatever rate in your BT).

Frequency is not an important matter, unless you’re talking about like 100hz or something. I’ve not tested the practical limits of preemption, but as long as its not too fast that your navigation system is not yet able to react (e.g. compute a path and start following for a couple of cycles), it should be fine.

I think the above answers the more pertinent questions. Let me know if you have any others.

Oh I didn’t even consider this. That sounds like the right approach here. I might need to play with that idea a little bit because there are interactions between other nodes that might benefit from this.