[][src]Trait saberrs::sabertooth2x32::Sabertooth2x32

pub trait Sabertooth2x32 {
    fn startup(&mut self, channel: usize) -> Result<()>;
fn shutdown(&mut self, channel: usize) -> Result<()>;
fn set_speed(&mut self, channel: usize, ratio: f32) -> Result<()>;
fn get_speed(&mut self, channel: usize) -> Result<f32>;
fn set_drive(&mut self, ratio: f32) -> Result<()>;
fn set_turn(&mut self, ratio: f32) -> Result<()>;
fn set_power(&mut self, channel: usize, ratio: f32) -> Result<()>;
fn get_power(&mut self, channel: usize) -> Result<f32>;
fn set_ramp(&mut self, channel: usize, ratio: f32) -> Result<()>;
fn set_aux(&mut self, channel: usize, ratio: f32) -> Result<()>;
fn get_voltage(&mut self, channel: usize) -> Result<f32>;
fn get_current(&mut self, channel: usize) -> Result<f32>;
fn get_temperature(&mut self, channel: usize) -> Result<f32>; fn stop_motors(&mut self) -> Result<()> { ... } }

Trait exposing the available methods for controlling the Sabertooth 2x32. Note: implementors may also provide additional methods.

Required methods

fn startup(&mut self, channel: usize) -> Result<()>

Returns the motor channel from a shutdown state to normal operation.

fn shutdown(&mut self, channel: usize) -> Result<()>

Shuts off the motor output. Using the shutdown command will put the motor in a hard brake state.

fn set_speed(&mut self, channel: usize, ratio: f32) -> Result<()>

Set the speed of the selected motor. channel is 1 or 2, ratio is a ratio between -1.0 for full backward and 1.0 for full forward (so 0.0 stops the motor).

fn get_speed(&mut self, channel: usize) -> Result<f32>

Get the current speed of the motor. See set_motor() for the values range.

fn set_drive(&mut self, ratio: f32) -> Result<()>

Set the drive. ratio is a ratio between -1.0 for full backward and 1.0 for full forward. Note: Both set_drive() and set_turn() must have been set at least once for having an effect.

fn set_turn(&mut self, ratio: f32) -> Result<()>

Set the turn value. ratio is a ratio between -1.0 for full left and 1.0 for full right. Note: Both set_drive() and set_turn() must have been set at least once for having an effect.

fn set_power(&mut self, channel: usize, ratio: f32) -> Result<()>

Set the power output of the selected motor. channel is 1 or 2, and ratio is a ratio between -1.0 and 1.0.

fn get_power(&mut self, channel: usize) -> Result<f32>

Return the current power output of the motor. channel is 1 or 2, and the returned value is a ratio between -1.0 and 1.0.

fn set_ramp(&mut self, channel: usize, ratio: f32) -> Result<()>

Set the speed ramping of the motor.

fn set_aux(&mut self, channel: usize, ratio: f32) -> Result<()>

fn get_voltage(&mut self, channel: usize) -> Result<f32>

Get the battery voltage on the selected motor, in volts.

fn get_current(&mut self, channel: usize) -> Result<f32>

Get the motor current in amperes. Positive current values mean energy is being drawn from the battery, and negative values indicate energy is being regenerated into the battery. Note: this noisy signal may vary by several amps, this is normal.

fn get_temperature(&mut self, channel: usize) -> Result<f32>

Get the temperature of the output transistors for this channel, in degrees celsius.

Loading content...

Provided methods

fn stop_motors(&mut self) -> Result<()>

Stop the motors, ie. set both speeds to zero.

Loading content...

Implementors

impl<T: SabertoothSerial> Sabertooth2x32 for PacketSerial<T>[src]

impl<T: SabertoothSerial> Sabertooth2x32 for PlainText<T>[src]

Loading content...