POST No. 2407922
Defined variables in the read_write.c example of DynamixelSDK
2020-07-27 06:07:31 robotiscustomer

Hi, I am back.

I am learning how to use the SDK to control dynamixels. In the given example file stored in DynamixelSDK/c/example/protocol2.0/read_write, the defined variables were set for the PRO 54-200 dynamixel. I checked its eManual and compared the values. 


According to the 2.2 Control Table of EEPROM Area, the value for DXL_MINIMUM_POSITION_VALUE, DL_MAXIMUM_POSITION_VALUE and DXL_MOVING_STATUS_THRESHOLD are -250961, 250961 and 50 respectively. How come in the sample program, they were set to -150000, 150000 and 20. Can you let me know how these values were obtained? 

Thank you

2020-07-27 06:07:31
2020-07-27 17:36:18 Will Son


Thank you for your inquiry.

In the example code, the minimum and maximum position values can be used for Extended Position control mode that supports multi turn, and usual Position Control mode, only Min / Max Position Limit set in the Control Table are effective (otherwise, you'll get a range error).

DXL_MOVING_STATUS_THRESHOLD is a reference value to see whether present position is getting close to the goal position, then switch the goal position to the other direction(read_write.c line #201).

These values are simply user defined values for testing DYNAMIXEL.

Thank you.

2020-07-27 17:36:18
2020-07-28 13:41:22 robotiscustomer

Thanks Will. In the case of XH540-W270R, is the following settings correct?

Min Position Limit: 0

Max Position Limit: 4095

Moving Threshold: 10

2020-07-29 09:48:20 willson
Yep, you can use these settings on your code :)
2020-07-29 09:48:20
2020-07-28 13:41:22
2020-07-29 23:14:27 robotiscustomer

Thanks Will for the confirmation :)

2020-07-29 23:14:27
2020-08-01 03:39:14 robotiscustomer

Hi Willson, I set the Baudrate of the XH540-270 via the Linux version of DynamixelWizard 2.0 and read_write.c to 1000000, 2000000, 3000000 and 4000000. The XH540-W270 turned under each Baudrate. However, when I set to 4500000, I got:

Succeeded to open the port!

[PortHandlerLinuxLLsetCustomBaudrate] Cannot set speed to 4500000, closest is 4800000

Failed to change the baudrate!

Press any key to terminate...

From the U2D2 and XH540-W270 eManual, both the U2D2 and the motor support baud rate at 4500000 but not 4800000. Can you tell me how to fix this? What is the recommend baud rate for driving many XH540-W270 with U2D2?


2020-08-01 03:39:14
2020-08-03 13:59:27 Will Son


The custom baudrate can differ by the system as each system may have different serial interface.

You should select a proper baudrate that is supported in your development environment and your system requirement such as control frequency and how many data will be transmitted back and forth.

FYI, we use 2Mbps for adult sized humanoid with control frequency of 8ms.

Thank you.

2020-08-03 13:59:27
웹에디터 시작 웹 에디터 끝