Add low-frequency MPPI sampling#6151
Open
mohamedsamirx wants to merge 1 commit into
Open
Conversation
b010a33 to
caa621c
Compare
Codecov Report❌ Patch coverage is
... and 25 files with indirect coverage changes 🚀 New features to boost your workflow:
|
caa621c to
0d449be
Compare
Signed-off-by: Mohamed Samir <94049545+mohamedsamirx@users.noreply.github.com>
0d449be to
dea0ad8
Compare
Author
|
@SteveMacenski, any news on this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Basic Info
tb3_loopback_simulation_launch.py; headless benchmark traces with RViz/plot replay inspectionDescription of contribution in a few bullet points
colored_noise.enabledcolored_noise.exponentcolored_noise.offset_tcolored_noise.offset_decay_ratecolored_noise.fmin2 * time_stepsfrequency^(-exponent / 2)colored_noise.offset_tcolored_noise.offset_decay_ratecolored_noise.fminvxwzvywhen holonomicsampling_std.reduction_factorso multi-iteration MPPI runs can optionally reduce the sampling standard deviation on later iterations.iteration_countremains1sampling_std.reduction_factoris1.0sampling_std.reduction_factorparameter loadingsampling_std.reduction_factorfallbackImplementation notes and scope
This PR adds the colored-noise sampling distribution to Nav2’s existing MPPI implementation. It is not intended to replace the whole MPPI controller derivation with a full paper-replica implementation.
The sampler itself follows the paper/reference structure closely:
One important theoretical difference is that Nav2 still uses its existing MPPI update and control-cost correction structure. The existing correction uses the configured per-axis sampling standard deviations. Colored noise introduces temporal correlation across the horizon, so this PR should be understood as adding a low-frequency sampling distribution to Nav2 MPPI rather than adding a full covariance-aware paper clone.
The multi-iteration refinement path works best with
regenerate_noises: true, which is already the default in Nav2 bringup params. If users disable noise regeneration, repeated iterations can reuse the same noise batch depending on configuration, which limits the usefulness of refinement.Description of documentation updates.
nav2_mppi_controller/README.mdwith the new colored-noise parameters.colored_noise.enabled: falsecolored_noise.exponent: 2.0colored_noise.offset_t: 1colored_noise.offset_decay_rate: 0.97colored_noise.fmin: 0.0sampling_std.reduction_factor: 1.0colored_noise.exponentshifts more sample energy into lower frequencies2.0was the best tested value0.5and1.0, were not favorable in this matrixDescription of how this change was tested
Build and unit tests
I built the MPPI package sequentially:
The build completed successfully.
I then ran the targeted unit tests:
ctest --test-dir /opt/overlay_ws/build/nav2_mppi_controller -R "noise_generator_test|optimizer_unit_tests" --output-on-failureResult:
The passing tests were:
noise_generator_testoptimizer_unit_testsBenchmark setup
I ran a repeated headless loopback simulation matrix using Nav2’s TurtleBot3 loopback simulation.
The benchmark runner launched a fresh Nav2 stack per trial, waited for lifecycle activation, sent a
NavigateToPosegoal, collected/cmd_vel_nav,odom, andcontroller_server/optimal_trajectory, then shut the stack down before the next trial. This was done to keep each trial isolated and avoid reusing stale state or artifacts.The benchmark also saved:
The matrix had:
Artifact integrity from the final matrix:
Scenarios tested
The scenarios were selected to include easy, moderate, and hard cases:
tb3_open_straight: basic straight navigation sanity checktb3_turning_route: moderate route with turning behaviortb3_tight_s_turn: hard route requiring tight maneuveringtb3_near_obstacle_crossing: hard obstacle interaction caseProfiles compared
The benchmark compared current baselines and low-frequency variants:
vanilla_rawvanilla_sgfvanilla_sgf_o1lowfreq_raw2.0, no SGFlowfreq_sgf_g0p50.5, SGF enabledlowfreq_sgf_g1p01.0, SGF enabledlowfreq_sgf_g2p02.0, SGF enabledlowfreq_refined_i2_s1p02.0, no SGF,iteration_count=2,sampling_std.reduction_factor=1.0lowfreq_refined_i3_s1p02.0, no SGF,iteration_count=3,sampling_std.reduction_factor=1.0Aggregate benchmark results
Overall success counts:
2.0+ SGF2.0iteration_count=2iteration_count=30.5+ SGF1.0+ SGFThe strongest positive case was
tb3_near_obstacle_crossing:2.0+ SGF2.0iteration_count=2iteration_count=30.5+ SGF1.0+ SGFThe easier scenarios were passed by all tested profiles:
tb3_open_straight: all profiles 2/2tb3_turning_route: all profiles 2/2The hard tight S-turn remained mixed:
2.02.0+ SGFiteration_count=2iteration_count=30.5+ SGF1.0+ SGFSmoothness, jitter, and frequency metrics
The benchmark also computed the smoothness and jitter metrics requested in #5973. Lower values are smoother for the delta/jitter/high-frequency metrics below.
Metric definitions:
Opt mean abs dvx/dwz: mean absolute step-to-step velocity change inside each published optimal trajectory.Inter first mean abs dvx/dwz: mean absolute change of the first optimal-trajectory command between controller iterations. This is the closest “inter-iteration jitter” metric.Inter overlap mean abs dvx/dwz: mean absolute change between overlapping shifted horizon commands from consecutive optimal trajectories.Cmd mean abs dvx/dwz: mean absolute command-to-command change in executed/cmd_vel_nav.Cmd HF vx/wz: high-frequency energy ratio in executed commands above the benchmark cutoff.Aggregate values from the final working matrix:
2.02.0+ SGFiteration_count=2iteration_count=3The metric takeaway is mixed and should be stated that way:
vxstep changes compared with the white Gaussian and SGF baselines.2.0+ SGF, had higherwzand inter-overlap deltas than SGF order 1, so it is not a blanket smoothness win.Runtime / controller-rate observations
All tested low-frequency profiles maintained approximately the expected
20 Hzoptimal trajectory publication rate in this matrix.Mean values from the final matrix:
2.0+ SGFiteration_count=3iteration_count=22.01.0+ SGF0.5+ SGFI interpret this as “no observed controller-rate degradation in this benchmark.” This is not a CPU profiler result; it only shows that the controller maintained the expected rate under these test conditions.
Smoothness / velocity inspection
I generated before/after-style plots for visual inspection of the velocity signals and trajectories. The plots include:
tb3_turning_routetb3_tight_s_turntb3_near_obstacle_crossingThe plots are intended to make the velocity/noise behavior inspectable rather than relying only on scalar metrics.
The main visual/metric finding is that colored-noise sampling changes the perturbation distribution before rollout/evaluation, while SGF smooths after the optimizer selects the trajectory. The best tested result came from combining colored noise exponent
2.0with SGF.Recommended plot attachments:
Benchmark interpretation
My conclusion from this matrix is:
2.0with SGF enabled.0.5and1.0, were not favorable in this matrix.2.0+ SGF in this test set.Future work that may be required.
colored_noise.enabledcolored_noise.exponentcolored_noise.offset_tcolored_noise.offset_decay_ratecolored_noise.fminsampling_std.reduction_factorvx_std,vy_std, andwz_stdexponent=0.0approximating white-noise spectral behavioroffset_tandoffset_decay_ratebehaviorFor Maintainers:
backport-*.