[−][src]Struct lss_driver::LSSDriver
Driver for the LSS servo
Implementations
impl LSSDriver
[src]
pub fn new(port: &str) -> Result<LSSDriver, LssDriverError>
[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, LssDriverError>
[src]
port: &str,
baud_rate: u32
) -> Result<LSSDriver, LssDriverError>
Create new driver on a serial port with custom baud rate
Arguments
post
- Port to use. e.g. COM1 or /dev/ttyACM0baud_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 + Send + Sync>) -> 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 reset(&mut self, id: u8) -> Result<(), LssDriverError>
[src]
Soft reset This command does a "soft reset" and reverts all commands to those stored in EEPROM
Arguments
id
- ID of servo you want to reset
pub async fn query_id(&mut self, id: u8) -> Result<u8, LssDriverError>
[src]
Query value of ID Especially useful with BROADCAST_ID
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<(), LssDriverError>
[src]
Set value of ID Saved to EEPROM Only takes effect after restart
Arguments
id
- ID of servo you want to controlnew_id
- ID You want that servo to have
pub async fn set_color(
&mut self,
id: u8,
color: LedColor
) -> Result<(), LssDriverError>
[src]
&mut self,
id: u8,
color: LedColor
) -> Result<(), LssDriverError>
pub async fn query_color(&mut self, id: u8) -> Result<LedColor, LssDriverError>
[src]
pub async fn move_to_position(
&mut self,
id: u8,
position: f32
) -> Result<(), LssDriverError>
[src]
&mut self,
id: u8,
position: f32
) -> Result<(), LssDriverError>
Move to absolute position in degrees
Supports virtual positions that are more than 360 degrees
Arguments
id
- ID of servo you want to controlposition
- 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 set_target_position(
&mut self,
id: u8,
position: f32
) -> Result<(), LssDriverError>
[src]
&mut self,
id: u8,
position: f32
) -> Result<(), LssDriverError>
Move to absolute position in degrees
Same as move_to_position
Arguments
id
- ID of servo you want to controlposition
- 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; }
pub async fn query_position(&mut self, id: u8) -> Result<f32, LssDriverError>
[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, LssDriverError>
[src]
&mut self,
id: u8
) -> Result<f32, LssDriverError>
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<(), LssDriverError>
[src]
&mut self,
id: u8,
speed: f32
) -> Result<(), LssDriverError>
Set continuous rotation speed in °/s
Arguments
id
- ID of servo you want to controlspeed
- Speed in °/s
pub async fn query_rotation_speed(
&mut self,
id: u8
) -> Result<f32, LssDriverError>
[src]
&mut self,
id: u8
) -> Result<f32, LssDriverError>
pub async fn query_status(
&mut self,
id: u8
) -> Result<MotorStatus, LssDriverError>
[src]
&mut self,
id: u8
) -> Result<MotorStatus, LssDriverError>
pub async fn query_safety_status(
&mut self,
id: u8
) -> Result<SafeModeStatus, LssDriverError>
[src]
&mut self,
id: u8
) -> Result<SafeModeStatus, LssDriverError>
pub async fn set_motion_profile(
&mut self,
id: u8,
motion_profile: bool
) -> Result<(), LssDriverError>
[src]
&mut self,
id: u8,
motion_profile: bool
) -> Result<(), LssDriverError>
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 controlmotion_profile
- set motion profile on/off
pub async fn query_motion_profile(
&mut self,
id: u8
) -> Result<bool, LssDriverError>
[src]
&mut self,
id: u8
) -> Result<bool, LssDriverError>
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<(), LssDriverError>
[src]
&mut self,
id: u8,
filter_position_count: u8
) -> Result<(), LssDriverError>
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 controlfilter_position_count
- default if 5
pub async fn query_filter_position_count(
&mut self,
id: u8
) -> Result<u8, LssDriverError>
[src]
&mut self,
id: u8
) -> Result<u8, LssDriverError>
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<(), LssDriverError>
[src]
&mut self,
id: u8,
angular_stiffness: i32
) -> Result<(), LssDriverError>
Set angular stiffness
Read more about Angular stiffness
Arguments
id
- ID of servo you want to controlangular_stiffness
- value for angular stiffness (-10 to 10) (recommended -4 to 4)
pub async fn query_angular_stiffness(
&mut self,
id: u8
) -> Result<i32, LssDriverError>
[src]
&mut self,
id: u8
) -> Result<i32, LssDriverError>
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<(), LssDriverError>
[src]
&mut self,
id: u8,
angular_holding: i32
) -> Result<(), LssDriverError>
Set angular holding stiffness
Read more about Angular holding stiffness
Arguments
id
- ID of servo you want to controlangular_holding
- value for angular holding stiffness (-10 to 10)
pub async fn query_angular_holding_stiffness(
&mut self,
id: u8
) -> Result<i32, LssDriverError>
[src]
&mut self,
id: u8
) -> Result<i32, LssDriverError>
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<(), LssDriverError>
[src]
&mut self,
id: u8,
angular_acceleration: i32
) -> Result<(), LssDriverError>
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 controlangular_acceleration
- value for angular acceleration (1 to 100, Increments 10)
pub async fn query_angular_acceleration(
&mut self,
id: u8
) -> Result<i32, LssDriverError>
[src]
&mut self,
id: u8
) -> Result<i32, LssDriverError>
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<(), LssDriverError>
[src]
&mut self,
id: u8,
angular_deceleration: i32
) -> Result<(), LssDriverError>
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 controlangular_deceleration
- value for angular deceleration (1 to 100, Increments 10)
pub async fn query_angular_deceleration(
&mut self,
id: u8
) -> Result<i32, LssDriverError>
[src]
&mut self,
id: u8
) -> Result<i32, LssDriverError>
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 set_maximum_motor_duty(
&mut self,
id: u8,
maximum_motor_duty: i32
) -> Result<(), LssDriverError>
[src]
&mut self,
id: u8,
maximum_motor_duty: i32
) -> Result<(), LssDriverError>
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 controlmaximum_motor_duty
- value for maximum motor duty (255 to 1023)
pub async fn query_maximum_motor_duty(
&mut self,
id: u8
) -> Result<i32, LssDriverError>
[src]
&mut self,
id: u8
) -> Result<i32, LssDriverError>
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
pub async fn set_maximum_speed(
&mut self,
id: u8,
maximum_speed: f32
) -> Result<(), LssDriverError>
[src]
&mut self,
id: u8,
maximum_speed: f32
) -> Result<(), LssDriverError>
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 controlmaximum_speed
- value for maximum speed
pub async fn query_maximum_speed(
&mut self,
id: u8
) -> Result<f32, LssDriverError>
[src]
&mut self,
id: u8
) -> Result<f32, LssDriverError>
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
pub async fn limp(&mut self, id: u8) -> Result<(), LssDriverError>
[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<(), LssDriverError>
[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, LssDriverError>
[src]
pub async fn query_temperature(&mut self, id: u8) -> Result<f32, LssDriverError>
[src]
pub async fn query_current(&mut self, id: u8) -> Result<f32, LssDriverError>
[src]
pub async fn query_model(&mut self, id: u8) -> Result<Model, LssDriverError>
[src]
pub async fn query_firmware_version(
&mut self,
id: u8
) -> Result<String, LssDriverError>
[src]
&mut self,
id: u8
) -> Result<String, LssDriverError>
pub async fn query_serial_number(
&mut self,
id: u8
) -> Result<String, LssDriverError>
[src]
&mut self,
id: u8
) -> Result<String, LssDriverError>
pub async fn set_led_blinking(
&mut self,
id: u8,
blinking_mode: Vec<LedBlinking>
) -> Result<(), LssDriverError>
[src]
&mut self,
id: u8,
blinking_mode: Vec<LedBlinking>
) -> Result<(), LssDriverError>
Auto Trait Implementations
impl !RefUnwindSafe for LSSDriver
[src]
impl Send for LSSDriver
[src]
impl Sync for LSSDriver
[src]
impl Unpin for LSSDriver
[src]
impl !UnwindSafe for LSSDriver
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,