Quick Start for Dynamixel Pro v1.00b
// Present Velocity (615) size is 4 bytes (a double-word)
// ReadDWord is the appropriate function
result = DXL.ReadDWord(1, PRESENT_VELOCITY, &val2, &error);
if(result ==
break; }
defaultt:
// every other key and Dynamixel PRO remains in Joint Mode
DXL.WriteByte(1, OPERATING_MODE, 3, 0);
usleep(CONTROL_PERIOD*100);
DXL.WriteByte(1, TORQUE_ENABLE, 1, 0);
usleep(CONTROL_PERIOD*100);
// Goal Position (596) size is 4 bytes (a double-word)
// WriteDWord is the appropriate function
DXL.WriteDWord(1, GOAL_POSITION, GoalPos, &error);
usleep(CONTROL_PERIOD*200);
// after an arbitrary period (i.e. 2 secs in this case)
// output onscreen
// Present Position (611) size is 4 bytes (a double-word)
// ReadDWord is the appropriate function
result = DXL.ReadDWord(1, PRESENT_POSITION, &val3, &error);
if(result ==
break; }
}
...
// must close USB-to-Dynamixel before ending
DXL.Disconnect();
return
0;
}
iii. SyncWrite
-
While the abovementioned read and write commands are simple to implement the
amount of code lines necessary for multiple addresses on multiple Dynamixel
PROs can be rather staggering.
-
SynchWrite simplifies commands by setting, preparing and then transmitting data
packets.
-
SyncWrite allows one single commands to address multiple values for multiple
Dynamixel PROs at a given address.
The following example illustrates a single SyncWrite command to set different Goal Positions to more than 1 Dynamixel PRO
/dxl_sdk-20/example/SyncWrite/main.cpp (partly shown)
...
// declare the following in preprocessor for illustrative purposes
#define OPERATING_MODE
#define TORQUE_ENABLE
#define GOAL_POSITION
#define GOAL_TORQUE
COMM_RXSUCCESS)
printf( "%d\n", val2);
COMM_RXSUCCESS)
printf( "%d\n", val3);
11
562
596
604
Page 126 / 139
Need help?
Do you have a question about the Dynamixel Pro and is the answer not in the manual?
Questions and answers