Quick Start for Dynamixel Pro v1.00b
ix. Read the Present Position of Dynamixel PRO
-
Present Position indicates the present position of Dynamixel PRO Its address is
611 and is assigned 4 bytes of memory.
-
Therefore, implement dxl_read_dword function present position of
Dynamixel PRO.
-
The program's entire source is shown below.
main.cpp
#include
<stdio.h>
#include
<conio.h>
#include
"dynamixel.h"
#define
COM_PORT_NUM
#define
BAUD_RATE_NUM
#define
P_PRESENT_POSITION
#define
ID
// Print error bit of status packet
void PrintErrorCode(int
{
if(ErrorCode & ERRBIT_VOLTAGE)
printf("Input voltage
if(ErrorCode & ERRBIT_ANGLE)
printf("Angle limit
if(ErrorCode & ERRBIT_OVERHEAT)
printf("Overheat
if(ErrorCode & ERRBIT_RANGE)
printf("Out of range
if(ErrorCode & ERRBIT_CHECKSUM)
printf("Checksum
if(ErrorCode & ERRBIT_OVERLOAD)
printf("Overload
if(ErrorCode & ERRBIT_INSTRUCTION)
printf("Instruction code
}
int
main(void)
{
SerialPort sp = {0,0,0,0,0};
SerialPort *Port = &sp;
//Open the port of USB2DXL
if(dxl_initialize(Port, COM_PORT_NUM, BAUD_RATE_NUM) == COMM_RXSUCCESS )
17
3
611
1
ErrorCode)
error!\n");
error!\n");
error!\n");
error!\n");
error!\n");
error!\n");
error!\n");
//Comport Number of USB2DXL
//Baudrate Number of Dynamixel PRO
//Address of Present Position in Contorl Table
//ID of Dynamixel PRO you use
Page 67 / 139
Need help?
Do you have a question about the Dynamixel Pro and is the answer not in the manual?
Questions and answers