Crate drs_0x01

Source
Expand description

This crate provides basic functionnality to communicate with Herkulex DRS (both 0101 and 0201, other model are not supported even if they might partially work) servomotors. It is heavily based on the documentation published by Dongbu Robot which is available here.

§Examples

To set a servo to a position, you can use this message :

use drs_0x01::*;

let servo = Servo::new(0x40);
let message = servo.set_speed(512, Rotation::Clockwise);

To reboot all the servomotors you can use this message :

use drs_0x01::builder::MessageBuilder;
// 0xFE is the broadcast ID
let message = MessageBuilder::new().id(0xFE).reboot().build();

Here is how to enable torque for the servomotor labelled 35 :

use drs_0x01::builder::MessageBuilder;
use drs_0x01::WritableRamAddr::TorqueControl;
let message = MessageBuilder::new_with_id(35).write_ram(TorqueControl(1)).build();

Re-exports§

Modules§

  • All the servomotor addresses mapped to some enums.
  • A module which implement the builder pattern to create advanced messages
  • A module which contains a Finite State Machine to transform bytes read form the servomotor into [ACKPacket]s

Structs§

  • This struct allows you to build messages for a servomotor.

Enums§

  • The color of the LED of the servomotor.
  • This represent the servomotor control mode. The servomotor is either controlled in Position or Speed.
  • This represent the rotation sense of the servomotor while controlled in Speed.