Constraint-Aware Diffusion Guidance for Robotics: Real-Time Obstacle Avoidance for Autonomous Racing

Hao Ma, Sabrina Bodmer, Andrea Carron, Melanie Zeilinger, Michael Muehlebach

TL;DR

Diffusion models excel at generating complex robotic motions but struggle to strictly enforce safety constraints without expensive retraining or slow projection steps. Constraint-Aware Diffusion Guidance (CoDiG) resolves this by directly injecting barrier function gradients into the reverse-diffusion process at inference time, avoiding the need for auxiliary neural networks or post-hoc projections. Paired with a warm-start sampling strategy, CoDiG enables real-time (2.5 Hz), collision-free autonomous racing on a miniature vehicle with a 100% obstacle avoidance success rate.

What Problem Does This Paper Address?

While diffusion models have emerged as a powerful tool for learning multimodal robotic behaviors from demonstration, deploying them in safety-critical, high-speed settings remains risky. Standard formulations train directly on data distributions without explicit safety or feasibility guarantees. When facing out-of-distribution conditions—such as dynamic obstacles—unconstrained diffusion models can easily generate collision-prone or physically impossible paths.

Prior attempts to enforce constraints either require:

  1. Retraining on massive, domain-specific datasets (prohibitively expensive in robotics),
  2. Training auxiliary classifier or energy networks to guide denoising, or
  3. Performing iterative projection steps at every denoising step, which introduces heavy computational overhead.

These approaches either compromise real-time replanning or struggle to generalize when obstacles move.

Methods

CoDiG steers score-based reverse diffusion using a differentiable barrier function that directly modifies the reverse stochastic differential equation (SDE):

  • Score Update with Barrier Guidance: The unconstrained reverse SDE score is augmented with an explicit barrier gradient: $$\nabla_x \log p_t(x_t \mid \mathcal{C}) = \nabla_x \log p_t(x_t) - \gamma_t \nabla_x V(x_t; \mathcal{C})$$ Here, $V(x_t; \mathcal{C})$ acts as a barrier potential derived from safety and task specifications rather than an auxiliary learned network.

  • Progressive Guidance Scheduling: Because imposing constraints onto pure Gaussian noise causes sampling instability, the guidance weight $\gamma_t$ follows a smooth logistic ramp-up schedule, increasing its influence only as the sample approaches the clean data manifold.

  • Barrier Function Design in the Frenet Frame: The barrier function balances collision avoidance (via a piecewise-linear approximation of signed distance to obstacles) with deviation from an offline-calculated nominal time-optimal path in Frenet coordinates ($y$ lateral displacement, $\phi$ yaw angle).
  • Warm-Start Acceleration: Instead of standard generation starting from pure noise across 500–1000 steps, CoDiG injects small noise into the previous iteration’s trajectory and runs just 50 reverse-denoising steps. This preserves temporal smoothness and enables high-frequency replanning.
  • Control Architecture: Generated trajectories feed directly into an obstacle-agnostic Tracking Model Predictive Controller (TMPC), which handles low-level vehicle tracking.
       Map & Obstacles
              │
              ▼ (gradient)
 Warm ──► Diffusion ──► Trajectory (y_ref) ──► Tracking ──► Vehicle
 Start     Planner                             MPC
   ▲          │
   └──────────┘ (previous plan)

Datasets

  • Base Expert Demonstrations: 100 time-optimal trajectories computed via an offline non-linear optimal control solver on a miniature race track with randomized obstacle configurations (~16 hours of compute).
  • Redundant Obstacle Augmentation: By recognizing that placing obstacles in non-interfering, safe regions does not alter the optimal trajectory, the authors expanded the initial 100 trajectories into 10,000 augmented scenarios without solving additional optimization problems. 80% was used for model training.

Key Insights and Ideas

  • Decoupling Feasibility from Learning: Instead of baking constraints into network weights or training specialized classifier heads, injecting closed-form barrier gradients during sampling allows a lightweight model to handle unseen, moving obstacles on the fly.
  • Zero-Cost Augmentation via Invariant Regions: Adding obstacles where the vehicle wouldn't drive anyway allows a 100-fold dataset expansion without running expensive trajectory optimization solvers.
  • Warm-Starting as an Inductive Bias: In dynamic robotics, re-sampling from pure Gaussian noise wastes computational budget and creates jumpy, discontinuous plans. Re-noising the prior plan by a controlled fraction provides temporal consistency and reduces compute time by roughly $3\times$.

Key Results

  • Real-Time Deployment: Achieved an inference frequency of 2.5 Hz on an NVIDIA RTX 4090 by reducing denoising steps from 1000 to 50 via warm-starting.
  • Obstacle Avoidance Performance: Deployed on a custom 1:43 scale autonomous car across 5 trials of 15 laps (75 total laps) featuring 10 distinct static and dynamic obstacle configurations, achieving a 100% collision avoidance success rate.
  • Near Time-Optimality: Trajectories closely mirror offline numerical time-optimal solutions, deviating slightly only to maintain safe clearance around obstacles.

Limitations and Future Work

  • Replanning Rate for Agile Obstacles: While 2.5 Hz is sufficient for moderate speeds, it may remain too slow for suddenly appearing or high-speed obstacles.
  • Handling Infeasible Scenarios: The diffusion model lacks an explicit infeasibility check. If a track is completely blocked, it still outputs a visually smooth path that violates physical constraints.
  • Heuristic Barrier Tuning: Weights balancing safety clearance versus time-optimality ($\alpha, \epsilon$) currently require empirical tuning. More principled, theoretically grounded tuning mechanisms remain an open problem.

Summary updated

BibTeX
@inproceedings{ma2025constraint,
  author = {Hao Ma and Sabrina Bodmer and Andrea Carron and Melanie Zeilinger and Michael Muehlebach},
  title = {{Constraint-Aware Diffusion Guidance for Robotics: Real-Time Obstacle Avoidance for Autonomous Racing}},
  booktitle = {Conference on Robot Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=nryBWao01j},
}
Figure