1 #include <DynamixelWorkbench.h> 4 #if defined(__OPENCM904__) 5 #define DEVICE_NAME "3" //Dynamixel on Serial3(USART3) <-OpenCM 485EXP 6 #elif defined(__OPENCR__) 38 uint16_t model_number = 0;
40 bool initSuccess =
false;
41 bool pingSuccess =
false;
43 result = dxl_wb.init(DEVICE_NAME, BAUDRATE, &log);
56 result = dxl_wb.ping(
id, &model_number, &log);
71 dxl_wb.setNormalDirection(
id);
73 if(initSuccess && pingSuccess)
93 result = dxl_wb.setExtendedPositionControlMode(
id ,&log);
95 dxl_wb.writeRegister(
id,
"Profile_Acceleration",10,&log);
97 dxl_wb.writeRegister(
id,
"Profile_Velocity",150,&log);
119 dxl_wb.goalPosition(
id, (int32_t)goalPos);
129 dxl_wb.getPresentPositionData(
id, &data);
137 dxl_wb.torque(
id, onoff);
DynamixelWorkbench dxl_wb
bool init()
Initialize Dynamixel servo motor and verify that it is reachable.
Dynamixel(int idNumber, float ratio=1)
void moveMotor(int32_t pos)
Set the goal position of the dynamixel.
bool setOperatingMode()
Set the dynamixel in joint mode.
float gearRatio
Gear ratio for the motor's joint.
int32_t getPosition()
Get the current position of the Dynamixel.