drs_0x01/
lib.rs

1//! This crate provides basic functionnality to communicate with Herkulex DRS (both 0101 and
2//! 0201, other model are not supported even if they might partially work) servomotors.
3//! It is heavily based on the documentation published by Dongbu Robot which is available
4//! [`here`](http://www.sgbotic.com/products/datasheets/robotics/herkulexeng.pdf).
5//!
6//! # Examples
7//!
8//! To set a servo to a position, you can use this message :
9//!
10//! ```
11//! # extern crate drs_0x01;
12//! use drs_0x01::*;
13//!
14//! let servo = Servo::new(0x40);
15//! let message = servo.set_speed(512, Rotation::Clockwise);
16//! ```
17//!
18//! To reboot all the servomotors you can use this message :
19//!
20//! ```
21//! # extern crate drs_0x01;
22//! use drs_0x01::builder::MessageBuilder;
23//! // 0xFE is the broadcast ID
24//! let message = MessageBuilder::new().id(0xFE).reboot().build();
25//! ```
26//!
27//! Here is how to enable torque for the servomotor labelled 35 :
28//!
29//! ```
30//! # extern crate drs_0x01;
31//! use drs_0x01::builder::MessageBuilder;
32//! use drs_0x01::WritableRamAddr::TorqueControl;
33//! let message = MessageBuilder::new_with_id(35).write_ram(TorqueControl(1)).build();
34//! ```
35
36#![no_std]
37#![warn(missing_docs)]
38
39#[cfg(test)]
40#[macro_use]
41extern crate std;
42
43extern crate arrayvec;
44extern crate try_from;
45
46pub mod addr;
47/// A module which implement the builder pattern to create advanced messages
48pub mod builder;
49mod message;
50/// A module which contains a Finite State Machine to transform bytes read form the servomotor
51/// into `[ACKPacket]s`
52pub mod reader;
53mod servo;
54
55pub use addr::{ReadableEEPAddr, ReadableRamAddr, WritableEEPAddr, WritableRamAddr};
56pub use message::{JogColor, JogMode, Rotation};
57pub use servo::Servo;