Commanded units for motor feedback

Hi all. I am encountering a strange issue with the Arduino side of my code. I cannot get the motor return it’s position, velocity, etc. back in encoder counts. I have tried manually setting the units to UNIT_RAW in Dynamixel2Arduino, yet it still returns in the data in the table units, degrees, revs/min, etc. Is this a hard setting in protocol 2.0?

@radugbhr
Which Arduino board + library + DYNAMIXEL are you using?
Have you tried examples that come with the DYNAMIXELShield library?

I have. I am using an Arduino AtMega 2560 with the Dynamixel2Arduino (Dynamixel shield) latest library version with Dynamixel MX-160Ts.

The Arduino Uno and Mega shares serial port with USB, and if you are trying to read the output from the USB port while controlling DYNAMIXEL, you’ll get bunch of unreadable characters.
Please refer to below information.

In order to properly read the data from Arduino / DYNAMIXEL Shield, you need a serial-USB interface such as LN-101.

No, I’ve got the Dynamixel shield communicating to the Arduino Mega thru its Serial3 port, which it does correctly. I can read the motor position in degrees but can’t get it to return that number in encoder counts no matter what I change in the library header file.

@radugbhr
I’m sorry, but I’m not sure if I understood your inquiry correctly.
Are you trying to read the encoder tick of DYNAMIXEL?
In that case, you can simply read as below.

DEBUG_SERIAL.println(dxl.getPresentPosition(DXL_ID));

Options such as UNIT_DEGREE or UNIT_PERCENT or UNIT_RPM are only necessary when not using a raw value.