pub struct LSSDriver { /* private fields */ }
Expand description

Driver for the LSS servo

Implementations

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();

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();

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

Soft reset This command does a “soft reset” and reverts all commands to those stored in EEPROM

wiki

Arguments
  • id - ID of servo you want to reset

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();
}

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

set color for driver with id

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

configure color for motor with id (value will be saved)

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

Query color of servo LED

Arguments
  • id - ID of servo you want to query

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;
}

Move to absolute position in degrees with modifier

Supports virtual positions that are more than 360 degrees

Arguments
  • id - ID of servo you want to control
  • position - Absolute position in degrees
  • modifier - Modifier applied to this motion. Look at the type for more info.
Example
use lss_driver::LSSDriver;
use lss_driver::CommandModifier;
async fn async_main(){
    let mut driver = LSSDriver::with_baud_rate("COM1", 115200).unwrap();
    driver.move_to_position_with_modifier(5, 180.0, CommandModifier::Timed(2500)).await;
    driver.move_to_position_with_modifier(5, 480.0, CommandModifier::Timed(2500)).await;
}

Move to absolute position in degrees with multiple modifiers

Supports virtual positions that are more than 360 degrees Be careful about which modifiers are supported together

Arguments
  • id - ID of servo you want to control
  • position - Absolute position in degrees
  • modifiers - Array of modifiers applied to this motion. Look at the type for more info.
Example
use lss_driver::LSSDriver;
use lss_driver::CommandModifier;
async fn async_main(){
    let mut driver = LSSDriver::with_baud_rate("COM1", 115200).unwrap();
    driver.move_to_position_with_modifiers(5, 180.0, &[CommandModifier::Timed(2500), CommandModifier::CurrentHold(400)]).await;
}

Move to absolute position in degrees

Same as move_to_position

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.set_target_position(5, 180.0).await;
    driver.set_target_position(5, 480.0).await;
}

Query absolute current position in degrees

Supports virtual positions that are more than 360 degrees

Arguments
  • id - ID of servo you want to query

Query absolute target position in degrees

Supports virtual positions that are more than 360 degrees

Arguments
  • id - ID of servo you want to query

Set continuous rotation speed in °/s

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

Set continuous rotation speed in °/s with modifier

Arguments
  • id - ID of servo you want to control
  • speed - Speed in °/s
  • modifier - Modifier applied to this motion. Look at the type for more info.

Query absolute rotation speed in °/s

Arguments
  • id - ID of servo you want to query

Query status of a motor

View more on wiki

Arguments
  • id - ID of servo you want to query

Query safety status of a motor

View more on wiki

Arguments
  • id - ID of servo you want to query

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

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

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

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

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)

Query angular stiffness

Read more about Angular stiffness

Arguments
  • id - ID of servo you want to query

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)

Query angular holding stiffness

Read more about Angular holding stiffness

Arguments
  • id - ID of servo you want to control

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)

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

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)

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

Set maximum motor duty

Accepts values between 255 and 1023 Only used when motion profile is disabled

Read more on the wiki

Arguments
  • id - ID of servo you want to control
  • maximum_motor_duty - value for maximum motor duty (255 to 1023)

Query maximum motor duty

Accepts values between 255 and 1023 Only used when motion profile is disabled

Read more on the wiki

Arguments
  • id - ID of servo you want to query

Set maximum speed in degrees per second

Accepts values up to 180.0

Read more on the wiki

Arguments
  • id - ID of servo you want to control
  • maximum_speed - value for maximum speed

Query maximum speed in degrees per second

Accepts values up to 180.0

Read more on the wiki

Arguments
  • id - ID of servo you want to query

Disables power to motor allowing it to be back driven

Arguments
  • id - ID of servo you want to control

Stops any ongoing motor motion and actively holds position

Arguments
  • id - ID of servo you want to control

Query voltage of motor in volts

Arguments
  • id - ID of servo you want to Query

Query temperature of motor in celsius

Arguments
  • id - ID of servo you want to Query

Query current of motor in Amps

Arguments
  • id - ID of servo you want to Query

Query model string

Arguments
  • id - ID of servo you want to query

Query firmware version

Arguments
  • id - ID of servo you want to query

Query serial number

Arguments
  • id - ID of servo you want to query

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

Query origin offset in degrees

Read more on the wiki

Arguments
  • id - ID of servo you want to query
Example
use lss_driver::LSSDriver;

async fn async_main() {
    let mut driver = LSSDriver::with_baud_rate("COM1", 115200).unwrap();
    let origin_offset = driver.query_origin_offset(5).await;
}

Query the angular range in degrees

Read more on the wiki

Arguments
  • id - ID of the servo you want to query

/// # Example

use lss_driver::LSSDriver;

async fn async_main() {
    let mut driver = LSSDriver::with_baud_rate("COM1", 115200).unwrap();
    let angular_range = driver.query_angular_range(5).await.unwrap();
}

Set the angular range in degrees

Read more on the wiki

Arguments
  • id - ID of the servo you want to control
  • range - Angular range in degrees
Example
use lss_driver::LSSDriver;

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

Queries the position in µs.

When the position is inside the angular range it will return a value between 500 and 2500, when the position is outside the angular range it will return either -500 or -2500.

Read more on the wiki

Arguments
  • id - ID of the 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 pwm_position = driver.query_pwm_position(5).await.unwrap();
}

Set origin offset in degrees

Read more on the wiki

Arguments
  • id - ID of servo you want to control
  • origin_offset - Offset from factory 0 in degrees
Example
use lss_driver::LSSDriver;

async fn async_main() {
    let mut driver = LSSDriver::with_baud_rate("COM1", 115200).unwrap();
    driver.set_origin_offset(5, -1.3).await;
}

Move to PWM position in µs.

You can use set_angular_range to range.

Read more on the wiki

Arguments
  • id - ID of the servo you want to control
  • position - Position in µs in the range [500,2500]
Example
use lss_driver::LSSDriver;

async fn async_main() {
    let mut driver = LSSDriver::with_baud_rate("COM1", 115200).unwrap();
    driver.move_to_pwm_position(5, 2334).await;
}

Move to PWM position in µs with modifier.

You can use set_angular_range to range.

Read more on the wiki

Arguments
  • id - ID of the servo you want to control
  • position - Position in µs in the range [500,2500]
  • modifier - Modifier applied to this motion. Look at the type for more info.
Example
use lss_driver::{LSSDriver, CommandModifier};

async fn async_main() {
    let mut driver = LSSDriver::with_baud_rate("COM1", 115200).unwrap();
    driver.move_to_pwm_position_with_modifier(5, 2334, CommandModifier::Speed(750)).await;
}

Move to PWM position in µs with modifiers.

You can use set_angular_range to range.

Read more on the wiki

Arguments
  • id - ID of the servo you want to control
  • position - Position in µs in the range [500,2500]
  • modifiers - Array of modifiers applied to this motion. Look at the type for more info.
Example
use lss_driver::{LSSDriver, CommandModifier};

async fn async_main() {
    let mut driver = LSSDriver::with_baud_rate("COM1", 115200).unwrap();
    driver.move_to_pwm_position_with_modifiers(5, 2334, &[CommandModifier::Speed(750), CommandModifier::Timed(2500)]).await;
}

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more