The Dynamixel class

What is the Dynamixel class? What does it do?

What is the Dynamixel class?

The Dynamixel class is a Python class that abstracts the DynamixelSDK into a modular, control-table based class supporting value reading, writing and both protocols with one U2D2.

Every Dynamixel has a control table, which is a list of addresses that correspond to pieces of information relating to the servo. To find the control table for a specific Dynamixel, visit the Robotis e-Manual site and select your servo.

The way it works is by using an individual CSV for each servo that is based upon the relevant e-Manual control table documentation, allowing systems to be based on the Data Name of something, rather than the hard-coded address for that on a particular type of servo.

What this means is that, for example, you want to set the Counter Clockwise Angle Limit on an MX-28, the old code would require the following lines to access Address 8:

dxl_comm_result, dxl_error = packetHandler.write2ByteTxRx(portHandler, ID, 8, 4095)
dxlErrors(dxl_comm_result, dxl_error)

Which, as you can see, means having to modify the code every time a new servo is implemented. With the new code, the addresses are mapped out on a per-servo basis, allowing for modularity in the code. Instead of specifying the address, packet handler and packet size, a servo that has already been initialised as dynamixel can be accessed with this much neater code:

dynamixel.write_value('CCW Angle Limit')

Of course, the example of the new server is much easier to understand, allows for more modularity and produces cleaner code. A new servo simply requires a new CSV, generated by the client and sent through TCP. The CSV generated for an XL-320 servo (which is documented here) would be:

As you can see, every single option is part of this file, and stored in the Dynamixel object for use by local and external functions.

Last updated