saberrs

Crates.iosaberrs
lib.rssaberrs
version0.3.1
sourcesrc
created_at2019-08-27 14:29:13.904075
updated_at2020-08-15 14:12:43.390481
descriptionA library for interfacing with Dimension Engineering's Sabertooth motor drivers.
homepage
repositoryhttps://github.com/fparat/saberrs
max_upload_size
id160075
size97,544
(fparat)

documentation

README

saberrs

crates.io version badge Documentation License CI

saberrs is a library for interfacing with Dimension Engineering Sabertooth motor driver.

Currently only the Sabertooth 2x32 is supported.

Full documentation: https://docs.rs/saberrs

Simple usage

In Cargo.toml:

[dependencies]
saberrs = "0.3"

In application code:

use saberrs::sabertooth2x32::{Sabertooth2x32, PacketSerial};

// Create a handle. This will use "PacketSerial" protocol.
let mut saber = PacketSerial::new("/dev/ttyS0")?;

// Go forward at half-speed (50.0%)
saber.set_drive(0.5)?;
saber.set_turn(0.0)?;

// Request the battery voltage from motor 1.
let vbat : f32 = saber.get_voltage(1)?;

// Stop the motors
saber.stop_motors()?;

Other protocol variants can be used:

use saberrs::sabertooth2x32::{Sabertooth2x32, PacketSerial, PacketType, PlainText};

// "PacketSerial" with specified address and frame protection type (checksum or crc).
let mut saber = PacketSerial::new("/dev/ttyS0")?
    .with_packet_type(PacketType::Checksum)
    .with_address(129);

// "PlainText" protocol
let mut sabertext = PlainText::new("/dev/ttyS1")?;

Features and dependencies

Features:

  • serialport, enabled by default, for providing default serial IO handlers.

Dependencies:

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Disclaimer

This library is not affiliated or associated in any way with Dimension Engineering.

All product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.

Commit count: 26

cargo fmt