pub struct MotionProfile {
pub total_steps: u32,
pub direction: Direction,
pub accel_steps: u32,
pub cruise_steps: u32,
pub decel_steps: u32,
pub initial_interval_ns: u32,
pub cruise_interval_ns: u32,
pub accel_rate: f32,
pub decel_rate: f32,
}Expand description
Computed motion profile for a move (asymmetric trapezoidal).
Fields§
§total_steps: u32Total steps to move (absolute value).
direction: DirectionDirection of motion.
accel_steps: u32Steps in acceleration phase.
cruise_steps: u32Steps in cruise phase (constant velocity).
decel_steps: u32Steps in deceleration phase.
initial_interval_ns: u32Initial step interval (nanoseconds) - at start of acceleration.
cruise_interval_ns: u32Cruise step interval (nanoseconds) - at max velocity.
accel_rate: f32Acceleration rate in steps/sec².
decel_rate: f32Deceleration rate in steps/sec².
Implementations§
Source§impl MotionProfile
impl MotionProfile
Sourcepub fn asymmetric_trapezoidal(
total_steps: i64,
max_velocity: f32,
acceleration: f32,
deceleration: f32,
) -> Self
pub fn asymmetric_trapezoidal( total_steps: i64, max_velocity: f32, acceleration: f32, deceleration: f32, ) -> Self
Create an asymmetric trapezoidal motion profile.
§Arguments
total_steps- Signed step count (positive = CW, negative = CCW)max_velocity- Maximum velocity in steps/secacceleration- Acceleration rate in steps/sec²deceleration- Deceleration rate in steps/sec²
Sourcepub fn symmetric_trapezoidal(
total_steps: i64,
max_velocity: f32,
acceleration: f32,
) -> Self
pub fn symmetric_trapezoidal( total_steps: i64, max_velocity: f32, acceleration: f32, ) -> Self
Create a symmetric trapezoidal profile (same accel and decel).
Sourcepub fn phase_at(&self, step: u32) -> MotionPhase
pub fn phase_at(&self, step: u32) -> MotionPhase
Get the phase at a given step number.
Sourcepub fn interval_at(&self, step: u32) -> u32
pub fn interval_at(&self, step: u32) -> u32
Calculate step interval for a given step number.
Uses the step timing formula for trapezoidal acceleration.
Sourcepub fn estimated_duration_secs(&self) -> f32
pub fn estimated_duration_secs(&self) -> f32
Estimate total duration of the motion profile in seconds.
This is an approximation based on the trapezoidal profile phases.
Trait Implementations§
Source§impl Clone for MotionProfile
impl Clone for MotionProfile
Source§fn clone(&self) -> MotionProfile
fn clone(&self) -> MotionProfile
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more