Skip to main content

Multibody

Struct Multibody 

Source
pub struct Multibody<N>
where N: RealField + Copy,
{ /* private fields */ }
Expand description

An articulated body simulated using the reduced-coordinates approach.

Implementations§

Source§

impl<N> Multibody<N>
where N: RealField + Copy,

Source

pub fn user_data(&self) -> Option<&(dyn Any + Send + Sync + 'static)>

Retrieves a reference to the user-defined user-data attached to this object.

Source

pub fn user_data_mut( &mut self, ) -> Option<&mut (dyn Any + Send + Sync + 'static)>

Retrieves a mutable reference to the user-defined user-data attached to this object.

Source

pub fn set_user_data( &mut self, data: Option<Box<dyn Any + Send + Sync>>, ) -> Option<Box<dyn Any + Send + Sync>>

Sets the user-defined data attached to this object.

Source

pub fn take_user_data(&mut self) -> Option<Box<dyn Any + Send + Sync>>

Replace by None the user-defined data attached to this object and returns the old value.

Source

pub fn root(&self) -> &MultibodyLink<N>

The first link of this multibody.

Source

pub fn root_mut(&mut self) -> &mut MultibodyLink<N>

Mutable reference to the first link of this multibody.

Reference i-th multibody link of this multibody.

Return None if there is less than i + 1 multibody links.

Mutable reference to the multibody link with the given id.

Return None if the given id does not identifies a multibody link part of self.

The links of this multibody with the given name.

The number of links on this multibody.

Iterator through all the links of this multibody.

All link are guaranteed to be yielded before its descendant.

Mutable iterator through all the links of this multibody.

All link are guaranteed to be yielded before its descendant.

Source

pub fn damping( &self, ) -> &Matrix<N, Dynamic, Const<1>, VecStorage<N, Dynamic, Const<1>>>

The vector of damping applied to this multibody.

Source

pub fn damping_mut( &mut self, ) -> &mut Matrix<N, Dynamic, Const<1>, VecStorage<N, Dynamic, Const<1>>>

Mutable vector of damping applied to this multibody.

Set the mass of the specified link.

Set the angular inertia of the specified linked, expressed in its local space.

Source

pub fn joint_velocity( &self, link: &MultibodyLink<N>, ) -> Matrix<N, Dynamic, Const<1>, SliceStorage<'_, N, Dynamic, Const<1>, Const<1>, Dynamic>>

The generalized velocity at the joint of the given link.

Convert a force applied to the center of mass of the link rb_id into generalized force.

Convert a force applied to this multibody’s link rb_id center of mass into generalized accelerations.

Source

pub fn inv_mass_mul_unit_joint_force( &self, link: &MultibodyLink<N>, dof_id: usize, force: N, out: &mut [N], )

Convert a generalized force applied to le link rb_id’s degrees of freedom into generalized accelerations.

The joint attaching this link to its parent is assumed to be a unit joint.

Source

pub fn inv_mass_mul_joint_force( &self, link: &MultibodyLink<N>, force: Matrix<N, Dynamic, Const<1>, SliceStorage<'_, N, Dynamic, Const<1>, Const<1>, Dynamic>>, out: &mut [N], )

Convert a generalized force applied to the link rb_id’s degrees of freedom into generalized accelerations.

Source

pub fn augmented_mass( &self, ) -> &Matrix<N, Dynamic, Dynamic, VecStorage<N, Dynamic, Dynamic>>

The augmented mass (inluding gyroscropic and coriolis terms) in world-space of this multibody.

Source

pub fn joint_velocity_mut( &mut self, id: usize, ) -> Matrix<N, Dynamic, Const<1>, SliceStorageMut<'_, N, Dynamic, Const<1>, Const<1>, Dynamic>>

Retrieve the mutable generalized velocities of this link.

Source

pub fn generalized_force( &self, ) -> &Matrix<N, Dynamic, Const<1>, VecStorage<N, Dynamic, Const<1>>>

The generalized forces applied to this multibody at the next timestep.

Source

pub fn generalized_force_mut( &mut self, ) -> &mut Matrix<N, Dynamic, Const<1>, VecStorage<N, Dynamic, Const<1>>>

Mutable reference to the generalized forces applied to this multibody at the next timestep.

Trait Implementations§

Source§

impl<N> Body<N> for Multibody<N>
where N: RealField + Copy,

Source§

fn num_parts(&self) -> usize

The number of parts of this body.
Source§

fn part(&self, id: usize) -> Option<&(dyn BodyPart<N> + 'static)>

A reference to the specified body part.
Source§

fn deformed_positions(&self) -> Option<(DeformationsType, &[N])>

If this is a deformable body, returns its deformed positions.
Source§

fn deformed_positions_mut(&mut self) -> Option<(DeformationsType, &mut [N])>

If this is a deformable body, returns a mutable reference to its deformed positions.
Source§

fn clear_update_flags(&mut self)

Clear all the update flags of this body.
Source§

fn update_status(&self) -> BodyUpdateStatus

The flags tracking what modifications were applied to a body.
Source§

fn integrate(&mut self, parameters: &IntegrationParameters<N>)

Integrate the position of this body.
Source§

fn apply_displacement(&mut self, disp: &[N])

Applies a generalized displacement to this body.
Source§

fn clear_forces(&mut self)

Reset the timestep-specific dynamic information of this body.
Source§

fn update_kinematics(&mut self)

Updates the kinematics, e.g., positions and jacobians, of this body.
Source§

fn update_dynamics(&mut self, dt: N)

Update the dynamics property of this body.
Source§

fn update_acceleration( &mut self, gravity: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>, _: &IntegrationParameters<N>, )

Update the acceleration of this body given the forces it is subject to and the gravity.
Source§

fn generalized_acceleration( &self, ) -> Matrix<N, Dynamic, Const<1>, SliceStorage<'_, N, Dynamic, Const<1>, Const<1>, Dynamic>>

The generalized accelerations at each degree of freedom of this body.
Source§

fn generalized_velocity( &self, ) -> Matrix<N, Dynamic, Const<1>, SliceStorage<'_, N, Dynamic, Const<1>, Const<1>, Dynamic>>

The generalized velocities of this body.
Source§

fn generalized_velocity_mut( &mut self, ) -> Matrix<N, Dynamic, Const<1>, SliceStorageMut<'_, N, Dynamic, Const<1>, Const<1>, Dynamic>>

The mutable generalized velocities of this body.
Source§

fn gravity_enabled(&self) -> bool

Whether this body is affected by gravity.
Source§

fn enable_gravity(&mut self, enabled: bool)

Enable or disable gravity for this body.
Source§

fn activation_status(&self) -> &ActivationStatus<N>

Information regarding activation and deactivation (sleeping) of this body.
Source§

fn activate_with_energy(&mut self, energy: N)

Force the activation of this body with the given level of energy.
Source§

fn deactivate(&mut self)

Put this body to sleep.
Source§

fn set_deactivation_threshold(&mut self, threshold: Option<N>)

Sets the energy bellow which this body is put to sleep. Read more
Source§

fn set_status(&mut self, status: BodyStatus)

Set the status of this body.
Source§

fn status(&self) -> BodyStatus

The status of this body.
Source§

fn companion_id(&self) -> usize

The companion ID of this body.
Source§

fn set_companion_id(&mut self, id: usize)

Set the companion ID of this body (may be reinitialized by nphysics).
Source§

fn ndofs(&self) -> usize

The number of degrees of freedom of this body.
Source§

fn world_point_at_material_point( &self, part: &(dyn BodyPart<N> + 'static), point: &OPoint<N, Const<2>>, ) -> OPoint<N, Const<2>>

Transform the given point expressed in material coordinates to world-space.
Source§

fn position_at_material_point( &self, part: &(dyn BodyPart<N> + 'static), point: &OPoint<N, Const<2>>, ) -> Isometry<N, Unit<Complex<N>>, 2>

Transform the given point expressed in material coordinates to world-space.
Source§

fn material_point_at_world_point( &self, part: &(dyn BodyPart<N> + 'static), point: &OPoint<N, Const<2>>, ) -> OPoint<N, Const<2>>

Transform the given point expressed in material coordinates to world-space.
Source§

fn fill_constraint_geometry( &self, part: &(dyn BodyPart<N> + 'static), ndofs: usize, point: &OPoint<N, Const<2>>, force_dir: &ForceDirection<N>, j_id: usize, wj_id: usize, jacobians: &mut [N], inv_r: &mut N, ext_vels: Option<&Matrix<N, Dynamic, Const<1>, SliceStorage<'_, N, Dynamic, Const<1>, Const<1>, Dynamic>>>, out_vel: Option<&mut N>, )

Fills all the jacobians (and the jacobians multiplied by the inverse augmented mass matrix) for a constraint applying a force at the point center (relative to the body part’s center of mass) and the direction dir. Read more
Source§

fn has_active_internal_constraints(&mut self) -> bool

Returns true if this bodies contains internal constraints that need to be solved.
Source§

fn setup_internal_velocity_constraints( &mut self, ext_vels: &Matrix<N, Dynamic, Const<1>, SliceStorage<'_, N, Dynamic, Const<1>, Const<1>, Dynamic>>, parameters: &IntegrationParameters<N>, )

Initializes the internal velocity constraints of a body.
Source§

fn warmstart_internal_velocity_constraints( &mut self, dvels: &mut Matrix<N, Dynamic, Const<1>, SliceStorageMut<'_, N, Dynamic, Const<1>, Const<1>, Dynamic>>, )

For warmstarting the solver, modifies the delta velocity applied by the internal constraints of this body.
Source§

fn step_solve_internal_velocity_constraints( &mut self, dvels: &mut Matrix<N, Dynamic, Const<1>, SliceStorageMut<'_, N, Dynamic, Const<1>, Const<1>, Dynamic>>, )

Execute one step for the iterative resolution of this body’s internal velocity constraints.
Source§

fn step_solve_internal_position_constraints( &mut self, parameters: &IntegrationParameters<N>, )

Execute one step for the iterative resolution of this body’s internal position constraints.
Source§

fn add_local_inertia_and_com( &mut self, part_id: usize, com: OPoint<N, Const<2>>, inertia: Inertia2<N>, )

Add the given inertia to the local inertia of this body part.
Source§

fn velocity_at_point( &self, part_id: usize, point: &OPoint<N, Const<2>>, ) -> Velocity2<N>

Gets the velocity of the given point of this body.
Source§

fn apply_force( &mut self, part_id: usize, force: &Force2<N>, force_type: ForceType, auto_wake_up: bool, )

Apply a force at the center of mass of a part of this body.
Source§

fn apply_local_force( &mut self, part_id: usize, force: &Force2<N>, force_type: ForceType, auto_wake_up: bool, )

Apply a local force at the center of mass of a part of this body.
Source§

fn apply_force_at_point( &mut self, part_id: usize, force: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>, point: &OPoint<N, Const<2>>, force_type: ForceType, auto_wake_up: bool, )

Apply a force at a given point of a part of this body.
Source§

fn apply_local_force_at_point( &mut self, part_id: usize, force: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>, point: &OPoint<N, Const<2>>, force_type: ForceType, auto_wake_up: bool, )

Apply a local force at a given point of a part of this body.
Source§

fn apply_force_at_local_point( &mut self, part_id: usize, force: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>, point: &OPoint<N, Const<2>>, force_type: ForceType, auto_wake_up: bool, )

Apply a force at a given local point of a part of this body.
Source§

fn apply_local_force_at_local_point( &mut self, part_id: usize, force: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>, point: &OPoint<N, Const<2>>, force_type: ForceType, auto_wake_up: bool, )

Apply a local force at a given local point of a part of this body.
Source§

fn is_ground(&self) -> bool

Returns true if this body is the ground.
Source§

fn update_activation_status(&mut self)

Update whether this body needs to be waken up after a user-interaction.
Source§

fn advance(&mut self, _time_ratio: N)

Source§

fn validate_advancement(&mut self)

Source§

fn clamp_advancement(&mut self)

Source§

fn part_motion( &self, _part_id: usize, _time_origin: N, ) -> Option<BodyPartMotion<N>>

Source§

fn step_started(&mut self)

Source§

fn status_dependent_ndofs(&self) -> usize

The number of degrees of freedom (DOF) of this body, taking its status into account. Read more
Source§

fn status_dependent_body_part_velocity( &self, part: &(dyn BodyPart<N> + 'static), ) -> Velocity2<N>

The velocity of the specified body part, taking this body status into account. Read more
Source§

fn is_active(&self) -> bool

Check if this body is active.
Source§

fn is_dynamic(&self) -> bool

Whether or not the status of this body is dynamic.
Source§

fn is_kinematic(&self) -> bool

Whether or not the status of this body is kinematic.
Source§

fn is_static(&self) -> bool

Whether or not the status of this body is static.
Source§

fn activate(&mut self)

Force the activation of this body.

Auto Trait Implementations§

§

impl<N> Freeze for Multibody<N>
where N: Freeze,

§

impl<N> !RefUnwindSafe for Multibody<N>

§

impl<N> Send for Multibody<N>

§

impl<N> Sync for Multibody<N>

§

impl<N> Unpin for Multibody<N>
where N: Unpin,

§

impl<N> UnsafeUnpin for Multibody<N>
where N: UnsafeUnpin,

§

impl<N> !UnwindSafe for Multibody<N>

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> Finalize for T

Source§

unsafe fn finalize_raw(data: *mut ())

Safety 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Component for T
where T: Send + Sync + 'static,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,