Trait Servo

Source
pub trait Servo<I: Interface> {
    // Required methods
    fn set_enable_torque(
        &mut self,
        interface: &mut I,
        enable_torque: bool,
    ) -> Result<(), Error>;
    fn set_position(
        &mut self,
        interface: &mut I,
        value: f32,
    ) -> Result<(), Error>;
    fn get_position(&mut self, interface: &mut I) -> Result<f32, Error>;
}
Expand description

The generic servo trait

Allow using servos without knowing the exact type.

Required Methods§

Source

fn set_enable_torque( &mut self, interface: &mut I, enable_torque: bool, ) -> Result<(), Error>

Enable/Disable torque on the servo.

Source

fn set_position(&mut self, interface: &mut I, value: f32) -> Result<(), Error>

Set the goal position. Some servos will be put into “position control mode” when this method is called.

value is in unit: radians

Source

fn get_position(&mut self, interface: &mut I) -> Result<f32, Error>

Get the current position.

The result is returned in unit: radians

Implementors§

Source§

impl<I: Interface> Servo<I> for MX28<I>

Source§

impl<I: Interface> Servo<I> for M4210S260R<I>