Skip to main content

Chain

Struct Chain 

Source
pub struct Chain {
    pub bodies: Vec<Body>,
    pub tip_rot: M3,
    pub tip_pos: V3,
}
Expand description

A serial chain on a fixed base, z up in the base frame.

Fields§

§bodies: Vec<Body>§tip_rot: M3

A frame fixed to the last body (a flange or tool after fixed joints), in its frame.

§tip_pos: V3

Implementations§

Source§

impl Chain

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn frames(&self, q: &[f64]) -> Frames

Every body’s frame in the base frame at joint positions q.

Source

pub fn tip(&self, q: &[f64]) -> (M3, V3)

The tip’s position in the base frame.

Source

pub fn inverse_dynamics( &self, q: &[f64], qd: &[f64], qdd: &[f64], g: f64, extra: Option<Inertial>, tau: &mut [f64], )

Recursive Newton-Euler: the joint torques (forces for prismatic joints) that give the accelerations qdd at positions q and speeds qd under gravity g (m/s^2, along -z of the base), extra a payload (mass, centre and inertia about it) in the last body’s frame. Out: tau.

Source

pub fn mass_matrix(&self, q: &[f64], extra: Option<Inertial>, out: &mut [f64])

The mass matrix M (n x n, row by row): column j is the inverse dynamics at rest without gravity for a unit acceleration of joint j.

Source

pub fn dynamics( &self, q: &[f64], qd: &[f64], g: f64, extra: Option<Inertial>, mass: &mut [f64], bias: &mut [f64], )

The mass matrix (mass_matrix) and the torques at zero acceleration (velocity terms and gravity, inverse_dynamics with q’’ = 0) at once, the links worked out once for both.

Source

pub fn potential(&self, q: &[f64], g: f64, extra: Option<Inertial>) -> f64

Potential energy in gravity g: the sum of m g z of every centre of mass.

Source

pub fn body_states( &self, q: &[f64], qd: &[f64], extra: Option<Inertial>, ) -> Vec<BodyState>

Every body in the base frame at joints q and speeds qd, extra merged into the last (BodyState).

Source

pub fn momentum( &self, q: &[f64], qd: &[f64], extra: Option<Inertial>, ) -> (V3, V3)

The chain’s linear momentum and its angular momentum about the base’s origin, at joints q and speeds qd.

Source

pub fn from_urdf(text: &str) -> Result<Self, ConfigError>

Reads a chain from URDF text.

Trait Implementations§

Source§

impl Clone for Chain

Source§

fn clone(&self) -> Chain

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 Debug for Chain

Source§

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

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

impl PartialEq for Chain

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Chain

Auto Trait Implementations§

§

impl Freeze for Chain

§

impl RefUnwindSafe for Chain

§

impl Send for Chain

§

impl Sync for Chain

§

impl Unpin for Chain

§

impl UnsafeUnpin for Chain

§

impl UnwindSafe for Chain

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.