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: M3A frame fixed to the last body (a flange or tool after fixed joints), in its frame.
tip_pos: V3Implementations§
Source§impl Chain
impl Chain
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn frames(&self, q: &[f64]) -> Frames
pub fn frames(&self, q: &[f64]) -> Frames
Every body’s frame in the base frame at joint positions q.
Sourcepub fn inverse_dynamics(
&self,
q: &[f64],
qd: &[f64],
qdd: &[f64],
g: f64,
extra: Option<Inertial>,
tau: &mut [f64],
)
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.
Sourcepub fn mass_matrix(&self, q: &[f64], extra: Option<Inertial>, out: &mut [f64])
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.
Sourcepub fn dynamics(
&self,
q: &[f64],
qd: &[f64],
g: f64,
extra: Option<Inertial>,
mass: &mut [f64],
bias: &mut [f64],
)
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.
Sourcepub fn potential(&self, q: &[f64], g: f64, extra: Option<Inertial>) -> f64
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.
Sourcepub fn body_states(
&self,
q: &[f64],
qd: &[f64],
extra: Option<Inertial>,
) -> Vec<BodyState>
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).
Sourcepub fn momentum(
&self,
q: &[f64],
qd: &[f64],
extra: Option<Inertial>,
) -> (V3, V3)
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.
Sourcepub fn from_urdf(text: &str) -> Result<Self, ConfigError>
pub fn from_urdf(text: &str) -> Result<Self, ConfigError>
Reads a chain from URDF text.