Robotis Dynamixel Pro Quick Start Manual page 122

Table of Contents

Advertisement

Quick Start for Dynamixel Pro v1.00b
#define DEFAULT_BAUDNUM
#define DEFAULT_ID
...
using namespace
DXL_PRO;
Dynamixel DXL("/dev/ttyUSB0");
int
main()
{
int
result, error = 0, index = 0, PresentPos = 0, On;
commands
int
GoalPos[2] = (-150000, 150000);
...
// open device
if( DXL.Connect() == 0 )
{
printf(
"Failed to open USB2Dynamixel!\n"
return
0;
}
else
printf(
"Succeed to open USB2Dynamixel!\n"
// Now verify baudrate USB-to-Dynamixel
if(DXL.SetBaudrate(DEFAULT_BAUDNUM) ==
{
printf( "Succeed to set USB2DXL baudrate to 57600 bps!\n" );
}
else
{
printf( "Failed to set USB2DXL baudrate to 57600 bps!\n" );
printf( "Press any key to end ...\n" );
_getch();
return
0;
}
printf( "Turning Torque Enable on for ID 1\n" );
// This step is essential. After Torque Enable is on RAM area addresses can be changed.
DXL.WriteByte(DEFAULT_ID, P_TORQUE_ENABLE, 1,
...
While(1);
...
DXL.WriteDWord(DEFAULT_ID, P_ GOAL_POSITION_LL, GoalPos[index], &error);
do
{
...
result = DXL.ReadDWord(DEFAULT_ID, P_ PRESENT_POSITION_LL, &PresentPos,
&error);
if
(result ==
COMM_RXSUCCESS)
printf( " %d %d\n", GoalPos[index], PresentPos);
...
// must close USB-to-Dynamixel before ending
DXL.Disconnect();
return
0;
1
1
// must declare location of USB-to-Dynamixel
// declare arbitrary variables for read
);
);
true)
&error);
Page 122 / 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?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents