pub struct Tendon {
pub path: Vec<usize>,
pub stiffness: f64,
pub rest_length: f64,
pub max_force: f64,
pub damping: f64,
}Expand description
A tendon is a spring-damper system that follows a path through multiple bodies.
It generates forces along the path based on the current length vs. rest length.
Fields§
§path: Vec<usize>Sequence of body indices defining the tendon path.
stiffness: f64Spring stiffness (N/m or Nm/rad).
rest_length: f64Rest length (m).
max_force: f64Maximum force the tendon can exert (N).
damping: f64Damping coefficient (Ns/m).
Implementations§
Source§impl Tendon
impl Tendon
Sourcepub fn new(
path: Vec<usize>,
stiffness: f64,
rest_length: f64,
max_force: f64,
) -> Tendon
pub fn new( path: Vec<usize>, stiffness: f64, rest_length: f64, max_force: f64, ) -> Tendon
Create a new tendon with the given parameters.
Sourcepub fn with_damping(self, damping: f64) -> Tendon
pub fn with_damping(self, damping: f64) -> Tendon
Create a new tendon with damping.
Sourcepub fn current_length(&self, state: &State) -> f64
pub fn current_length(&self, state: &State) -> f64
Compute the current length of the tendon.
Sums the Euclidean distances between consecutive bodies in the path.
Sourcepub fn current_length_rate(&self, _state: &State) -> f64
pub fn current_length_rate(&self, _state: &State) -> f64
Compute the rate of change of tendon length.
This requires velocities, which we approximate from body transforms. For now, return 0.0 (proper implementation requires forward kinematics with velocities).
Sourcepub fn compute_forces(&self, state: &State) -> Vec<(usize, SpatialVec)>
pub fn compute_forces(&self, state: &State) -> Vec<(usize, SpatialVec)>
Compute forces applied to each body in the tendon path.
Returns a vector of (body_idx, force) pairs. Force is a SpatialVec (6D force/torque in world frame).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Tendon
impl RefUnwindSafe for Tendon
impl Send for Tendon
impl Sync for Tendon
impl Unpin for Tendon
impl UnsafeUnpin for Tendon
impl UnwindSafe for Tendon
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.