Differentiable simulation enables efficient policy optimization through analytic gradients, yet safety is commonly incorporated as a weighted penalty, requiring manual tuning of the trade-off between task performance and constraint satisfaction. We instead formulate obstacle avoidance as an explicit constraint and train quadrotor policies using primal--dual gradient descent--ascent through a differentiable simulator. We introduce two key components to enable effective constrained training. First, we propose a bounded clearance-based constraint function that provides informative gradients around the safety boundary while preventing large violations from destabilizing primal--dual optimization. Second, we introduce log-mean-exp (LME) aggregation to smoothly emphasize critical per-step safety violations across a trajectory and training batch within a single constraint governed by one dual variable. Together, these components enable the desired safety level to be specified directly while balancing constraint satisfaction and task completion. We theoretically prove that the proposed optimization with differentiable simulation converges to feasible policy under mild assumptions. Experiments demonstrate improved safety--performance trade-offs over fixed-penalty and existing policy-learning baselines, as well as generalization to denser out-of-distribution environments. Finally, the learned policy transfers zero-shot to Gazebo/PX4 and a physical quadrotor without additional fine-tuning.
Figures & tables
Fig. 1 : Zero-shot deployment of our primal–dual policy on a physical quadrotor. Due to practical limitations in reproducing the exact obstacle geometry, the physical obstacles serve as proxies for the virtual cylindrical obstacles perceived by the policy. The inset shows the corresponding trajectory in the policy’s perceived environment.
Fig. 2 : A. Comparison of our proposed bounded constraint cost with a conventional unbounded signed-distance-based cost proposed in [ 4 ] . B. Our permutation-invariant policy architecture for mapping vehicle states and variable obstacle configurations to control actions.
Task and training
Symbol
Description
Value
Symbol
Description
Value
B
Parallel envs.
256
T
Horizon
300 steps
Δt
Time step
0.03 s
Nobs
Obstacles
4
Nepoch
Epochs
20 k
vmax
Horiz. vel.
1.0 m/s
vmaxz
Vert. vel.
0.3 m/s
Constraint
TABLE I : Training parameters.
Fig. 3 : Training convergence of B2N (BPTT) and B2N (PPO), with B2N (BPTT) converging to a better-performing policy.
Fig. 4 : A. Representative trajectories of the baseline policies and our proposed method. B. Representative OOD trajectories comparing our method with B2N(BPTT). B2N fails near obstacle-adjacent goals (green/red) and in the narrow passage (blue), while ours succeeds in all cases. C. Consistent trajectories across differentiable simulation, Gazebo, and real-world deployment demonstrate zero-shot sim-to-real transfer. D. Real-world quadrotor trajectory over a 12-leg continuous circuit, with waypoints distributed on a 3 m-radius circle centered on the obstacle configuration.
Method
Task ↓
LME ↓
Coll. (%) ↓
Clear. p5 (m) ↑
Success ↑
B2N (PPO)
3.48±2.73
0.027±0.054
0.18
+0.504
90.5%
B2N (BPTT)
1.70±0.77
0.019±0.006
0.00
+0.665
100.0%
CGPO ( α/5 )
6.40±5.56
0.129±0.214
4.12
+0.042
10.3%
CGPO ( α/40 )
0.52±0.11
1.098±0.217
92.75
−0.664
97.7%
λ=4
0.34±0.00
1.122±0.171
99.23
−0.662
100.0%
λ=16
6.76±4.99
0.450±0.202
8.66
−0.044
67.9%
TABLE II : Held-out comparison over 10,240 obstructed scenarios (mean ± std.). Shaded rows denote methods achieving 100% success with positive 5th-percentile clearance. Within this subset, bold indicates the lower task cost.
Fig. 5 : A. λ evolution with our proposed bounded constraint cost. B. λ evolution with the unbounded constraint cost used by B2N [ 4 ] with β2 parameter sweep. C. Analysis of constraint aggregation. LME closely matches the exact maximum in separating colliding from collision-free trajectories and remains consistent across rollout horizons, unlike cumulative aggregation.