Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in protocol1_packet_handler.cpp, line 222 checking the returned Error Mask #120

Closed
pramilo opened this issue Sep 21, 2017 · 2 comments
Closed
Assignees

Comments

@pramilo
Copy link

pramilo commented Sep 21, 2017

Please fill out the questionaire to give you the best support service.

  • Which DYNAMIXEL is it?

    [ ALL ] ( ex: MX-64AT , XM430-350R , PRO H54-100-S500-R , ...)

  • Which CONTROLLER is it?

    [ USB2Dynamixel ] ( ex: OpenCM , OpenCR , Arduino Uno , PC via USB2Dynamixel , ... )

  • Which VERSION of DynamixelSDK is it?

    ([NOTE] DynamixelSDK Q&A is not available anymore if it is older than ver. 3.0.0, but feedback us)

    [  3.5.2 ] ( ex: 3.4.2 , dxl_sdk_win32_v2_02.zip , ... )

  • Any PICTURES or VIDEOS?

    ![ Nono ]( Link the PICTURES or VIDEOS here, if necessary )

  • Any SOURCE SAMPLES?

    [ I attach
    protocol1_packet_handler.zip
    protocol1_packet_handler.zip

a commented file ]( Link the SOURCE SAMPLES here, if necessary )

Summary:

In line 222 of protocol1_packet_handler.cpp, you check if the error mask returned is valid.
However your check has a bug. Your code is:

rxpacket[PKT_ERROR] >= 0x64

The problem is that 0x64 = ‭01100100‬, does not cover all valid masks. (see http://support.robotis.com/en/product/actuator/dynamixel/communication/dxl_packet.htm )

I think you meant to say 64 (without the 0x) but that would also be wrong, because it would not account for situations with multiple errors at once.

The correct check should be for bitmask 01111111‬ = 127 or 0x7F in Hexadecimal.

The line should become:
rxpacket[PKT_ERROR] > 127 (NOTE: just ">" not ">=")

This is causing the SDK to give error of "No reply packet" even if the servo replies but has an error condition of Voltage Error, Angle Limit Error, Checksum or Overload Error. In all cases, the SDK will discard the reply and return a code indicating the servo did not send a valid reply.

Pedro Ramilo
[ Seed Robotics ]

@pramilo
Copy link
Author

pramilo commented Sep 21, 2017

I must add that this check (validity of the error mask) is somewhat redundant. Other bus devices using the Dynamixel protocol (by partner manufactures or custom designed by the users) could make use of the full byte.
Furthermore discarding a packet that is correct in length and checksum just because it fails the error mask verification seems a little aggressive.

Failing the checksum check or length check would seem much more severe and worth discarding the packet.

@pramilo pramilo changed the title Bug in protocol1_packet_handler.cpp, line 222 Bug in protocol1_packet_handler.cpp, line 222 checking the returned Error Mask Sep 21, 2017
@LeonJung
Copy link
Contributor

@pramilo

Hi, how are you
long time no see

You are right.

Thanks for sharing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants