CudaRobotics Docs

ROS 2 plugin

Nav2 CUDA MPPI Controller

`cuda_mppi_controller::CudaMppiController` is a Nav2 controller plugin that maps each sampled trajectory rollout to one CUDA thread. The v0.3.0 release supports DiffDrive, Ackermann, and Omni motion models plus quality-gated offline bag evaluation.

End-to-End CudaNav Development Smoke

Run the complete command-driven loop from the current source checkout.

docker build --pull --no-cache -f docker/Dockerfile -t cudarobotics .
docker run --rm --gpus all -v "$PWD/out:/out" cudarobotics cudanav

# ROS 2 Jazzy source workspace
ros2 launch cuda_nav_bringup cudanav_closed_loop.launch.py

The image connects GPU KISS-ICP, rolling voxel mapping, typed ESDF, the Nav2 costmap layer, CUDA MPPI, and the simulator. The command exits non-zero unless `/out/cudanav_closed_loop.json` passes its short smoke gate. Release evidence still uses the separate 10-minute retained harness.

Build and Smoke Test

cd ros2_ws
colcon build --packages-select cuda_mppi_controller \
  --cmake-args -DCMAKE_BUILD_TYPE=Release
source install/setup.bash

ros2 run cuda_mppi_controller plugin_load_test
ros2 run cuda_mppi_controller parameter_validation_test
ros2 run cuda_mppi_controller mppi_gpu_standalone 2048
ros2 run cuda_mppi_controller mppi_gpu_standalone 2048 esdf
CUDA MPPI and Nav2 CPU MPPI rollout comparison
Closed-loop controller benchmark comparing the stock CPU controller and CUDA controller.

Controller Server Config

Point `controller_server` at the plugin and set the MPPI horizon, sample count, model, and limits.

controller_server:
  ros__parameters:
    controller_plugins: ["FollowPath"]
    FollowPath:
      plugin: "cuda_mppi_controller::CudaMppiController"
      batch_size: 8192
      time_steps: 56
      model_dt: 0.05
      motion_model: "DiffDrive"
      path_angle_weight: 0.25
      curvature_speed_weight: 0.0
      curvature_speed_min: 0.18
      distance_field_weight: 0.0
      distance_field_cutoff: 0.75

Full example: cuda_mppi_params.example.yaml.

Validated Parameters

Invalid configuration is rejected during configure and live parameter updates before the optimizer is rebuilt.

Horizon

Batch, steps, dt

`batch_size`, `time_steps`, `iteration_count`, `model_dt`, and `temperature` must be positive.

Limits

Velocity and model limits

Control bounds must be finite and internally consistent for the selected motion model.

Costs

Weights and lookahead

Weights, distance-field cutoff, lookahead distances, transform tolerance, and retreat scale reject invalid values.

Motion Models

Model Controls Notes
DiffDrive `vx`, `wz` Default model for differential-drive bases.
Ackermann `vx`, curvature-limited `wz` Uses `min_turning_r` to limit angular rate by forward speed.
Omni `vx`, `vy`, `wz` Adds lateral velocity sampling and limits.

Curvature Speed Critic

Set `curvature_speed_weight` above zero to slow rollout speed near sharp path bends.

The critic estimates local path curvature around the follow point and penalizes forward speed above a curvature-limited target with `curvature_speed_min` as the floor. It stays disabled by default because it is a bend-entry smoothness knob rather than a universal time-to-goal improvement.

Distance Field Critic

Enable `distance_field_weight` to add a smooth clearance cost near obstacles without changing the default costmap-only behavior.

The controller builds a truncated GPU distance-to-obstacle field from the local costmap each cycle. Cells beyond `distance_field_cutoff` receive no extra penalty, while rollouts near lethal or inscribed cells receive a quadratic clearance cost.

Open ESDF benchmark report

Diagnostics and Bag Evaluation

Capture per-cycle solve, validity, cost, retreat, and command signals when moving beyond synthetic benchmarks.

Diagnostics CSV

Set `diagnostics_csv_path`, then render the result with `scripts/render_cuda_mppi_diagnostics.py`.

python3 scripts/render_cuda_mppi_diagnostics.py \
  /tmp/cuda_mppi_diagnostics.csv \
  --output-stem docs/results/cuda_mppi_diagnostics_run

Bag / real-data harness

Use `scripts/run_cuda_mppi_bag_eval.py` to coordinate Nav2 startup, rosbag playback, topic recording, and diagnostics rendering.

Open harness guide