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 (Robot::with_axial_velocity, Robot::with_axial_acceleration,
Robot::with_axial_jerk, torque constraints) and enforces common contracts.
§Trait requirements by solver family
Topp*Problem: model typeMonly needsRobotBasic.Copp*Problem: model typeMmust implementRobotTorque.
If you do not have a real inverse-dynamics model yet, use usize
as a placeholder implementing RobotTorque (tau = ddq).
Fields§
§constraints: ConstraintsShared station-indexed constraint buffer used by TOPP/COPP solvers.
Implementations§
Source§impl<M: RobotBasic> Robot<M>
impl<M: RobotBasic> Robot<M>
Sourcepub fn new(model: M) -> Self
pub fn new(model: M) -> Self
Construct a robot wrapper with default constraint-buffer capacity.
§Parameters
model: concrete robot model implementingRobotBasic.
Sourcepub fn with_capacity(model: M, capacity: usize) -> Self
pub fn with_capacity(model: M, capacity: usize) -> Self
Construct a robot wrapper with explicit initial constraint capacity.
§Parameters
model: concrete robot model implementingRobotBasic. Pass ausizevalue for a dimension-only placeholder that also satisfiesRobotTorquewith a trivial identity dynamics (tau = ddq), which is convenient for testing or applications without real inverse dynamics.capacity: pre-allocated number of station columns in the internal circular constraint buffer. Setting this to the expected number of path samples (e.g.n) avoids re-allocations during constraint ingestion. UseRobot::newwhen the size is unknown up-front.
Sourcepub fn with_s<T: AsInputMatrix1D + ?Sized>(
&mut self,
s_new: &T,
) -> Result<(), ConstraintError>
pub fn with_s<T: AsInputMatrix1D + ?Sized>( &mut self, s_new: &T, ) -> Result<(), ConstraintError>
Sourcepub fn with_q(
&mut self,
q_new: &InputMatrix<'_>,
dq_new: &InputMatrix<'_>,
ddq_new: &InputMatrix<'_>,
dddq_new: Option<&InputMatrix<'_>>,
idx_s: usize,
) -> Result<(), ConstraintError>
pub fn with_q( &mut self, q_new: &InputMatrix<'_>, dq_new: &InputMatrix<'_>, ddq_new: &InputMatrix<'_>, dddq_new: Option<&InputMatrix<'_>>, idx_s: usize, ) -> Result<(), ConstraintError>
Sourcepub fn with_axial_velocity<T1, T2>(
&mut self,
axial_velocity_max: T1,
axial_velocity_min: T2,
start_idx_s: usize,
) -> Result<(), ConstraintError>where
T1: UpperBound,
T2: UpperBound,
pub fn with_axial_velocity<T1, T2>(
&mut self,
axial_velocity_max: T1,
axial_velocity_min: T2,
start_idx_s: usize,
) -> Result<(), 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
ConstraintError::NoMatchDimensionsConstraintError::OutOfSBoundsConstraintError::NoGivenQInfoConstraintError::InvalidSignedBoundswhen max/min signs are invalid
Sourcepub fn with_axial_acceleration<T1, T2>(
&mut self,
axial_acceleration_max: T1,
axial_acceleration_min: T2,
start_idx_s: usize,
) -> Result<(), ConstraintError>where
T1: UpperBound,
T2: UpperBound,
pub fn with_axial_acceleration<T1, T2>(
&mut self,
axial_acceleration_max: T1,
axial_acceleration_min: T2,
start_idx_s: usize,
) -> Result<(), 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
ConstraintError::NoMatchDimensionsConstraintError::OutOfSBoundsConstraintError::NoGivenQInfoConstraintError::InvalidSignedBounds
Sourcepub fn with_axial_jerk<T1, T2>(
&mut self,
axial_jerk_max: T1,
axial_jerk_min: T2,
start_idx_s: usize,
) -> Result<(), ConstraintError>where
T1: UpperBound,
T2: UpperBound,
pub fn with_axial_jerk<T1, T2>(
&mut self,
axial_jerk_max: T1,
axial_jerk_min: T2,
start_idx_s: usize,
) -> Result<(), 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
ConstraintError::NoMatchDimensionsConstraintError::OutOfSBoundsConstraintError::NoGivenQInfo(needsq/dq/ddq/dddq)ConstraintError::InvalidSignedBounds
Source§impl<M: RobotTorque> Robot<M>
impl<M: RobotTorque> Robot<M>
Sourcepub fn with_axial_torque<T1, T2>(
&mut self,
axial_torque_max: T1,
axial_torque_min: T2,
start_idx_s: usize,
) -> Result<(), ConstraintError>where
T1: UpperBound,
T2: UpperBound,
pub fn with_axial_torque<T1, T2>(
&mut self,
axial_torque_max: T1,
axial_torque_min: T2,
start_idx_s: usize,
) -> Result<(), ConstraintError>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
ConstraintError::NoMatchDimensionsConstraintError::OutOfSBoundsConstraintError::NoGivenQInfoConstraintError::InvalidSignedBounds
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.