Giter Club home page Giter Club logo

lss_driver's Introduction

Lynxmotion Smart Servo Driver

Crates.io Docs Rust Rust-windows codecov License

This crate provides an asynchronous serial driver the the Lynxmotion smart servos.

You can read more about the servos on the official robotshop wiki

Driver

The Smart servos are controlled over a serial UART protocol.

You can read about the protocol here It's highly recommended to at least skim the protocol page before trying to use this driver.

This driver currently doesn't implement all features from the protocol.
Some missing features are modifiers and setup commands.
If there are any missing commands or features you'd like added feel free to raise a PR or an issue.

This driver uses async/await. As a result you will need to use an async runtime. The driver is based on tokio-serial so tokio would be a good choice but any should work.

Usage

This crate comes with multiple examples.
These are a good start if you want to learn how to use it.

#[tokio::main]
async fn main() {
    // Create a driver on port `COM14` or `/dev/ttyUSB0`...
    let mut driver = lss_driver::LSSDriver::new("COM14").unwrap();
    // In case there is only one servo connected
    // we can query it's ID using the broadcast ID
    let id = driver.query_id(lss_driver::BROADCAST_ID).await.unwrap();
    // move motor with ID 5 to 90.0 degrees
    driver.move_to_position(5, 90.0).await.unwrap();
    // Set color of servo with ID 5 to Magenta
    driver.set_color(5, lss_driver::LedColor::Magenta).await.unwrap();
}

Building

This package shouldn't depend on any native libraries.
Rust serialport depends on pkg-config and libudev-dev on GNU Linux but they should be disabled for this crate.
If you do run into issues with them failing it may be worth looking into their dependencies and raising an issue here.

Changelog

Version 0.5.0 - (2020-01-13)

  • Windows support

Version 0.6.1 - (2021-09-28)

  • Tokio 1.0 support (Now also on windows!)

Disclaimer

This software is not officially endorsed by Lynxmotion or Robotshop!

All product names, logos, and brands are property of their respective owners. All company, product and service names used in this website are for identification purposes only. Use of these names, logos, and brands does not imply endorsement.

lss_driver's People

Contributors

dmweis avatar michielhegemans avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

michielhegemans

lss_driver's Issues

Multiple CommandModifiers do not seem to work

I only have a HT1 model to test on, so perhaps it works for the other models.

When I send a move_to_position_with_modifiers and I use Speed + CurrentHold, it seems it will only process the first modifier and not the second.

RUSTSEC-2021-0119: Out-of-bounds write in nix::unistd::getgrouplist

Out-of-bounds write in nix::unistd::getgrouplist

Details
Package nix
Version 0.16.1
URL nix-rust/nix#1541
Date 2021-09-27
Patched versions ^0.20.2,^0.21.2,^0.22.2,>=0.23.0
Unaffected versions <0.16.0

On certain platforms, if a user has more than 16 groups, the
nix::unistd::getgrouplist function will call the libc getgrouplist
function with a length parameter greater than the size of the buffer it
provides, resulting in an out-of-bounds write and memory corruption.

The libc getgrouplist function takes an in/out parameter ngroups
specifying the size of the group buffer. When the buffer is too small to
hold all of the reqested user's group memberships, some libc
implementations, including glibc and Solaris libc, will modify ngroups
to indicate the actual number of groups for the user, in addition to
returning an error. The version of nix::unistd::getgrouplist in nix
0.16.0 and up will resize the buffer to twice its size, but will not
read or modify the ngroups variable. Thus, if the user has more than
twice as many groups as the initial buffer size of 8, the next call to
getgrouplist will then write past the end of the buffer.

The issue would require editing /etc/groups to exploit, which is usually
only editable by the root user.

See advisory page for additional details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.