Quick Start for Dynamixel Pro v1.00b
vi. Modifying the P gain value of Dynamixel PRO
-
Let's control the P gain value of Dynamixel PRO's position.
-
Dynamixel PRO implements PID control to maniputate its motor; therefore, the
movement changes cooresponding to the gain values.
-
On Dynamixel PRO's Control Table, the Position_P_Gain address is set as 594
and it utilizes 2 bytes (1 word) of memory.
-
Thus, dxl_write_word function, which modifies 2 bytes of memory, changes
the P gain value.
-
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_TORQUE_ENABLE
#define
P_POSITION_P_GAIN
#define
P_GOAL_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)
17
3
562
594
596
1
//ID of Dynamixel PRO you use
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 Torque Enable in Control Table
//Address of Position P Gain in Contorl Table
//Address of Goal Position in Contorl Table
Page 56 / 139
Need help?
Do you have a question about the Dynamixel Pro and is the answer not in the manual?
Questions and answers