Skip to content

fix: clear stale obstacle predictions and re-record the demo videos - #6

Merged
simone-contorno merged 9 commits into
mainfrom
fix/2.0.0-pre-tag
Sep 15, 2026
Merged

simone-contorno merged 9 commits into
mainfrom
fix/2.0.0-pre-tag

Conversation

@simone-contorno

Copy link
Copy Markdown
Owner

Description

Follow-up to #5, to land before v2.0.0 is tagged. The demo videos showed a controller bug: the predicted obstacle path stayed on screen after the robot reached its goal. This PR fixes that bug and re-records every demo video. It also adds two recorder options used to make those videos, and makes two docs corrections.

Controller fix

  • Bug: the controller cleared its predicted-obstacle markers (/prox_mpc_predicted_obstacles) only at the start of the next control cycle, and the markers never expire. Nav2 stops running control cycles once a task ends, so RViz kept showing the last prediction for several seconds after the goal while the obstacle moved on. This has been present since 1.0.0.
  • Fix: reset() now clears the stored predictions and publishes a DELETEALL. The controller server calls reset() when a task ends: on success, on failure and on deactivate. The publish is skipped while the publisher is deactivated, so the lifecycle publisher logs no warning.

Recording (prox_mpc_benchmark)

  • record_scenarios.py --gpu-offload renders RViz on the NVIDIA GPU through PRIME render offload, for RViz only. It is opt-in and needs a real X server.
  • record_scenarios.py --fullscreen starts RViz fullscreen and skips window placement, so the dock, top bar and title bar stay out of the capture.
  • The previous clips were captured on Xvfb, where RViz renders in software on the CPU next to the Nav2 stack. Only 11-22% of the frames were unique, so the clips looked choppy.

Media

  • Re-recorded the root demo grid and the four per-controller grids on a desktop session, fullscreen, with RViz on the GPU. The ProxMPC clips include the fix.
  • 49-89% of frames are now unique, and the controller grids no longer show the RViz panels.

Docs

  • prox_mpc_core CHANGELOG: the max_iter_sqp default change is marked Breaking.
  • README: no longer calls the predictive preset the default. Only predict_obstacles is on by default. The benchmark result also relies on obstacle_yield_band_m, obstacle_yield_caps_speed and allow_reversing, which are off by default and set in the predictive preset.
  • The multi-controller recording examples pass the new options, and the prox_mpc_benchmark 2.0.0 CHANGELOG lists them.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds capability)
  • Breaking change (existing behavior, interfaces, or parameters change)
  • Documentation only
  • Build, packaging, or CI

