Robotis Dynamixel Pro Quick Start Manual page 127

Table of Contents

Advertisement

Quick Start for Dynamixel Pro v1.00b
...
using namespace
DXL_PRO;
Dynamixel DXL("/dev/ttyUSB0");
int
main()
{
int
GoalPos, i;
int
id[NUM_ACTUATOR];
int
phase[NUM_ACTUATOR];
...
// open device and set baud rate here
if( DXL.Connect() == 0 )
...
DXL.WriteByte(1, TORQUE_ENABLE, 1,
// do the same for other IDs
...
do {
for
(i= 0; I < NUM_ACTUATOR;
GoalPos =
// packet preparation set below.
// ID requires 1 byte
// Goal Position requires 4 bytes
// in this case different Goal Position values for different ID
param[i*(1+4)+0] = (unsigned char)id[i];
param[i*(1+4)+1] = DXL_LOBYTE(DXL_LOWORD(GoalPos));
param[i*(1+4)+2] = DXL_HIBYTE(DXL_LOWORD(GoalPos));
param[i*(1+4)+3] = DXL_LOBYTE(DXL_HIWORD(GoalPos));
param[i*(1+4)+4] = DXL_HIBYTE(DXL_HIWORD(GoalPos));
}
// 4 is for size of Goal Position, NUM_ACTUATOR is for size of array
result = DXL.SyncWrite(P_GOAL_POSITION_LL, 4, param, NUM_ACTUATOR*(1+4));
...
while
(theta < 2*PI);
// must close USB-to-Dynamixel before ending
DXL.Disconnect();
return
0;
}
iv. BulkRead
-
Like SyncWrite BulkRead allows reading multiple addresses of multiple
Dynamixel PROs simultaneously
/dxl_sdk-20/example/BulkRead/main.cpp (partly shown)
...
using namespace
DXL_PRO;
Dynamixel DXL("/dev/ttyUSB0");
int
main()
// must declare location of USB-to-Dynamixel
i++) {
(int)((sin(theta+phase[i]))(double)AmPos);
// must declare location of USB-to-Dynamixel
0);
// for ID 1
Page 127 / 139

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Dynamixel Pro and is the answer not in the manual?

Table of Contents