[][src]Struct lss_driver::LSSDriver

pub struct LSSDriver { /* fields omitted */ }

Driver for the LSS servo

Implementations

impl LSSDriver[src]

pub fn new(port: &str) -> Result<LSSDriver, Box<dyn Error>>[src]

Create new driver on a serial port with default settings

Default baud_rate is 115200

Arguments

  • post - Port to use. e.g. COM1 or /dev/ttyACM0

Example

use lss_driver::LSSDriver;
let mut driver = LSSDriver::new("COM1").unwrap();

pub fn with_baud_rate(
    port: &str,
    baud_rate: u32
) -> Result<LSSDriver, Box<dyn Error>>
[src]

Create new driver on a serial port with custom baud rate

Arguments

  • post - Port to use. e.g. COM1 or /dev/ttyACM0
  • baud_rate - Baudrate. e.g. 115200

Example

use lss_driver::LSSDriver;
let mut driver = LSSDriver::with_baud_rate("COM1", 115200).unwrap();

pub fn with_driver(driver: Box<dyn FramedDriver>) -> LSSDriver[src]

Creates new LSS driver with a custom implementation of the transport

This is used for tests and can be used if you want to reimplement the driver over network

pub async fn query_id<'_>(&'_ mut self, id: u8) -> Result<u8, Box<dyn Error>>[src]

Query value of ID Especially useful with BROADCAST_ID

wiki

Arguments

  • id - ID of servo you want to control

Example

use lss_driver::LSSDriver;
async fn async_main(){
    let mut driver = LSSDriver::with_baud_rate("COM1", 115200).unwrap();
    let id = driver.query_id(lss_driver::BROADCAST_ID).await.unwrap();
}

pub async fn set_id<'_>(
    &'_ mut self,
    id: u8,
    new_id: u8
) -> Result<(), Box<dyn Error>>
[src]

Set value of ID Saved to EEPROM Only takes effect after restart

wiki

Arguments

  • id - ID of servo you want to control
  • new_id - ID You want that servo to have

pub async fn set_color<'_>(
    &'_ mut self,
    id: u8,
    color: LedColor
) -> Result<(), Box<dyn Error>>
[src]

set color for driver with id

Arguments

  • id - ID of servo you want to control
  • color - Color to set

pub async fn query_color<'_>(
    &'_ mut self,
    id: u8
) -> Result<LedColor, Box<dyn Error>>
[src]

Query color of servo LED

Arguments

  • id - ID of servo you want to query

pub async fn move_to_position<'_>(
    &'_ mut self,
    id: u8,
    position: f32
) -> Result<(), Box<dyn Error>>
[src]

Move to absolute position in degrees

Supports virtual positions that are more than 360 degrees

Arguments

  • id - ID of servo you want to control
  • position - Absolute position in degrees

Example

use lss_driver::LSSDriver;
async fn async_main(){
    let mut driver = LSSDriver::with_baud_rate("COM1", 115200).unwrap();
    driver.move_to_position(5, 180.0).await;
    driver.move_to_position(5, 480.0).await;
}

pub async fn query_position<'_>(
    &'_ mut self,
    id: u8
) -> Result<f32, Box<dyn Error>>
[src]

Query absolute current position in degrees

Supports virtual positions that are more than 360 degrees

Arguments

  • id - ID of servo you want to query

pub async fn query_target_position<'_>(
    &'_ mut self,
    id: u8
) -> Result<f32, Box<dyn Error>>
[src]

Query absolute target position in degrees

Supports virtual positions that are more than 360 degrees

Arguments

  • id - ID of servo you want to query

pub async fn set_rotation_speed<'_>(
    &'_ mut self,
    id: u8,
    speed: f32
) -> Result<(), Box<dyn Error>>
[src]

Set continuous rotation speed in °/s

Arguments

  • id - ID of servo you want to control
  • speed - Speed in °/s

pub async fn query_rotation_speed<'_>(
    &'_ mut self,
    id: u8
) -> Result<f32, Box<dyn Error>>
[src]

Query absolute rotation speed in °/s

Arguments

  • id - ID of servo you want to query

pub async fn query_status<'_>(
    &'_ mut self,
    id: u8
) -> Result<MotorStatus, Box<dyn Error>>
[src]

Query status of a motor

View more on wiki

Arguments

  • id - ID of servo you want to query

pub async fn query_safety_status<'_>(
    &'_ mut self,
    id: u8
) -> Result<SafeModeStatus, Box<dyn Error>>
[src]

Query safety status of a motor

View more on wiki

Arguments

  • id - ID of servo you want to query

pub async fn set_motion_profile<'_>(
    &'_ mut self,
    id: u8,
    motion_profile: bool
) -> Result<(), Box<dyn Error>>
[src]

Set motion profile enabled or disabled. If the motion profile is enabled, angular acceleration (AA) and angular deceleration(AD) will have an effect on the motion. Also, SD/S and T modifiers can be used.

With motion profile enabled servos will follow a motion curve With motion profile disabled servos move towards target location at full speed

Arguments

  • id - ID of servo you want to control
  • motion_profile - set motion profile on/off

pub async fn query_motion_profile<'_>(
    &'_ mut self,
    id: u8
) -> Result<bool, Box<dyn Error>>
[src]

query motion profile enabled or disabled. If the motion profile is enabled, angular acceleration (AA) and angular deceleration(AD) will have an effect on the motion. Also, SD/S and T modifiers can be used.

With motion profile enabled servos will follow a motion curve With motion profile disabled servos move towards target location at full speed

Arguments

  • id - ID of servo you want to query

pub async fn set_filter_position_count<'_>(
    &'_ mut self,
    id: u8,
    filter_position_count: u8
) -> Result<(), Box<dyn Error>>
[src]

