A Library to control ROBOTIS Dynamixel smart servo actuators using the OpenCM9.04 microcontroller
Download Repository: ZIP Archive
Based on Dynamixel.cpp
and Dynamixel.h
from version 1.0.2 the ROBOTIS_OpenCM IDE.
Features and benefits vs. the default library
- Higher baud rates (up to 3 Mbps for MX series) available directly.
- Added efficient overloaded array versions of functions to read and write across multiple registers.
- Emulated SYNC_READ-based functions.
- Improved SYNC_WRITE-based functions.
#define
for baud rates and Dynamixel addresses.- Added functions that automatically check if register addresses are bytes, words, or invalid.
- Functions redesigned to use strict byte and word input arguments to catch errors at compile time.
- Added fast, flexible
printf
-style functions to replaceSerialUSB.print
. - Added easy-to-use timer-based asynchronous blink, fade, and button functions for the status LED and user switch on the OpenCM9.04 board.
- Cleaned up code to improve readability and use consistent style: removed code for boards other than OpenCM9.04 and actuators other than AX and MX series, Removed debug code and code related to 2.0 protocol.
- Fixed a checksum bug.
- Many other optimizations and improvements.
Current limitations
- Only MX-64, AX-12, and AX-18 actuators have been specifically tested.
- More documentation and commenting needed.
- More and better examples needed.
- Note that only the OpenCM9.04-A and B microcontroller versions are supported. The OpenCM9.04-C version not only has different connectors (for XL-320 actuators), but it also appears to use different firmware.
Installation
- Quit the ROBOTIS_OpenCM IDE application.
- Download and expand the ZIP archive of the DynamixelQ repository. In the resultant DynamixelQ-master folder there are two libraries: DynamixelQ and USBprint.
- Locate the libraries folder for the ROBOTIS_OpenCM IDE and place the DynamixelQ and USBprint library folders there. On OS X, this folder is in Documents/ROBOTIS/. On Windows, it is located at *Documents\ROBOTIS* (or possibly *My Documents\ROBOTIS*).
- Relaunch the ROBOTIS_OpenCM IDE. "DynamixelQ" should now appear under File > Examples and Sketch > Import Library....
Minor edits and bug reports and fixes can be submitted by filing an issue or via email. To add new functionality or make propose major changes, please fork the repository. Any new features should be accompanied by some means of testing. Email or file an issue if you have any questions.
How to read from and write to Dynamixels at high speed using the OpenCM9.04
- Increase baud rate between microcontroller and servos (though this can be done in software, it's much safer using the Windows-only Dynamixel Wizard that is part of RoboPlus).
- Update the firmware of all of your actuators to make sure that it is current and consistent.
- Decrease the return delay time.
- Minimize read and write operations by reading and writing across multiple registers and using the SYNC_WRITE-based functions.
- Remove unnecessary overhead from code.
How to write from the OpenCM9.04 to PC via USB at high speed
- Minimize number of individual USB serial write operations.
- Use the fast
printf
-style functions included with DynamixelQ. - Increase baud rate between microcontroller and computer.
- Reduce the USB latency time (Windows).
- Send encoded (compressed) data and decompress later on PC.
Andrew D. Horchler, horchler @ gmail . com, biorobots.case.edu
Created: 8-13-14, Revision: 1.2, 2-25-16
Acknowledgment of support: This material is based upon work supported by the National Science Foundation under Grant No. 1065489. Disclaimer: Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.
Copyright © 2014–2017, Andrew D. Horchler
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Case Western Reserve University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANDREW D. HORCHLER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.