Arlo

Struct Arlo 

Source
pub struct Arlo {
    pub speed: Option<u8>,
    pub turn_speed: Option<u8>,
    pub step_time: Option<usize>,
    pub turn_time: Option<usize>,
    /* private fields */
}

Fields§

§speed: Option<u8>§turn_speed: Option<u8>§step_time: Option<usize>§turn_time: Option<usize>

Implementations§

Source§

impl Arlo

Source

pub fn new() -> Result<Self, sError>

Source

pub fn new_port(port: &str) -> Result<Self, sError>

Source

pub fn go_diff( &mut self, power_left: u8, power_right: u8, dir_left: u8, dir_right: u8, ) -> String

Start left motor with motor power powerLeft (in [0;127]) and direction dirLeft (0=reverse, 1=forward) and right motor with motor power powerRight (in [0;127]) and direction dirRight (0=reverse, 1=forward).

NOTE: Does NOT use wheel encoders.

Source

pub fn stop(&mut self) -> String

Send a stop command to stop motors. Sets the motor power on both wheels to zero.

NOTE: Does NOT use wheel encoders.

Source

pub fn go(&mut self) -> String

Send a go command for continuous forward driving using the wheel encoders

Source

pub fn backward(&mut self) -> String

Send a backward command for continuous reverse driving using the wheel encoders

Source

pub fn left(&mut self) -> String

Send a rotate left command for continuous rotating left using the wheel encoders

Source

pub fn right(&mut self) -> String

Send a rotate right command for continuous rotating right using the wheel encoders

Source

pub fn step_forward(&mut self) -> String

Send a step forward command for driving forward using the wheel encoders for a predefined amount of time

Source

pub fn step_backward(&mut self) -> String

Send a step backward command for driving backward using the wheel encoders for a predefined amount of time

Source

pub fn step_rotate_left(&mut self) -> String

Send a step rotate left command for rotating left using the wheel encoders for a predefined amount of time

Source

pub fn step_rotate_right(&mut self) -> String

Send a step rotate right command for rotating right using the wheel encoders for a predefined amount of time

Source

pub fn read_front_ping_sensor(&mut self) -> Result<usize, ()>

Read the front sonar ping sensor and return the measured range in milimeters [mm]

Source

pub fn read_back_ping_sensor(&mut self) -> Result<usize, ()>

Read the back sonar ping sensor and return the measured range in milimeters [mm]

Source

pub fn read_left_ping_sensor(&mut self) -> Result<usize, ()>

Read the left sonar ping sensor and return the measured range in milimeters [mm]

Source

pub fn read_right_ping_sensor(&mut self) -> Result<usize, ()>

Read the right sonar ping sensor and return the measured range in milimeters [mm]

Source

pub fn set_speed(&mut self, speed: u8) -> String

Speed must be a value in the range [0; 255]. This speed is used in commands based on using the wheel encoders.

Source

pub fn set_turnspeed(&mut self, turn_speed: u8) -> String

Turnspeed must be a value in the range [0; 255]. This speed is used in commands based on using the wheel encoders.

Source

pub fn set_step_time(&mut self, step_time: usize) -> String

steptime is the amount of miliseconds used in the step_forward and step_backwards commands.

Source

pub fn set_turn_time(&mut self, step_time: usize) -> String

turntime is the amount of miliseconds used in the step_rotate_left and step_rotate_right commands.

Source

pub fn read_left_wheel_encoder(&mut self) -> usize

Reads the left wheel encoder counts since last reset_encoder_counts command. The encoder has 144 counts for one complete wheel revolution.

Source

pub fn read_right_wheel_encoder(&mut self) -> usize

Reads the right wheel encoder counts since last clear reset_encoder_counts command. The encoder has 144 counts for one complete wheel revolution.

Source

pub fn reset_encoder_counts(&mut self) -> String

Reset the wheel encoder counts.

Trait Implementations§

Source§

impl Drop for Arlo

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl Freeze for Arlo

§

impl RefUnwindSafe for Arlo

§

impl Send for Arlo

§

impl Sync for Arlo

§

impl Unpin for Arlo

§

impl UnwindSafe for Arlo

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.