Skip to main content

AxisView

Trait AxisView 

Source
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§

Source

fn control_word(&self) -> u16

Read the current control word.

Source

fn set_control_word(&mut self, word: u16)

Write the control word.

Source

fn set_target_position(&mut self, pos: i32)

Set the target position in encoder counts.

Source

fn set_profile_velocity(&mut self, vel: u32)

Set the profile velocity in counts/s.

Source

fn set_profile_acceleration(&mut self, accel: u32)

Set the profile acceleration in counts/s².

Source

fn set_profile_deceleration(&mut self, decel: u32)

Set the profile deceleration in counts/s².

Source

fn set_modes_of_operation(&mut self, mode: i8)

Write the modes of operation register (0x6060).

Source

fn modes_of_operation_display(&self) -> i8

Read the modes of operation display (0x6061).

Source

fn status_word(&self) -> u16

Read the status word.

Source

fn position_actual(&self) -> i32

Read the actual position in encoder counts.

Source

fn velocity_actual(&self) -> i32

Read the actual velocity in counts/s.

Provided Methods§

Source

fn error_code(&self) -> u16

Read the drive error code. Returns 0 if not mapped.

Source

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).

Source

fn negative_limit_active(&self) -> bool

True when the negative-direction hardware limit switch is active.

Source

fn home_sensor_active(&self) -> bool

True when the home reference sensor is active.

Implementors§