Set filter position count

Change the Filter Position Count value for this session. Affects motion only when motion profile is disabled (EM0)

more info at the wiki

Arguments

  • id - ID of servo you want to control
  • filter_position_count - default if 5

pub async fn query_filter_position_count<'_>(
    &'_ mut self,
    id: u8
) -> Result<u8, Box<dyn Error>>
[src]

Query filter position count

Query the Filter Position Count value. Affects motion only when motion profile is disabled (EM0)

more info at the wiki

Arguments

  • id - ID of servo you want to query

pub async fn set_angular_stiffness<'_>(
    &'_ mut self,
    id: u8,
    angular_stiffness: i32
) -> Result<(), Box<dyn Error>>
[src]

Set angular stiffness

Read more about Angular stiffness

Arguments

  • id - ID of servo you want to control
  • angular_stiffness - value for angular stiffness (-10 to 10) (recommended -4 to 4)

pub async fn query_angular_stiffness<'_>(
    &'_ mut self,
    id: u8
) -> Result<i32, Box<dyn Error>>
[src]

Query angular stiffness

Read more about Angular stiffness

Arguments

  • id - ID of servo you want to query

pub async fn set_angular_holding_stiffness<'_>(
    &'_ mut self,
    id: u8,
    angular_holding: i32
) -> Result<(), Box<dyn Error>>
[src]

Set angular holding stiffness

Read more about Angular holding stiffness

Arguments

  • id - ID of servo you want to control
  • angular_holding - value for angular holding stiffness (-10 to 10)

pub async fn query_angular_holding_stiffness<'_>(
    &'_ mut self,
    id: u8
) -> Result<i32, Box<dyn Error>>
[src]

Query angular holding stiffness

Read more about Angular holding stiffness

Arguments

  • id - ID of servo you want to control

pub async fn set_angular_acceleration<'_>(
    &'_ mut self,
    id: u8,
    angular_acceleration: i32
) -> Result<(), Box<dyn Error>>
[src]

Set angular acceleration in degrees per second squared (°/s2)

Accepts values between 1 and 100. Increments of 10 Only used when motion profile is enabled

Read more on the wiki

Arguments

  • id - ID of servo you want to control
  • angular_acceleration - value for angular acceleration (1 to 100, Increments 10)

pub async fn query_angular_acceleration<'_>(
    &'_ mut self,
    id: u8
) -> Result<i32, Box<dyn Error>>
[src]

Query angular acceleration in degrees per second squared (°/s2)

Accepts values between 1 and 100. Increments of 10 Only used when motion profile is enabled

Read more on the wiki

Arguments

  • id - ID of servo you want to query

pub async fn set_angular_deceleration<'_>(
    &'_ mut self,
    id: u8,
    angular_deceleration: i32
) -> Result<(), Box<dyn Error>>
[src]

Set angular deceleration in degrees per second squared (°/s2)

Accepts values between 1 and 100. Increments of 10 Only used when motion profile is enabled

Read more on the wiki

Arguments

  • id - ID of servo you want to control
  • angular_deceleration - value for angular deceleration (1 to 100, Increments 10)

pub async fn query_angular_deceleration<'_>(
    &'_ mut self,
    id: u8
) -> Result<i32, Box<dyn Error>>
[src]

Query angular deceleration in degrees per second squared (°/s2)

Accepts values between 1 and 100. Increments of 10 Only used when motion profile is enabled

Read more on the wiki

Arguments

  • id - ID of servo you want to query

pub async fn limp<'_>(&'_ mut self, id: u8) -> Result<(), Box<dyn Error>>[src]

Disables power to motor allowing it to be back driven

Arguments

  • id - ID of servo you want to control

pub async fn halt_hold<'_>(&'_ mut self, id: u8) -> Result<(), Box<dyn Error>>[src]

Stops any ongoing motor motion and actively holds position

Arguments

  • id - ID of servo you want to control

pub async fn query_voltage<'_>(
    &'_ mut self,
    id: u8
) -> Result<f32, Box<dyn Error>>
[src]

Query voltage of motor in volts

Arguments

  • id - ID of servo you want to Query

pub async fn query_temperature<'_>(
    &'_ mut self,
    id: u8
) -> Result<f32, Box<dyn Error>>
[src]

Query temperature of motor in celsius

Arguments

  • id - ID of servo you want to Query

pub async fn query_current<'_>(
    &'_ mut self,
    id: u8
) -> Result<f32, Box<dyn Error>>
[src]

Query current of motor in Amps

Arguments

  • id - ID of servo you want to Query

pub async fn query_model<'_>(
    &'_ mut self,
    id: u8
) -> Result<Model, Box<dyn Error>>
[src]

Query model string

Arguments

  • id - ID of servo you want to query

pub async fn query_firmware_version<'_>(
    &'_ mut self,
    id: u8
) -> Result<String, Box<dyn Error>>
[src]

Query firmware version

Arguments

  • id - ID of servo you want to query

pub async fn query_serial_number<'_>(
    &'_ mut self,
    id: u8
) -> Result<String, Box<dyn Error>>
[src]

Query serial number

Arguments

  • id - ID of servo you want to query

pub async fn set_led_blinking<'_>(
    &'_ mut self,
    id: u8,
    blinking_mode: Vec<LedBlinking>
) -> Result<(), Box<dyn Error>>
[src]

Set LED blinking mode

Read more on the wiki

Arguments

  • id - ID of servo you want to control
  • blinking_mode - Blinking mode desired. Can be combination to make motor blink during multiple modes

Auto Trait Implementations

impl !RefUnwindSafe for LSSDriver

impl !Send for LSSDriver

impl !Sync for LSSDriver

impl Unpin for LSSDriver

impl !UnwindSafe for LSSDriver

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.