Skip to main content

Robot

Struct Robot 

Source
pub struct Robot<M: RobotBasic> {
    pub constraints: Constraints,
    /* private fields */
}
Expand description

User-facing robot wrapper that owns constraint storage and conversion logic.

§Design role

Robot<M> bridges robot-side physical constraints and solver-side normalized inequalities. Internally it owns Constraints, but exposes higher-level APIs with physical semantics.

§Why prefer this over direct Constraints

For most applications, Robot is the recommended entry because it provides domain-meaningful methods (with_axial_velocity, with_axial_acceleration, with_axial_jerk, with_axial_torque) and enforces common contracts.

§Trait requirements by solver family

  • Topp*Problem: model type M only needs RobotBasic.
  • Copp*Problem: model type M must implement RobotTorque.

If you do not have a real inverse-dynamics model yet, use usize as a placeholder implementing RobotTorque (tau = ddq).

Fields§

§constraints: Constraints

Shared station-indexed constraint buffer used by TOPP/COPP solvers.

Implementations§

Source§

impl<M: RobotBasic> Robot<M>

Source

pub fn model(&self) -> &M

Access the robot model M: RobotBasic as a reference.

Source

pub fn model_mut(&mut self) -> &mut M

Mutably access the robot model M: RobotBasic.

Source

pub fn new(model: M) -> Self

Construct a robot wrapper with default constraint-buffer capacity.

§Parameters
  • model: concrete robot model implementing RobotBasic.
Source

pub fn with_capacity(model: M, capacity: usize) -> Self

Construct a robot wrapper with explicit initial constraint capacity.

§Parameters
  • model: concrete robot model.
  • capacity: initial circular-buffer column capacity.
Source

pub fn dim(&self) -> usize

Get robot dimension / DoF.

Source

pub fn with_s<T: AsInputMatrix1D + ?Sized>( &mut self, s_new: &T, ) -> Result<&mut Self, ConstraintError>

Append a new station segment into the internal constraint buffer.

§Parameters
  • s_new: station samples accepted as 1D slice or matrix view.
§Errors
§Returns

Returns &mut Self for chaining on success.

Source

pub fn with_q( &mut self, q_new: &InputMatrix<'_>, dq_new: &InputMatrix<'_>, ddq_new: &InputMatrix<'_>, dddq_new: Option<&InputMatrix<'_>>, idx_s: usize, ) -> Result<&mut Self, ConstraintError>

Write path derivatives over interval starting at idx_s.

§Parameters
  • q_new, dq_new, ddq_new: required derivative matrices.
  • dddq_new: optional third derivative matrix.
  • idx_s: global start station id.
§Behavior
  • If dddq_new is provided, third-order derivative data is written for the target interval.
  • If dddq_new is None, existing third-order derivative data is cleared over the target interval.
§Errors
§Returns

Returns &mut Self for chaining on success.

Source

pub fn with_q_from_path_2nd( &mut self, path: &Path, idx_s_from: usize, idx_s_to: usize, ) -> Result<&mut Self, CoppError>

Sample a path over an existing station interval and store derivatives up to second order.

§Parameters
  • path: geometric path to evaluate at the stored station samples.
  • idx_s_from: global start station id (inclusive).
  • idx_s_to: global end station id (exclusive).
§Behavior
  • Reads the station samples already stored in [idx_s_from, idx_s_to).
  • Evaluates q, dq, and ddq from path at those samples.
  • Copies the evaluated derivatives into the robot’s constraint storage.
  • Clears third-order derivative data over the sampled interval.
  • Does not store a borrow of path; the path may be dropped after this call.
§Errors
  • CoppError::ConstraintError if the station interval is empty, out of bounds, or the evaluated path dimension does not match the robot dimension.
  • CoppError::PathError if path evaluation fails, for example because a stored station is outside the path range.
§Returns

Returns &mut Self for chaining on success.

Source

pub fn with_q_from_path_3rd( &mut self, path: &Path, idx_s_from: usize, idx_s_to: usize, ) -> Result<&mut Self, CoppError>

