ROBOTIS-GIT / DynamixelSDK

ROBOTIS Dynamixel SDK (Protocol1.0/2.0)
http://emanual.robotis.com/docs/en/software/dynamixel/dynamixel_sdk/overview/
Apache License 2.0
458 stars 409 forks source link

[3.7.51][Python3][U2D2][XM430-W350-T] Issue : read4ByteTxRx in protocol2_packet_handler.py return empty data ? #532

Open ZhengYi0310 opened 3 years ago

ZhengYi0310 commented 3 years ago
Details :

Which DYNAMIXEL SDK version do you use?

3.7.51

Which programming language/tool do you use?

python3

Which operating system do you use?

ubuntu 20.04

Which USB serial converter do you use?

U2D2

Which DYNAMIXEL do you use?

XM430-W350-T

Hello,

I am using the SDK on ubuntu 18.04.5 LTS, with other specifications listed in the title, here is the code I have:

Screenshot from 2021-10-19 20-50-59 Screenshot from 2021-10-19 20-51-16 Screenshot from 2021-10-19 20-51-39 Screenshot from 2021-10-19 20-52-56

When I run the script, it seems the communication stops randomly after the script starts running, sometimes less than 1 minute, sometimes about 5 to 10 minutes, and the error is the following:

it seems the readTxRx function receives empty data. Also, the LED changes to static red, another indicator that the communication stops.

Screenshot from 2021-10-19 20-54-57 I've already changed to the baud rate (default is 57600) to a lower and higher number, but it seems not relevant.

the latency_timer of the usb port is shown as the following: Screenshot from 2021-10-19 21-10-26

The 3pin cables connect u2d2 to motor is the standard ones comes with the kit, however I used a very long usb extension cable to connect the u2d2 to my pc, would that cause the issue ?

Thanks in advance !

ROBOTIS-Will commented 3 years ago

Hi @ZhengYi0310

Please do not paste the screen capture of the source code as it will make difficult to read the code and point important keywords.

It seems you are using an incorrect byte length for setting up an initial values. Please refer to the control table of the XM430-W350 and use the correct function depending on the length of the item. For example, the Operating Mode(11) is a 1 byte data which requires write1ByteTxRx instead of write2ByteTxRx. Similiary, the Velocity Limit(48), Max Position Limit(48), Min Position Limit(52) needs write4ByteTxRx.

Address Size(Byte) Data Name Access InitialValue Range Unit
11 1 Operating Mode RW 3 0 ~ 16 -
44 4 Velocity Limit RW 200 0 ~ 1,023 0.229 [rev/min]
48 4 Max Position Limit RW 4,095 0 ~ 4,095 1 [pulse]
52 4 Min Position Limit RW 0 0 ~ 4,095 1 [pulse]

Thank you.

ZhengYi0310 commented 3 years ago

Hi @ROBOTIS-Will

Thanks very much for the reply !

I've updated the code based on control table, and I believe I've corrected all initialization: https://github.com/ZhengYi0310/dynamixel_current_controller/blob/main/gripper_current_controller.py

However the error still exists. Also this error always happens at line 279, at line 195 there is another call of packetHandler.read4ByteTxRx(portHandler, DXL_ID, ADDR_MX_PRESENT_POSITION), but the error never happens at line 195.

Any further suggestions ? Thanks in advance.

ZhengYi0310 commented 3 years ago

Hi @ROBOTIS-Will More updates, when I run the read_write.py script in DynamixelSDK/python/tests/protocol2_0/ the same issue happens, as can be seen in the following Screenshot from 2021-10-30 17-07-39

But when I use Dynamixel Wizards 2, the issue never happens, hence I don't think it's a cable issue, and I suspect it is related with the read and write frequency.

Thanks

:

ROBOTIS-Will commented 3 years ago

Hi @ZhengYi0310 If you are getting similar issues with the example code that we provide, I think your environment may cause unstable communication. Since you are getting an intermittent "no status packet" error, I'd check your communication cables. If possible, try testing with a shorter USB cables as extended USB cables that are longer than 1m(3 feet) could affect stable communication. Thank you.