pub struct MechanicalConstraints {
pub steps_per_revolution: u32,
pub steps_per_degree: f32,
pub max_velocity_steps_per_sec: f32,
pub max_acceleration_steps_per_sec2: f32,
pub min_step_interval_ns: u32,
pub limits: Option<StepLimits>,
pub max_velocity: DegreesPerSec,
pub max_acceleration: DegreesPerSecSquared,
}Expand description
Derived mechanical parameters computed from motor configuration.
These are computed once at initialization and used for all motion planning.
Fields§
§steps_per_revolution: u32Total steps per output revolution (steps × microsteps × gear_ratio).
steps_per_degree: f32Steps per degree of output rotation.
max_velocity_steps_per_sec: f32Maximum velocity in steps per second.
max_acceleration_steps_per_sec2: f32Maximum acceleration in steps per second squared.
min_step_interval_ns: u32Minimum step interval in nanoseconds (at max velocity).
limits: Option<StepLimits>Soft limits in steps (if configured).
max_velocity: DegreesPerSecMaximum velocity in degrees per second.
max_acceleration: DegreesPerSecSquaredMaximum acceleration in degrees per second squared.
Implementations§
Source§impl MechanicalConstraints
impl MechanicalConstraints
Sourcepub fn from_config(config: &MotorConfig) -> Self
pub fn from_config(config: &MotorConfig) -> Self
Compute mechanical constraints from motor configuration.
Sourcepub fn degrees_to_steps(&self, degrees: f32) -> i64
pub fn degrees_to_steps(&self, degrees: f32) -> i64
Convert degrees to steps.
Sourcepub fn steps_to_degrees(&self, steps: i64) -> f32
pub fn steps_to_degrees(&self, steps: i64) -> f32
Convert steps to degrees.
Sourcepub fn velocity_to_steps(&self, deg_per_sec: f32) -> f32
pub fn velocity_to_steps(&self, deg_per_sec: f32) -> f32
Convert deg/sec to steps/sec.
Sourcepub fn acceleration_to_steps(&self, deg_per_sec2: f32) -> f32
pub fn acceleration_to_steps(&self, deg_per_sec2: f32) -> f32
Convert deg/sec² to steps/sec².
Sourcepub fn velocity_to_interval_ns(&self, velocity_steps_per_sec: f32) -> u32
pub fn velocity_to_interval_ns(&self, velocity_steps_per_sec: f32) -> u32
Calculate step interval for a given velocity in steps/sec.
Sourcepub fn check_limits(&self, steps: i64) -> Option<i64>
pub fn check_limits(&self, steps: i64) -> Option<i64>
Check if a position is within soft limits.
Trait Implementations§
Source§impl Clone for MechanicalConstraints
impl Clone for MechanicalConstraints
Source§fn clone(&self) -> MechanicalConstraints
fn clone(&self) -> MechanicalConstraints
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more