pub struct CuTrajectoryPayload<const N: usize, const MAX_POINTS: usize = MAX_TRAJECTORY_POINTS> {
pub points: [CuTrajectoryPoint<N>; MAX_POINTS],
pub len: u32,
pub interpolation: CuTrajectoryInterpolation,
}Expand description
Fixed-capacity timestamped joint trajectory (CuMsgPayload-compliant).
Fields§
§points: [CuTrajectoryPoint<N>; MAX_POINTS]§len: u32Number of valid waypoints in points[..len].
interpolation: CuTrajectoryInterpolationHow CuTrajectoryPayload::sample reconstructs the motion between
points. parameterize and parameterize_cartesian_path set it to
the reconstruction their limits were validated on; hand-built
trajectories default to CuTrajectoryInterpolation::Linear.
Implementations§
Source§impl<const N: usize, const CAP: usize> CuTrajectoryPayload<N, CAP>
impl<const N: usize, const CAP: usize> CuTrajectoryPayload<N, CAP>
Sourcepub fn quintic_limit_ratio(
&self,
limits: &CuJointTrajectoryLimits<N>,
) -> Option<f64>
pub fn quintic_limit_ratio( &self, limits: &CuJointTrajectoryLimits<N>, ) -> Option<f64>
Smallest uniform time stretch under which the quintic reconstruction of
this trajectory respects limits, as a ratio of peak to limit (dimensionless).
Returns the largest of peak_v / v_max, sqrt(peak_a / a_max) and
cbrt(peak_j / j_max) over all segments and non-fixed joints (an infinite
jerk limit contributes nothing). A result <= 1 means the limits already
hold exactly. Returns None for fewer than two knots, non-positive
segment durations, non-finite values, joint-kind disagreements or limits
that are not positive.
Sourcepub fn stretch_time(&mut self, factor: f64) -> CuResult<()>
pub fn stretch_time(&mut self, factor: f64) -> CuResult<()>
Stretches all knot times by factor (dimensionless) and rescales
velocities by 1/factor and accelerations by 1/factor^2, so the motion
keeps its exact shape and every velocity, acceleration and jerk peak drops
by 1/factor, 1/factor^2 and 1/factor^3. factor must be finite and
positive.
Source§impl<const N: usize, const MAX_POINTS: usize> CuTrajectoryPayload<N, MAX_POINTS>
impl<const N: usize, const MAX_POINTS: usize> CuTrajectoryPayload<N, MAX_POINTS>
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates an empty trajectory with CuTrajectoryInterpolation::Linear.
Sourcepub fn points(&self) -> &[CuTrajectoryPoint<N>]
pub fn points(&self) -> &[CuTrajectoryPoint<N>]
Borrows the valid waypoint prefix.
Sourcepub fn push(&mut self, point: CuTrajectoryPoint<N>) -> CuResult<()>
pub fn push(&mut self, point: CuTrajectoryPoint<N>) -> CuResult<()>
Appends a waypoint; times must be strictly increasing.
Sourcepub fn sample(
&self,
t: Time,
out_positions: &mut [CuJointPosition; N],
out_velocities: &mut [CuJointVelocity; N],
) -> CuResult<()>
pub fn sample( &self, t: Time, out_positions: &mut [CuJointPosition; N], out_velocities: &mut [CuJointVelocity; N], ) -> CuResult<()>
Samples joint positions and velocities at t in place with the
payload’s interpolation.
Dispatches to sample_linear,
sample_cubic or
sample_quintic. Sampling before the first or
after the last waypoint holds that endpoint.
Sourcepub fn sample_with(
&self,
interpolation: CuTrajectoryInterpolation,
t: Time,
out_positions: &mut [CuJointPosition; N],
out_velocities: &mut [CuJointVelocity; N],
) -> CuResult<()>
pub fn sample_with( &self, interpolation: CuTrajectoryInterpolation, t: Time, out_positions: &mut [CuJointPosition; N], out_velocities: &mut [CuJointVelocity; N], ) -> CuResult<()>
Samples at t with an explicit interpolation, ignoring the payload’s.
Sourcepub fn sample_linear(
&self,
t: Time,
out_positions: &mut [CuJointPosition; N],
out_velocities: &mut [CuJointVelocity; N],
) -> CuResult<()>
pub fn sample_linear( &self, t: Time, out_positions: &mut [CuJointPosition; N], out_velocities: &mut [CuJointVelocity; N], ) -> CuResult<()>
Samples joint positions and velocities at t in place by linear
interpolation between the bracketing waypoints.
t is clamped to [0, duration]; sampling before the first or after
the last waypoint holds that endpoint. Errors on an empty trajectory or
on mismatched joint coordinate types.
Sourcepub fn sample_cubic(
&self,
t: Time,
out_positions: &mut [CuJointPosition; N],
out_velocities: &mut [CuJointVelocity; N],
) -> CuResult<()>
pub fn sample_cubic( &self, t: Time, out_positions: &mut [CuJointPosition; N], out_velocities: &mut [CuJointVelocity; N], ) -> CuResult<()>
Samples cubic Hermite interpolation using the stored positions and velocities.
parameterize and the non-S-curve profiles of
parameterize_cartesian_path validate their limits on this
reconstruction; it preserves the continuous position and velocity at
each stored knot.
Sourcepub fn sample_quintic(
&self,
t: Time,
out_positions: &mut [CuJointPosition; N],
out_velocities: &mut [CuJointVelocity; N],
) -> CuResult<()>
pub fn sample_quintic( &self, t: Time, out_positions: &mut [CuJointPosition; N], out_velocities: &mut [CuJointVelocity; N], ) -> CuResult<()>
Samples the quintic Hermite motion through the stored knots.
Each segment is the quintic matching position, velocity and
acceleration at both knots, so all three are continuous across the
trajectory and jerk is finite. parameterize_cartesian_path with the
S-curve profile verifies its limits on exactly this reconstruction. Sampling before the first
or after the last knot holds that endpoint.
Trait Implementations§
Source§impl<'de, C, const N: usize, const MAX_POINTS: usize> BorrowDecode<'de, C> for CuTrajectoryPayload<N, MAX_POINTS>
impl<'de, C, const N: usize, const MAX_POINTS: usize> BorrowDecode<'de, C> for CuTrajectoryPayload<N, MAX_POINTS>
Source§fn borrow_decode<D: BorrowDecoder<'de, Context = C>>(
decoder: &mut D,
) -> Result<Self, DecodeError>
fn borrow_decode<D: BorrowDecoder<'de, Context = C>>( decoder: &mut D, ) -> Result<Self, DecodeError>
Source§impl<const N: usize, const MAX_POINTS: usize> Clone for CuTrajectoryPayload<N, MAX_POINTS>
impl<const N: usize, const MAX_POINTS: usize> Clone for CuTrajectoryPayload<N, MAX_POINTS>
Source§fn clone(&self) -> CuTrajectoryPayload<N, MAX_POINTS>
fn clone(&self) -> CuTrajectoryPayload<N, MAX_POINTS>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<C, const N: usize, const MAX_POINTS: usize> Decode<C> for CuTrajectoryPayload<N, MAX_POINTS>
impl<C, const N: usize, const MAX_POINTS: usize> Decode<C> for CuTrajectoryPayload<N, MAX_POINTS>
Source§impl<'de, const N: usize, const MAX_POINTS: usize> Deserialize<'de> for CuTrajectoryPayload<N, MAX_POINTS>
impl<'de, const N: usize, const MAX_POINTS: usize> Deserialize<'de> for CuTrajectoryPayload<N, MAX_POINTS>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<const N: usize, const MAX_POINTS: usize> PartialEq for CuTrajectoryPayload<N, MAX_POINTS>
impl<const N: usize, const MAX_POINTS: usize> PartialEq for CuTrajectoryPayload<N, MAX_POINTS>
Source§impl<const N: usize, const MAX_POINTS: usize> Serialize for CuTrajectoryPayload<N, MAX_POINTS>
impl<const N: usize, const MAX_POINTS: usize> Serialize for CuTrajectoryPayload<N, MAX_POINTS>
impl<const N: usize, const MAX_POINTS: usize> StructuralPartialEq for CuTrajectoryPayload<N, MAX_POINTS>
Source§impl<const N: usize, const MAX_POINTS: usize> TypePath for CuTrajectoryPayload<N, MAX_POINTS>
impl<const N: usize, const MAX_POINTS: usize> TypePath for CuTrajectoryPayload<N, MAX_POINTS>
fn type_path() -> &'static str
fn short_type_path() -> &'static str
fn type_ident() -> Option<&'static str>
fn crate_name() -> Option<&'static str>
fn module_path() -> Option<&'static str>
Auto Trait Implementations§
impl<const N: usize, const MAX_POINTS: usize> Freeze for CuTrajectoryPayload<N, MAX_POINTS>
impl<const N: usize, const MAX_POINTS: usize> RefUnwindSafe for CuTrajectoryPayload<N, MAX_POINTS>
impl<const N: usize, const MAX_POINTS: usize> Send for CuTrajectoryPayload<N, MAX_POINTS>
impl<const N: usize, const MAX_POINTS: usize> Sync for CuTrajectoryPayload<N, MAX_POINTS>
impl<const N: usize, const MAX_POINTS: usize> Unpin for CuTrajectoryPayload<N, MAX_POINTS>
impl<const N: usize, const MAX_POINTS: usize> UnsafeUnpin for CuTrajectoryPayload<N, MAX_POINTS>
impl<const N: usize, const MAX_POINTS: usize> UnwindSafe for CuTrajectoryPayload<N, MAX_POINTS>
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,
impl<T> CuMsgPayload for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> GetTypeRegistration for 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