Skip to main content

SolImp

Struct SolImp 

Source
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: f64

Impedance at zero violation.

§dmax: f64

Impedance at and beyond width of violation.

§width: f64

Violation (in metres, for contacts) over which dmin -> dmax.

§midpoint: f64

Where in [0, 1] the sigmoid’s inflection sits.

§power: f64

Sigmoid power. 1 is linear; larger is flatter at both ends.

Implementations§

Source§

impl SolImp

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for SolImp

Source§

fn clone(&self) -> SolImp

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for SolImp

Source§

impl Debug for SolImp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SolImp

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for SolImp

Source§

fn eq(&self, other: &SolImp) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SolImp

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.