[Nav2] Model Predictive Path Integral (MPPI) Controller Now Available!

Hi all,

Your Friendly Neighborhood Navigator here with a hot-hot-hot and extra special announcement.

A massive development campaign spanning a plurality of my 2022 working time has finally met the last few requirements set out and has been released into the wild into Nav2. I’m super happy to announce the release of the New MPPI Controller, the first predictive controller in the Navigation Stack in ROS 1 or ROS 2 to continue progressing the themes of modern capabilities in the framework. This addresses one of the longest standing issues in ROS Navigation.

This project is the brainchild of Aleksei Budyakov (@artofnothingness) developed as a prototype at FastSense. I was so impressed by what I was seeing I dedicated my major development effort of 2022 to refining it, adding new critics, pluginizing the critics, tuning (and retuning [and retuning]), designing new behaviors I think are optimal for realistic robotic systems from my experience, battling the limitations of compute on your behalf to make it real-time, and more. All that said, Aleksei deserves a great deal of the credit and this project wouldn’t have been possible without his initial development and on-going support for my efforts to harden and expand it for use in the Nav2 system.

This controller is a predictive controller, a variant of MPC which is quite special in my opinion. While I won’t go into the nitty-gritty details of MPPI (there are papers for that), a notable element of this approach is that it enables the use of non-convex and non-differentiable objective functions to create optimal trajectories. This is quite important for realistic robotic applications where we want to do a bit more than just follow a carrot and minimize cross-track error. That opens the door to a whole new set of object functions in the MPC world (which we developed for this work) which can create truly fantastic behavior.

And truly fantastic behavior, I thinks this has. I encourage everyone to try it out and tell me what you think. I painstakingly tuned the system to provide really good out of the box behavior without you having to touch any of the dials for most situations (and where required, it is noted with guides in the readme).

  • It will really nicely back away from obstacles if close up to them and then go around smoothly – where ROS 1 and previous ROS 2 methods get stuck in local minima.
  • You don’t have to “choose” if you want to have exact path-following behavior or highly dynamic behavior due to obstacles. I’ve baked in the ability to do both simultaneously, whereas it will follow the path closely when not near dynamic obstacles but can be highly dynamic off the route when necessary
  • Of the 3 companies that I’ve been working with in recent months as beta testers, 2 have decided to move their primary systems over to it immediately and 1 is seriously considering it.
  • Work with differential, omnidirectional, and ackermann vehicles alongside highly configurable and replaceable objective functions

Per what I hope you’ve come to expect from Nav2, we have extensive configuration documentation, a fantastic 97% unit test coverage (those darn 20 lines escaped me this time rattles fist), and extremely well calibrated out of the box behavior.

https://navigation.ros.org/configuration/packages/configuring-mppic.html

I would be inundated with messages regarding TEB if I did not address it here. While TEB is quite a fantastic piece of software, the maintainer has since moved on from his academic career into a position where it is not possible to maintain it into the future. As such, its largely unmaintained and represents techniques which are bordering on a decade old. This work is very modern and state of the art in the same vertical of techniques as TEB (MPC) so it meets the same need that TEB serves. With MPPI’s modern methodology, performance, active maintenance, and documentation, I hope you all will agree with me over time that this is an improvement. There are certain characteristics of the Elastic Band approaches that I did not like in a production setting that are not present in this work.

Happy predictive controlling,

Steve

39 Likes

Great work! Looking forward to testing it on an ackerman steering. Since it interfaces with nav2::core, I’m assuming it’s only available on ROS2? What would be the best way to port to ROS1?

One way that comes to mind is to setup Nav2 in ROS2 and use ros1_bridge to communicate ROS2 and ROS1. Will attempt this weekend maybe

If you have familiarity with the code bases of ROS 1 controllers, you could probably knock out the bulk of it in a day or so. Differently from other new algorithms I’ve worked on in recent years, the MPPI Controller has a unique wrapper for dynamic parameters that I think would be quite the challenge to backport to ROS 1 - and the parameters are really baked into that.

Overall, there is no intent or roadmap to regress this work to ROS 1. This is all uniquely available and supported in Nav2, which is a ROS 2 based project. I hope you’ll consider moving to ROS 2, the water’s fine :sunglasses:

The bridge can help, but I’m not sure it’ll be as straight forward as you think.

3 Likes

This definitely would need a deep dive into the details. Maybe in some words, If you ever came across Model Predictive Path Following (MPFC) or Model Predictive Contouring Control (MPCC), what do MPPI introduce that the other two methods lack?

1 Like

Awesome work! Here is another question you might get inundated with so let’s make it public: is it coming to Humble?

EDIT: I opened a backport PR in the meantime

3 Likes

Great work ,
I cant wait to test this out .

It has been successfully backported to Humble as well!

4 Likes

The gif is not displayed here, but it shows a lot about its quality. You are carrying the ROS community on your shoulders with your state of the art packages, thanks a lot!

BTW;
Although the dynamic obstacles are handled ‘more dynamically’ here, do you have a plan to integrate dynamic obstacles with known poses and velocities like TEB? teb_local_planner/Tutorials/Incorporate dynamic obstacles - ROS Wiki Could be very useful for fast robot fleets.

At some point, its in my bank of future projects. There are more pressing needs in planning / control that need to be addressed first but after all those algorithms are around, I can take a higher level view of what’s been created to see what the best way to integrate those capabilities across the board with.

I’ll say though that MPPI actually handles non-modeled dynamic obstacles pretty well. But also the pluginized objective functions can allow you add a new one for modeling dynamic obstacles if you like in the meantime (and I’d be very open to reviewing a design/PR for one!).

1 Like

I completely understand,

and I am putting this in my bank of future possible feature contributions list as well :upside_down_face:

Calling all navigator extraordinaires!

Are you a user of the new MPPI controller in some product environment? Please send me a PM! I’d love to highlight your company in my upcoming ROSCon 2023 talk on the MPPI Controller showing all the cool uses of it in the wild!

Your Friendly Neighborhood Navigator

S