# Thread: Obtaining direction of present speed of Dynamixel AX-12+ actuators

1. Relay
Join Date
Mar 2010
Posts
7
Rep Power
31

## Obtaining direction of present speed of Dynamixel AX-12+ actuators

Hello everyone,

I need help in understanding the present speed feedback (adresses 38 and 39 in the control table) of the Dynamixel AX-12+ actuators. Basically I'm not entirely sure what the numbers that I get from the feedback mean, if they contain information regarding the direction of rotation and if they do, how to make sense of it.

3. ## Re: Obtaining direction of present speed of Dynamixel AX-12+ actuators

If bit 10 is a 1 then rotation is in the clockwise direction; otherwise rotation is counter clockwise. Bits 0-9 are the speed value. If you made a mask, call it directionMask, and made it equal to 1024 (0x400 or 0x10000000000) the you could use conditional statements and logical operators.

Code:
```if(directionMask & present speed)
moving clockwise
else
moving counter clockwise```
To get the magnitude of speed take the inverse of the mask then do a logical AND with present speed.

In continuous rotation mode (from your other posts), the moving speed fluctuates +/-20 units in the 0-300 degree range and is useless in the 300-360 range. You need to make sure that the AX-12 is positioned in the sweet spot (0 to 300) before querying the goal speed registers. Mark the starting goal position before entering continuous rotation mode. I usually set a buffered range around the goal position so I can count turns. Start up a counter (clock) and start pinging for goal position every so many ticks. Pinging has to be a function of the moving speed to work correctly. If the goal position is within 0 to 300, it is safe to take a speed reading. If the goal position is within the buffered goal position range add/decrement one to the number of rotations.

This will work ok with one or two AX-12s any more and this will be a timing nightmare.
Last edited by MikeG; 03-13-2010 at 07:39 AM.

4. Relay
Join Date
Mar 2010
Posts
7
Rep Power
31

## Re: Obtaining direction of present speed of Dynamixel AX-12+ actuators

Hi,
Is it correct to say that a value greater than 2^10 signifies a negative rotation?

5. ## Re: Obtaining direction of present speed of Dynamixel AX-12+ actuators

No, that is not correct. There are a large number of values that are greater than 1023 (which is 2^10 - 1, btw) that are not negative rotation.

It is correct to say that values from 0-1023 specify one direction, and values from 1024-2047 specify values in the other direction.

I prefer to think of it as 0-1023 specifies the magnitude of the speed, and bit 10 specifies the direction.

- Jon

6. ## Re: Obtaining direction of present speed of Dynamixel AX-12+ actuators

@ngom52, ask your professor about about encoding negative numbers in binary; signed-magnitude, 1's complement, and 2's complement. These concepts are generally taught in entry level studies of CE and EE.

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•