pub struct ConvexAdjointGradients {
pub objective: f64,
pub d_q0: DVec,
pub d_v0: DVec,
pub d_ctrl: Vec<DVec>,
pub d_inertia: Vec<[f64; 10]>,
pub d_friction: f64,
pub d_restitution: f64,
}Expand description
Everything one unified backward pass produces.
Fields§
§objective: f64The objective at the nominal rollout.
d_q0: DVecdJ/dq0 (length nq).
d_v0: DVecdJ/dv0 (length nv).
d_ctrl: Vec<DVec>dJ/du_t per step (each length nv).
d_inertia: Vec<[f64; 10]>dJ/dπ per body, canonical packing [m, cx, cy, cz, Ixx, Iyy, Izz, Ixy, Ixz, Iyz].
d_friction: f64dJ/dμ — the friction coefficient of ConvexContactRollout::material.
One scalar, not one per contact, because the rollout applies a single material to every body; this is the total derivative with respect to that shared coefficient.
Only sliding contacts contribute. A sticking contact sits strictly
inside the cone, so moving the cone boundary does not move the solution,
and a separating one carries no impulse. So a trajectory that never
slips reports exactly 0 here — a real property of Coulomb friction
rather than a missing term, and one a finite difference reproduces
exactly.
d_restitution: f64dJ/de — the restitution coefficient of
ConvexContactRollout::material, likewise a single shared scalar.
Zero for any trajectory whose contacts all approach below
ContactSolverConfig::restitution_threshold, where the low-speed ramp
has taken the effective restitution to zero — again a genuine flat
region of the model, not an omission.