POST No. 2406922
Dynamixel AX-12A sdk example error
2018-08-03 01:44:49 moonchilde

Dynamixel AX-12A

SDK Version: Dynamixel SDK 3.6.1

Language: C++

OS: Linux

Code: read write example

I am attempting to run the C++ Protocol 2.0 read-write example.  I have only made the following modifications:

//AX-12A addresses

#define ADDR_TORQUE_ENABLE          24

#define ADDR_GOAL_POSITION          30

#define ADDR_PRESENT_POSITION       36

// Default settings

#define DXL_ID                          0  //was set to 1 but the dynamixel ax-12 manual has id's starting at 0; I have tried both!

#define BAUDRATE                        1000000  //ax-12 manual states this as default...

#define DEVICENAME                      "/dev/ttyAMA4" //my port

#define DXL_MINIMUM_POSITION_VALUE      0 //from dynamixel 12 manual
#define DXL_MAXIMUM_POSITION_VALUE      0x3ff //from dynamixel 12 manual

Here is the output I get:
Succeeded to open the port!
Succeeded to change the baudrate!
TxRx Result Error: [TxRxResult] Incorrect status packet!
Press any key to continue! (or press ESC to quit!) <esc> 
[TxRxResult] Incorrect status packet!

I dug into this a little more.  What I am seeing is that on the first command in the example, enable torque, the rx is failing:
  // Enable Dynamixel Torque
  dxl_comm_result = packetHandler->write1ByteTxRx(portHandler, DXL_ID, ADDR_TORQUE_ENABLE, TORQUE_ENABLE, &dxl_error);

In there, Protocol2PacketHandler::rxPacket() finds the packet header of a valid packet (FF, FF, FD...) at index 0.
It then gets into the if section that removes a byte from the packet due to the following trigger in the if statement:
 rxpacket[PKT_INSTRUCTION] != 0x55

In fact,  rxpacket[PKT_INSTRUCTION] == 3 in all cases I have run for this command.

This only happens once.  Then as we receive bytes we get into the final else of the method.  isPacketTimeout() is True and s ince rx_length > 0, the method returns COMM_RX_.CORRUPT.

Any help would be appreciated!

2018-08-03 01:44:49
2018-08-03 02:03:14 Kurt

As far as I know, AX-12 servos do NOT support protocol 2, they only support protocol 1.  That is unless I missed some major firmware update.

But as their internal processor (I believe AVR) is far more limited than the ARM chips in the newer servos.

Try using the Packet handler for protocol 1...

2018-08-03 02:03:14
2018-08-03 09:07:32 Will Son


As Kurt mentioned above, AX series does not support Protocol 2.0, therefore you should use examples based on Protocol 1.0.

Here's the list of Protocol 2.0 supported products.

Thank you!

2018-08-03 09:07:32
2018-08-03 23:16:55 Joel Kickbusch

Thanks for the quick replies.  I guess I missed that in my search.

I switched to Protocol 1.0 yesterday and that solved my initial issue.  Thank you!

But now I face a different problem.

The output of the Protocol 1.0 C++ read-write example is:

Succeeded to open the port!

Succeeded to change the baudrate!

[RxPacketError] Input voltage error! <- when setting the enable torque bit in the code


I have checked my voltage supply with a voltmeter and I am at 11.1 V, .05 A at standby which should be fine based on what I have read.

I have checked the wiring harness to the AX-12 with a voltmeter and that is fine too - I read 11.1 at the connector to the AX-12.

I have tried varying the supply over what i saw recommended as the range (9-12 V) but with the same Voltage error.

The actual return error in the code is a 3, which indicate both Input Voltage Error and Angle limit errors, if that helps.

I also don't understand the angle limit error since I haven't sent it any Goal Position commands.

I tried searching the forum for Input voltage error but came up relatively empty.

Again, any help would be appreciated.

2018-08-03 23:16:55
2018-08-04 07:53:08 Kurt

Hopefully @will son - will be able to give you a better answer, but I believe it is already the weekend there...

Might help to know more of the details, like what is the actual setup?  Is this a Linux machine connected to some servo controller or are you talking OpenCM9.04 or OpenCR...

Are you using the standard read_write example?  Any modifications?

How many servos do you have hooked up?  Do you have one (and hopefully only one) servo with ID #1 hooked up?  When you plug it in and apply power does the servo blink once?   If you have multiple servos try with just one servo connected and see if that works. 

Sorry not much more help.  

2018-08-04 07:53:08
2018-08-06 10:04:45 Will Son


1. Voltage Error : Please make sure that your Min/Max Voltage setting is covering 11.1V range. Default settings are 60(6V) ~ 140(14V).

2. If you used read_write.cpp example, the code is written for MX-series which allows 0~4095 position range.
    But, AX-series supports 0~1023 so you should modify the position value(line 58) within this range as shown below.


Please let us know if this doesn't resolve your issue.

Thank you!

2018-08-06 10:04:45
웹에디터 시작 웹 에디터 끝