pub struct SolImp {
pub dmin: f64,
pub dmax: f64,
pub width: f64,
pub midpoint: f64,
pub power: f64,
}Expand description
MuJoCo-style solimp: constraint impedance as a function of the violation.
Impedance d in (0, 1) blends between a fully soft constraint (d -> 0,
no force at all) and a fully rigid one (d -> 1). Making it depend on
penetration depth is the point: a contact that has just been made is soft,
so making and breaking contact stays smooth (and differentiable), while a
deeply penetrating contact stiffens up and pushes hard.
Fields§
§dmin: f64Impedance at zero violation.
dmax: f64Impedance at and beyond width of violation.
width: f64Violation (in metres, for contacts) over which dmin -> dmax.
midpoint: f64Where in [0, 1] the sigmoid’s inflection sits.
power: f64Sigmoid power. 1 is linear; larger is flatter at both ends.
Implementations§
Source§impl SolImp
impl SolImp
Sourcepub fn impedance(&self, r: f64) -> f64
pub fn impedance(&self, r: f64) -> f64
Impedance at a constraint violation of r metres.
The interpolant is MuJoCo’s polynomial sigmoid: a x^p below the
midpoint and 1 - b (1-x)^p above it, with a and b chosen so the
halves meet at the midpoint. It is C^1 in r everywhere except the
clamp at x = 1.
Sourcepub fn impedance_derivative(&self, r: f64) -> f64
pub fn impedance_derivative(&self, r: f64) -> f64
d(impedance)/dr at a non-negative violation r.
Mirrors Self::impedance branch for branch, including its clamps: past
width the impedance is pinned at dmax, so the derivative is zero, and
a non-positive width makes it constant everywhere.
Defined for r >= 0 only. impedance takes r.abs(), so the function
has a kink at the origin whenever power == 1; for power > 1 (the
default) both one-sided derivatives are zero there and this returns the
value that is correct from either side.