Skip to main content

CuTrajectoryPayload

Struct CuTrajectoryPayload 

Source
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: u32

Number of valid waypoints in points[..len].

§interpolation: CuTrajectoryInterpolation

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

Source

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.

Source

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>

Source

pub fn new() -> Self

Creates an empty trajectory with CuTrajectoryInterpolation::Linear.

Source

pub const fn is_empty(&self) -> bool

Returns true when the trajectory holds no waypoints.

Source

pub const fn len(&self) -> usize

Returns the number of valid waypoints.

Source

pub fn duration(&self) -> Time

Returns the last waypoint time, or zero when empty.

Source

pub fn points(&self) -> &[CuTrajectoryPoint<N>]

Borrows the valid waypoint prefix.

Source

pub fn push(&mut self, point: CuTrajectoryPoint<N>) -> CuResult<()>

Appends a waypoint; times must be strictly increasing.

Source

pub fn clear(&mut self)

Drops all waypoints; the interpolation is kept.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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>

Source§

fn borrow_decode<D: BorrowDecoder<'de, Context = C>>( decoder: &mut D, ) -> Result<Self, DecodeError>

Attempt to decode this type with the given BorrowDecode.
Source§

impl<const N: usize, const MAX_POINTS: usize> Clone for CuTrajectoryPayload<N, MAX_POINTS>

Source§

fn clone(&self) -> CuTrajectoryPayload<N, MAX_POINTS>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const N: usize, const MAX_POINTS: usize> Debug for CuTrajectoryPayload<N, MAX_POINTS>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<C, const N: usize, const MAX_POINTS: usize> Decode<C> for CuTrajectoryPayload<N, MAX_POINTS>

Source§

fn decode<D: Decoder<Context = C>>(decoder: &mut D) -> Result<Self, DecodeError>

Attempt to decode this type with the given Decode.
Source§

impl<const N: usize, const MAX_POINTS: usize> Default for CuTrajectoryPayload<N, MAX_POINTS>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

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

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<const N: usize, const MAX_POINTS: usize> Encode for CuTrajectoryPayload<N, MAX_POINTS>

Source§

fn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), EncodeError>

Encode a given type.
Source§

impl<const N: usize, const MAX_POINTS: usize> PartialEq for CuTrajectoryPayload<N, MAX_POINTS>

Source§

fn eq(&self, other: &CuTrajectoryPayload<N, MAX_POINTS>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<const N: usize, const MAX_POINTS: usize> Serialize for CuTrajectoryPayload<N, MAX_POINTS>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

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>

§

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> 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> CuMsgPayload for T
where T: Default + Debug + Clone + Encode + Decode<()> + Serialize + DeserializeOwned + Reflect,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> GetTypeRegistration for T

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> PayloadDefaultHandlePolicyApply for T
where T: ?Sized,

§

fn apply_handle_content_policy(&self, _mode: HandleContent)

§

impl<T> PayloadDefaultLoggingPolicy for T
where T: ?Sized,

§

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
§

impl<T> Reflect for T
where T: 'static,

§

impl<T> ReflectTypePath for T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.