Quick Start for Dynamixel Pro v1.00b
Page
125
/
139
// int GoalPos = 151875; // for 42-series
int
GoalVel = -3000l
int
GoalTorque = 120;
int
result = COMM_TXFAIL;
int
error = 0;
int
val1, val2, val3;
…
// open device and set baud rate here
if
( DXL.Connect() == 0 )
…
// Torque Enable is off by default
// The following line is not necessary but it ensures
// Torque Enable is off regardless
DXL.WriteByte
(
1, TORQUE_ENABLE, 0, 0
);
…
While(1); {
switch(
_getch()
) {
// use simply switch loop to change between modes
case
0x1b:
// ESC key to set to default settings
DXL.WriteByte(1, TORQUE_ENABLE, 0, 0);
usleep(CONTROL_PERIOD*100);
DXL.WriteByte(1, OPERATING_MODE, 3, 0);
break; }
case
0x30:
// “0” key to set in Torque Mode
DXL.WriteByte(1, OPERATING_MODE, 0, 0);
usleep(CONTROL_PERIOD*100);
DXL.WriteByte(1, TORQUE_ENABLE, 1, 0);
usleep(CONTROL_PERIOD*100);
// Goal Torque (604) size is 2 bytes (a word)
/
// WriteWord is the appropriate function
DXL.WriteWord(1, GOAL_TORQUE, GoalTorque, &error);
usleep(CONTROL_PERIOD*200);
// after an arbitrary period (i.e. 2 secs in this case)
// output onscreen
// Present Current (621) size is 2 bytes (a word)
// ReadWord is the appropriate function
result = DXL.ReadWord(1, PRESENT_CURRENT, &val1, &error);
if(
result == COMM_RXSUCCESS
)
printf( "%d\n", val1);
break; }
case
0x31:
// “1” key to set in Wheel Mode
DXL.WriteByte(1, OPERATING_MODE, 1, 0);
usleep(CONTROL_PERIOD*100);
DXL.WriteByte(1, TORQUE_ENABLE, 1, 0);
usleep(CONTROL_PERIOD*100);
// Goal Velocity (600) size is 4 bytes (a double-word)
// WriteDWord is the appropriate function
DXL.WriteDWord(1, GOAL_VELOCITY, GoalVel, &error);
usleep(CONTROL_PERIOD*200);
// after an arbitrary period (i.e. 2 secs in this case)
// output onscreen
Summary of Contents for Dynamixel Pro
Page 1: ...Quick Start for Dynamixel Pro ...
Page 8: ...Quick Start for Dynamixel Pro v1 00b Page 8 139 ...
Page 33: ...Quick Start for Dynamixel Pro v1 00b Page 33 139 Check Dynamixel PRO firmware update results ...
Page 37: ...Quick Start for Dynamixel Pro v1 00b Page 37 139 Dynamixel PRO firmware recovery is complete ...
Page 66: ...Quick Start for Dynamixel Pro v1 00b Page 66 139 The present temperature is constantly read ...
Page 133: ...Quick Start for Dynamixel Pro v1 00b Page 133 139 2 3 2 42 series H42 L42 ...
Page 136: ...Quick Start for Dynamixel Pro v1 00b Page 136 139 ...
Page 138: ...Quick Start for Dynamixel Pro v1 00b Page 138 139 iii L42 10 S300 R ...
Page 139: ...Quick Start for Dynamixel Pro v1 00b Page 139 139 2 5 Model notation ...