Dynamixel
is a simple and easy way to deal with the Dynamixel XL430 Servo. It's fast and based on the DynamixelSDK
.
- fast and easy to understand
- support for group writes
- most of the common features implemented (WIP)
-
NOTE: DynamixelSDK is required!
get it from here and install it to/usr/local/include
: DynamixelSDK
# create cmake file
cmake CMakeLists.txt
# install to /usr/local/include
sudo make install
// include the .cpp files from the project
#include "dynamixel_xl.cpp"
// create instance of the dynamixel
Dynamixel dynamixel = Dynamixel();
if(!dynamixel.set_open()) {
printf("failed: could not open port, please check connection!");
}
#define DXL_ID 1
// enable LED
dynamixel.set_led(DXL_ID, true);
// set the operating mode to velocity
dynamixel.set_operating_mode(DXL_ID, ADDR_CONTROL_MODE_VELOCITY);
// enable torque for the dynamixel
dynamixel.set_torque(DXL_ID, true);
// set maximum speed
dynamixel.set_goal_velocity(DXL_ID, 265);
// let it rotate for two seconds
sleep(2.0);
// disable rotation
dynamixel.set_goal_velocity(DXL_ID, 0);
// disable torque
dynamixel.set_torque(DXL_ID, false);
// close connection
dynamixel.set_close();
👨🏼💻 Vinzenz Weist