Table of Contents

Controlling the Seed Robotics Hand using the Dynamixel Protocol

All Seed Robotics products can be controlled using the Seed Robotics STP Protocol and they also have full support for the Dynamixel Protocol (versions 1 and 2), developed by Robotis.

This means Seed Robotics hands can be connected directly to any existing Dynamixel system.

If you are not using a Dynamixel system, using the Dynamixel protocol still brings a large number of advantages: it is a mature protocol, it has wide support and adoption (for example in ROS where you can find several libraries and code sample available) and it is based on Serial (UART) communication which makes compatible with virtually any host either PC or embedded MCU.

Introducing the Dynamixel Protocol

The protocol follows a strict set of principles to regulate communication on the bus:

The description of the Control Table memory positions is available for each device:

Seed Robotics designed the Control tables to resemble those of an Robotis MX series servo; this enables compatibility with Robotis products as well as a large code base built for Dynamixel devices.

Other Protocol features to ensure reliability

WRITING to a device

As an example, in pseudo code, to move an Actuator with ID 2 to position 256, you would send to the bus:

WRITE ID=2, MEMORY POSITION 24, VALUE=1

WRITE ID=2, MEMORY POSITION 30, VALUE=256

Explanation:
First we write to memory position 24, which is the Memory Position to turn TORQUE ON. (you only need to turn Torque ON once; after that it will stay ON until you write the position to 0, to disable or power down the device)
Next we write to the memory position 30, which is the Memory Position for GOAL POSITION.
For information about which memory positions to use, please see the Control Tables, listed above.

After each WRITE, and assuming Status Return Level is configured to 2, the slave replies with a Status packet. This status packet includes valuable information such as the Error bitmask that reports any errors on the servo.

To build an actual WRITE command you need to follow the Dynamixel protocol syntax. Depending on your protocol version:

Please note: by default, Seed Robotics products come preconfigured to operate on the Dynamixel 1 protocol, which is the most widely used at present.

READING from a device

For example, in pseudo code, to read the current Temperature of an Actuator with ID 7, you would send to the bus:

READ ID=7, MEMORY POSITION 43, LENGTH=1

Explanation:
Memory Position 43 corresponds to the Present Temperature in the Control Table. It is represented by only 1 byte.
For information about which memory positions to use, please see the Control Tables, listed above.

You would have noticed that READ has the ability to read a sequence of bytes from the Control table: you specify the start address on the Control Table and length of data to read. This is especially efficient when you need to query multiple status variables at once.

When the slave receives the command it will return a Status packet that will include the Requested Information and a Status byte with the error bitmask.

To build an actual READ command you need to follow the Dynamixel protocol syntax. Depending on your protocol version:

Please note: by default, Seed Robotics products come preconfigured to operate on the Dynamixel 1 protocol, which is the most widely used at present.

The Status (Return) Packet

A return packet is normally always sent by the slave to acknowledge the receipt of a command (WRITE) or to return the information requested by a READ. You may change this behavior if you modify the setting of Status Return Level (memory position 16).

By default this is set to 2, which means “Always Return”. Setting it to 1 will send a return packet for READ commands only and setting it to 0 will never Return any data (not even for Read).

The Return packet is composed of the Slave ID, the read data (if applicable), the error bitmask and the checksum.

The error bitmask is especially useful as it can report failures such as overheating, overload or invalid parameters sent in a command.

For more information on the Status (Return) Packet, depending on your protocol version:

Please note: by default, Seed Robotics products come preconfigured to operate on the Dynamixel 1 protocol, which is the most widely used at present.

The timeout

As far as we know, the protocol specification does not specify a maximum time between sending a command and receiving a reply. However one can deduce proper timeout values considering the following:

While we can't immediately draw a conclusion from this data, real world experience shows the following:

Our recommendation, based on our measurements and experience, is to use 5 milliseconds if you're performing short READs and writes (reading/writing up 10 sequential memory positions) or bring it up to 10ms if you are doing longer READs/WRITEs. If you experience communication issues, you can try increasing the timeout even more.
Typically if after 10~20ms you did not get a reply, you should re-send the command as there was likely some communication issue (data corruption for example).
Increasing the timeout over 100 milliseconds, which is already a pretty high timeout value, you'd be operating outside the Robotis own maximum timeout recommendation for Dynamixel communications.

Note: it is important to clarify the “timeout” concept depicted in this section: “timeout” is the time that is counted between sending the last byte of a command and receiving the first byte of a reply.
Because the protocol can operate at different baud rates, timeout should always be counted as above and never be counted as the time it takes between sending the last byte of the command and receiving the last byte of a reply. This would be wrong and would produce inconsistent results operating at different baud rates.

Furthermore, for BULK_* commands, where the units will reply in sequence, they will take up to 5ms for each device to send the reply. Therefore, if you are doing a BULK_* query on 5 devices, for example, it may take a maximum of 5 devices * 5ms = 25ms to get the replies for all the servos queried.

Other Dynamixel features and commands

To improve bus efficiency and for added functionality, the Dynamixel Protocol offers enhanced forms of the READ and WRITE commands

For more information, depending on your protocol version:

Conclusion

If you search the web you will find numerous tutorials, samples and libraries to use the Dynamixel Protocol. This document intends to be a high level presentation of the protocol and how it works.

Once you've grasped the high level concepts, it should be pretty straightforward to start building your own commands.

You can also opt to use a library or framework which takes care of all the low level details.