Sample a path over an existing station interval and store derivatives up to third order.

§Parameters
  • path: geometric path to evaluate at the stored station samples.
  • idx_s_from: global start station id (inclusive).
  • idx_s_to: global end station id (exclusive).
§Behavior
  • Reads the station samples already stored in [idx_s_from, idx_s_to).
  • Evaluates q, dq, ddq, and dddq from path at those samples.
  • Copies the evaluated derivatives into the robot’s constraint storage.
  • Does not store a borrow of path; the path may be dropped after this call.
§Errors
  • CoppError::ConstraintError if the station interval is empty, out of bounds, or the evaluated path dimension does not match the robot dimension.
  • CoppError::PathError if path evaluation fails, for example because a stored station is outside the path range.
§Returns

Returns &mut Self for chaining on success.

Source

pub fn with_axial_velocity<T1, T2>( &mut self, axial_velocity_max: T1, axial_velocity_min: T2, start_idx_s: usize, ) -> Result<&mut Self, ConstraintError>
where T1: UpperBound, T2: UpperBound,

Add axial velocity limits on interval starting at start_idx_s.

§Input semantics

Enforces per-axis bounds: axial_velocity_min < \dot{q} < axial_velocity_max.

§Mapping

Converts velocity bounds into first-order path-speed limits on a = \dot{s}^2, then fuses into amax.

§Errors
§Returns

Returns &mut Self for chaining on success.

Source

pub fn with_axial_acceleration<T1, T2>( &mut self, axial_acceleration_max: T1, axial_acceleration_min: T2, start_idx_s: usize, ) -> Result<&mut Self, ConstraintError>
where T1: UpperBound, T2: UpperBound,

Add axial acceleration limits on interval starting at start_idx_s.

§Input semantics

Enforces per-axis bounds: axial_acceleration_min < \ddot{q} < axial_acceleration_max.

§Mapping

Generates second-order rows: acc_a * a + acc_b * b <= acc_max, where (a,b) are path-speed variables.

§Errors
§Returns

Returns &mut Self for chaining on success.

Source

pub fn with_axial_jerk<T1, T2>( &mut self, axial_jerk_max: T1, axial_jerk_min: T2, start_idx_s: usize, ) -> Result<&mut Self, ConstraintError>
where T1: UpperBound, T2: UpperBound,

Add axial jerk limits on interval starting at start_idx_s.

§Input semantics

Enforces per-axis bounds: axial_jerk_min < \dddot{q} < axial_jerk_max.

§Mapping

Generates third-order rows used by TOPP3/COPP3: sqrt(a) * (jerk_a*a + jerk_b*b + jerk_c*c + jerk_d) <= jerk_max.

§Errors
§Returns

Returns &mut Self for chaining on success.

Source§

impl<M: RobotTorque> Robot<M>

Source

pub fn with_axial_torque<T1, T2>( &mut self, axial_torque_max: T1, axial_torque_min: T2, start_idx_s: usize, ) -> Result<&mut Self, CoppError>
where T1: UpperBound, T2: UpperBound,

Add axial torque limits on interval starting at start_idx_s.

§Input semantics

Enforces per-axis bounds: axial_torque_min < tau < axial_torque_max.

§Mapping

Using inverse dynamics, torque limits are transformed into second-order rows on (a,b) and appended to the constraint buffer.

§Errors
§Returns

Returns &mut Self for chaining on success.

Auto Trait Implementations§

§

impl<M> Freeze for Robot<M>
where M: Freeze,

§

impl<M> RefUnwindSafe for Robot<M>
where M: RefUnwindSafe,

§

impl<M> Send for Robot<M>
where M: Send,

§

impl<M> Sync for Robot<M>
where M: Sync,

§

impl<M> Unpin for Robot<M>
where M: Unpin,

§

impl<M> UnwindSafe for Robot<M>
where M: UnwindSafe,

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> 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

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

§

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

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

fn is_in_subset(&self) -> bool

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

fn to_subset_unchecked(&self) -> SS

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

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.