ros-navigation / navigation2

ROS 2 Navigation Framework and System
https://nav2.org/
Other
2.31k stars 1.2k forks source link

Understand MPPI Critics and parameters #4376

Closed EnzoGhisoni closed 1 month ago

EnzoGhisoni commented 1 month ago

We are trying to use nav2 with the MPPI plugin as a local trajectory planner in our controller_server. The robot is a differential robot running ROS2 Humble on Ubuntu 22.04 and the version 1.1.14 of nav2_mppi_controller. By reading the readme.md from the repository and the configuration guide from the documentation, we still have difficulties to understand multiple points in order to tune our MPPI:

The understanding of offset_from_furthest parameter used by different critics remains also unclear. Does the parameter have the same function in the different critics ?

SteveMacenski commented 1 month ago

What are the difference between Path Align Critic and Path Angle Critic ?

They are a bit subtle so this I think is a fair question. PathAlign aligns the robot to the path by looking at the integrated distance between the reference path and the trajectory and scoring negatively for the sum total discrepancy. Thus, it tries to align the trajectories with the reference path. PathAngle instead looks at the angle wrt the robot and a point on the path some N points ahead and scores negatively if the angle is 'large'. This has the benefit of additionally scoring highly when you're doing a sharp turn or some other similar move that is difficult to achieve requiring some penalization for significant movement angularly that is out of the existing optimal trajectory's distribution.

Really, the PathAlign is doing all the work, but the PathAngle really helps you get out of some sticky situations where you're doing a sharp turn or otherwise are misaligned and need to get back on the right path. Its there to cover edge cases primarily and when you remove it, you'll see failure rates / total task times increase as it tries to do some soft optimizer resets to sample trajectories from another distribution.

The understanding of offset_from_furthest parameter used by different critics remains also unclear. Does the parameter have the same function in the different critics ?

No, but they all have the same meaning of picking a point offset from the furthest reference path point obtained by any trajectory in the batch. What they do with that point can be different. PathAlign "passes" when we're moving slow w.r.t. our expected speed so that we don't try to over optimize for exact alignment while getting started tracking a path which creates a more natural behavior. Some of the critics have "pass" conditions where its best they not be considered in that context for natural / fluid behavior

EnzoGhisoni commented 1 month ago

Thanks for your explanation and your time.