Skip to content

Add a predicted dynamic-obstacle critic to CUDA MPPI and a crossing scenario - #320

Merged
rsasaki0109 merged 1 commit into
masterfrom
feature/mppi-dynamic-obstacles
Nov 21, 2026
Merged

rsasaki0109 merged 1 commit into
masterfrom
feature/mppi-dynamic-obstacles

Conversation

@rsasaki0109

Copy link
Copy Markdown
Owner

Summary

Until now, the production CUDA MPPI saw moving obstacles only as static costmap cells. This PR adds a constant-velocity prediction critic, and a CudaNav closed loop in which pedestrians cross the S-course.

Core: MppiGpu::setDynamicObstacles(const DynamicObstacle*, int), with up to 64 discs {x, y, vx, vy, radius}.

  • New MppiParams, off by default:
    • dynamic_obstacle_weight;
    • margin (0.4 m);
    • robot_radius (0.25 m);
    • growth (0.1 m/s), which inflates the obstacle with the prediction horizon.
  • Clearance at rollout time tau: c = |q(tau) - (p + v tau)| - r - robot_radius - growth tau.
    • c < 0 adds collision_cost, which feeds valid_rollout_ratio, all_colliding and retreat.
    • 0 <= c < margin adds weight (margin - c)^2 dt.
  • With weight 0 or no obstacles, the term is skipped and the plans are bit-identical.
  • The Nav2 plugin is unchanged; an obstacle input for it is follow-up work.

Python:

  • MppiPlanner.set_dynamic_obstacles(rows).
  • CudaNavPipeline.step(..., dynamic_obstacles=rows):
    • clears each track's disc, plus 0.15 m, from the occupancy grid, using the new _CudaNavGridChain.clear_disc on the device chain and NumPy on the host chain;
    • passes the tracks to MPPI. CudaNav's default weight is 25.

Scenario: cudarobotics-cudanav sim --scenario crossing --dynamic-mode map|tracked_static|predicted.

  • Two pedestrians walk back and forth across the two corridors.
  • The --seed option sets their schedules.
  • They pause rather than step into the robot, so any contact is robot-caused.
  • The tracker is a simulator oracle. The --obs-latency-frames, --obs-position-noise-m, --obs-velocity-noise-mps and --obs-dropout options degrade it.
  • Metrics:
    • robot-caused collisions;
    • contact frames;
    • minimum clearance;
    • pedestrian yield frames;
    • retreats;
    • occupied cells away from the walls.

Results (3 seeds per condition, docs/results/cudanav_dynamic_obstacles_2026-11-21.md)

Condition Goal Robot-caused collisions Median time to goal Median pedestrian yields Median retreats
Map only 0/3 0 - 0 58
Tracked, zero velocity 1/3 0 53.6 s 186 138
Tracked + CV prediction (oracle) 3/3 0 24.3 s 0 13
+ 2-frame delay, 0.05 m / 0.1 m/s noise 3/3 0 39.3 s 86 105
  • Map only: pedestrian sweeps leave lethal trails across the corridors, up to 108 cells, and block the robot.
  • Tracked, zero velocity: removing the pedestrians from the map clears the trails. Without velocity, though, the robot keeps steering into their path.
  • Prediction: with prediction, every run succeeds, and no pedestrian ever has to yield.

Limits

  • Synthetic world and plant, with an oracle tracker. LidarObjectPipeline tracks cars and vans only, so a scan-based pedestrian tracker is the next step.
  • Minimum clearance is about 0.05 m in every condition, partly because the pedestrians pause at 0.05 m.

Test plan

  • New CTest mppi_dynamic_obstacle_smoke:
    • a disabled critic, either weight 0 or no obstacles, is bit-identical to the plain planner;
    • a head-on mover slows the robot from 0.50 to 0.26 m/s, with some but not all rollouts invalid;
    • a co-located obstacle gives all_colliding;
    • invalid input throws.
  • Native cudanav_gpu_closed_loop_s_course --check is unchanged at 229 frames and 0.153% drift.
  • python/tests:
    • 73 passed and 1 skipped with a GPU;
    • 55 passed and 2 skipped with no GPU visible;
    • new tests cover the triangle-wave schedule, scan masking, clearance, the observation model, yielding, CLI usage errors, planner input validation, disc clearing on both chains, and predicted beating the map-only baseline.
  • python_source_provenance.py --check (60 hashes), test_python_core_sync.py, test_verify_python_release_artifacts.py, validate_paper_artifacts.py, redact_gpu_identity.py --check, and the CudaNav contract/closed-loop/version script tests all pass.
  • CI

🤖 Generated with Claude Code

https://claude.ai/code/session_01ALg7o339S7Rpi9hd751Cbt

…cenario

MppiGpu::setDynamicObstacles takes up to 64 constant-velocity discs. When
dynamic_obstacle_weight > 0 the rollout kernel penalizes clearance to each
predicted position, c = |q(tau) - (p + v tau)| - r - robot_radius -
growth * tau: c < 0 adds collision_cost (so it feeds valid ratio, all
colliding and retreat), 0 <= c < margin adds weight * (margin - c)^2 * dt.
With weight 0 or no obstacles the term is skipped and plans are
bit-identical (tests/mppi_dynamic_obstacle_smoke.cu); the native S-course
loop is unchanged at 229 frames and 0.153% drift.

Python: MppiPlanner.set_dynamic_obstacles, and CudaNavPipeline.step(...,
dynamic_obstacles=rows) clears each track's disc from the occupancy grid
(device and host chains) and passes the tracks to MPPI. New
`cudarobotics-cudanav sim --scenario crossing` runs one traversal while two
pedestrians cross the corridors, comparing map-only, tracked-without-
velocity, and predicted handling with an oracle tracker that can be
delayed, noisy and lossy.

3 seeds per condition (docs/results/cudanav_dynamic_obstacles_2026-11-21):
- map only: 0/3 reach the goal (lethal pedestrian trails block the corridor);
- tracked, zero velocity: 1/3 (pedestrians yield to it 186 frames, median);
- predicted (oracle): 3/3 in 24.3 s median, no pedestrian ever yields;
- predicted with 2-frame delay and noise: 3/3 in 39.3 s median.
No robot-caused collision in any run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALg7o339S7Rpi9hd751Cbt
@rsasaki0109
rsasaki0109 merged commit 84b137e into master Nov 21, 2026
11 checks passed
@rsasaki0109
rsasaki0109 deleted the feature/mppi-dynamic-obstacles branch November 21, 2026 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant