pub trait AxisView {
Show 15 methods
// Required methods
fn control_word(&self) -> u16;
fn set_control_word(&mut self, word: u16);
fn set_target_position(&mut self, pos: i32);
fn set_profile_velocity(&mut self, vel: u32);
fn set_profile_acceleration(&mut self, accel: u32);
fn set_profile_deceleration(&mut self, decel: u32);
fn set_modes_of_operation(&mut self, mode: i8);
fn modes_of_operation_display(&self) -> i8;
fn status_word(&self) -> u16;
fn position_actual(&self) -> i32;
fn velocity_actual(&self) -> i32;
// Provided methods
fn error_code(&self) -> u16 { ... }
fn positive_limit_active(&self) -> bool { ... }
fn negative_limit_active(&self) -> bool { ... }
fn home_sensor_active(&self) -> bool { ... }
}Expand description
Generic hardware interface for a CiA 402 servo drive.
Maps raw PDO fields. The Axis struct handles all CiA 402
protocol logic (state machine, PP handshake, homing) on top of this.
§Implementing
Implementors just map their struct’s PDO fields — no CiA 402 protocol knowledge is needed:
impl AxisView for MyDriveView<'_> {
fn control_word(&self) -> u16 { *self.control_word }
fn set_control_word(&mut self, w: u16) { *self.control_word = w; }
fn status_word(&self) -> u16 { *self.status_word }
fn set_target_position(&mut self, pos: i32) { *self.target_position = pos; }
// ... etc
}Required Methods§
Sourcefn control_word(&self) -> u16
fn control_word(&self) -> u16
Read the current control word.
Sourcefn set_control_word(&mut self, word: u16)
fn set_control_word(&mut self, word: u16)
Write the control word.
Sourcefn set_target_position(&mut self, pos: i32)
fn set_target_position(&mut self, pos: i32)
Set the target position in encoder counts.
Sourcefn set_profile_velocity(&mut self, vel: u32)
fn set_profile_velocity(&mut self, vel: u32)
Set the profile velocity in counts/s.
Sourcefn set_profile_acceleration(&mut self, accel: u32)
fn set_profile_acceleration(&mut self, accel: u32)
Set the profile acceleration in counts/s².
Sourcefn set_profile_deceleration(&mut self, decel: u32)
fn set_profile_deceleration(&mut self, decel: u32)
Set the profile deceleration in counts/s².
Sourcefn set_modes_of_operation(&mut self, mode: i8)
fn set_modes_of_operation(&mut self, mode: i8)
Write the modes of operation register (0x6060).
Sourcefn modes_of_operation_display(&self) -> i8
fn modes_of_operation_display(&self) -> i8
Read the modes of operation display (0x6061).
Sourcefn status_word(&self) -> u16
fn status_word(&self) -> u16
Read the status word.
Sourcefn position_actual(&self) -> i32
fn position_actual(&self) -> i32
Read the actual position in encoder counts.
Sourcefn velocity_actual(&self) -> i32
fn velocity_actual(&self) -> i32
Read the actual velocity in counts/s.
Provided Methods§
Sourcefn error_code(&self) -> u16
fn error_code(&self) -> u16
Read the drive error code. Returns 0 if not mapped.
Sourcefn positive_limit_active(&self) -> bool
fn positive_limit_active(&self) -> bool
True when the positive-direction hardware limit switch is active.
Implement this to wire a physical limit switch input from your
global memory / PDO mapping. If not implemented, returns false
(no limit switch).
Sourcefn negative_limit_active(&self) -> bool
fn negative_limit_active(&self) -> bool
True when the negative-direction hardware limit switch is active.
Sourcefn home_sensor_active(&self) -> bool
fn home_sensor_active(&self) -> bool
True when the home reference sensor is active.