Behavioral impact

  • Does this change any command the controller produces? Yes, in one narrow case. The obstacle yield (obstacle_yield_band_m > 0, set by the predictive preset) reads the predictions kept from the previous cycle before this cycle's fill replaces them. Because reset() now empties them, the first control cycle of a new task no longer slows for predictions left over from the previous task, which can be arbitrarily old. deactivate() already cleared them the same way. From the second cycle on, nothing changes. Benchmark results are unaffected: every benchmark run launches a fresh Nav2 stack with a single goal, so no run has a previous task.
  • Does it touch a safety path (solver-failure deceleration, NoValidControl escalation, the non-finite-command guard, the footprint veto, obstacle keep-out constraints, or the tracker's lifecycle teardown guard)? No. The keep-out constraints are still rebuilt from fresh tracker data every cycle, before the solve.
  • Does it change a default parameter value? No.

Verification

  • colcon build --symlink-install passes
  • colcon test passes with no new failures
  • Added or updated tests covering the changed behavior: ResetClearsDrawnObstaclePredictions checks that a drawn prediction is cleared by reset(), and that a deactivated controller publishes nothing. Three recorder tests cover the new options.
  • Ran a launch or simulation reproduction (described below)

Reproduction: recorded 16 mode (b2) takes (4 scenarios × ProxMPC, DWB, MPPI, RPP) on the kinematic plant with the full Nav2 stack. For every ProxMPC take a bag of /odom, /tracked_obstacles and /prox_mpc_predicted_obstacles was checked against the scenario's true obstacle path. All 16 goals succeeded.

$ colcon build --symlink-install --base-paths src/prox_mpc
Summary: 7 packages finished [1.86s]
$ colcon test --base-paths src/prox_mpc && colcon test-result --verbose
Summary: 508 tests, 0 errors, 0 failures, 57 skipped

$ colcon test --packages-select prox_mpc_controller && colcon test-result --verbose
Summary: 156 tests, 0 errors, 0 failures, 4 skipped

# bag check, one ProxMPC take per dynamic scenario
== dynamic_line_forward: lines 276  closest point to truth p50 0.064 p95 0.108 max 0.158 m
   last motion +13.7 s, last drawn prediction +14.5 s; arrays after it: 1; clear-only array follows: True; drawn predictions after it: 0
== dynamic_circle: lines 292  closest point to truth p50 0.058 p95 0.091 max 0.097 m
   last motion +16.4 s, last drawn prediction +16.8 s; arrays after it: 1; clear-only array follows: True; drawn predictions after it: 0

The workspace run above was on 5689173; the two commits after it change only docs and the prox_mpc_benchmark CHANGELOG. The 57 skipped are cppcheck skips.

Checklist

  • Interfaces (topics, services, actions, TF, parameters) and their docs are in sync with the code: no interface changed; the controller's interface table notes when the markers are cleared.
  • package.xml and CMakeLists.txt updated if dependencies changed, and a row added to THIRD_PARTY_LICENSES.md for any new dependency: no dependencies changed.
  • CHANGELOG.rst updated for the affected package(s): prox_mpc_controller, prox_mpc_core, prox_mpc_benchmark.
  • No secrets, keys, or credentials in the diff
  • Documentation updated where behavior or configuration changed

record_scenarios.py renders RViz in software when recording on a
virtual display, which is CPU-heavy: under that load RViz draws at
8-18 fps, so every clip repeats frames, and the contention also slows
the local costmap's obstacle clearing.

--gpu-offload sets NVIDIA PRIME render offload for the rviz2 process
alone (__NV_PRIME_RENDER_OFFLOAD=1, __GLX_VENDOR_LIBRARY_NAME=nvidia),
so the Nav2 stack keeps its environment. It needs a real X server
running the NVIDIA driver; a virtual Xvfb display has no hardware GL to
offload to. Off by default, so existing invocations are unchanged.
The 2.0.0 entry marks warm_start's new default as breaking but not
max_iter_sqp's, though both change solver behaviour for a deployment
that relied on the previous defaults: max_iter_sqp now defaults to 1
instead of 100. Bloom builds the Debian changelog from this file at the
tagged commit, so the marker has to be in place before v2.0.0 is tagged.
The README called the predictive path the default. Only
predict_obstacles defaults on; the 6 % collision result also depends on
the obstacle-aware yield, its speed cap and allow_reversing, which are
all off by default and set in the predictive preset. A deployment that
kept the defaults would not get the behaviour the comparison measured.
On a desktop session the window manager keeps a managed window off its
panels, so moving RViz to the capture origin leaves the dock, the top
bar and the window's own title bar inside the grab.

--fullscreen starts RViz fullscreen, which shows the 3D view alone, and
skips the xdotool placement a fullscreen window does not need. Pair it
with --resolution at the full screen size: the grid combiner scales
every clip to its cell, so a native-resolution capture needs no other
change. Off by default, so Xvfb recordings are unchanged.
The previous grid was captured on a virtual Xvfb display, where RViz
renders with llvmpipe on the CPU alongside the Nav2 stack. It drew far
below the capture rate, so only 14-22% of the frames were unique and
the clips looked choppy, and one take showed predicted obstacle paths
detached from their obstacles.

- Re-record the four scenarios on the Xorg desktop, RViz fullscreen
  and rendered on the NVIDIA GPU, and rebuild the grid mp4 and GIF.
- Unique frames rise to 55-88% per clip; the predicted paths of both
  moving obstacles start within 0.17 m of the ground-truth position.
- Describe the fullscreen GPU recording as the way the bundled clips
  are made, and why a windowed or Xvfb capture falls short.
The predicted-obstacle markers were cleared only at the start of the
next control cycle. The controller server stops cycling when a task
ends, so RViz kept drawing the last prediction after the goal while
the obstacle moved on.

- reset(), which the controller server calls when a task ends, clears
  the predictions and publishes a DELETEALL while the publisher is
  active, and stays silent once it is deactivated.
- Add a unit test, a CHANGELOG entry and a note in the interface
  table.
The previous grids showed a predicted obstacle path frozen after the
goal, fixed in the controller by clearing it on reset, and the
four-controller grids were still CPU-rendered, windowed captures with
the RViz panels in frame.

- Re-record the four ProxMPC clips with the fix, fullscreen on the
  GPU, and the DWB, MPPI and RPP clips the same way.
- Rebuild the demo grid and the four controller grids; every clip
  reached its goal, with 49-89% unique frames against 11-22% before.
- Verified from a bag per ProxMPC take: the predicted paths start
  within 0.16 m of the obstacle while the robot moves and are cleared
  once the goal is reached.
The multi-controller recording examples still used the plain command,
which on a desktop session records a windowed RViz with its panels in
frame. Pass the same display, fullscreen and GPU offload flags the
bundled grids were recorded with.
- --gpu-offload and --fullscreen land before v2.0.0 is tagged, so they
  ship in 2.0.0 and belong in its changelog entry.
@simone-contorno simone-contorno self-assigned this Sep 15, 2026
@simone-contorno simone-contorno added enhancement New feature or request fix Fix an issue / bug labels Sep 15, 2026
@simone-contorno
simone-contorno merged commit 61ccf08 into main Sep 15, 2026
3 checks passed
@simone-contorno
simone-contorno deleted the fix/2.0.0-pre-tag branch September 15, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request fix Fix an issue / bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant