Conversion between angle and position values

Hi, I have question about converting between rotational angle in degree and positional values accepted by dynamixel.

I have not built a robot but different motors can be oriented differently (e.g. horn on top of the dynamixel label and vice versa). If the dynamixel accepts values between 0 and 4095 and 2048 means 180 degrees, what is the positional values for 0 and 360 degrees if turning like a wheel is not needed?

By calculation: 90 degrees = 1024, 270 degrees = 3072, 360 degrees = 4096 which is outside the range of [0, 4095]. Is 0 degree = 0 positional value, 360 degrees = 4095 position value even by calculation, it should correspond to 4096?

Re: Conversion between angle and position values

The 360 degree position is valued at 0. Unfortunately, you can't actually get QUITE to that position -- you'll get to (4095*360/4096) degrees. Protocol 2.0 has a "multi-turn" mode that may help if you need to "push" it from 359 to 0 without going all the way back.

When there is not multi-turn, the classic way to do it is to turn on wheel mode, push it across the limit, then turn it back to position mode once it's on the other side.

Re: Conversion between angle and position values

Thanks jwatte. My simulator has 0 as the center and +- value degrees to indicate the amount of turning and whether it is turning clockwise or counter-clockwise.

In previous projects, I used standard RC servo motors with 90 degrees in the middle. So I just wrote a function to add 90 as an offset to whatever values from the simulator to make the motors turned accordingly.

With such workflow and the use of dynamixel as the motors, do you still recommend to turn on the wheel mode rather than use the position control mode?

Re: Conversion between angle and position values

Unless you truly need 360 degrees of motion (not 359.9) you don't need wheel mode.

You should just center the formula for "sent parameter from desired angle" at 0 degrees == 2048 sent parameter. This isn't that different from centering 90 degrees at 1500 microseconds for a hobby servo.

This brings up an important point: For success in robotics (and STEM in general,) I've found that making simple algebraic equivalencies second nature, similar to addition, in my head, is super important.

This comes in helpful for things like Ohm's law, as well as torque and load calculations, as well as translation tables. (It also comes in helpful for computer graphics, and a bunch of other areas.)

The linear equation parameters that you want in this case is "0 control value at -180 degrees" and "2048 control value at 0 degrees" (and an implicit "4095 control value at +179.9 degrees")

Plugging those values into the linear formula y = kx + b and rearranging the terms to get the scalling/addition factors you need, should be second nature, a thing I do in my head. Before I got to that point, I had a much harder time working with these things!

Re: Conversion between angle and position values

Quote:

Originally Posted by

**jwatte**
Unless you truly need 360 degrees of motion (not 359.9) you don't need wheel mode.

You should just center the formula for "sent parameter from desired angle" at 0 degrees == 2048 sent parameter. This isn't that different from centering 90 degrees at 1500 microseconds for a hobby servo.

This brings up an important point: For success in robotics (and STEM in general,) I've found that making simple algebraic equivalencies second nature, similar to addition, in my head, is super important.

This comes in helpful for things like Ohm's law, as well as torque and load calculations, as well as translation tables. (It also comes in helpful for computer graphics, and a bunch of other areas.)

The linear equation parameters that you want in this case is "0 control value at -180 degrees" and "2048 control value at 0 degrees" (and an implicit "4095 control value at +179.9 degrees")

Plugging those values into the linear formula y = kx + b and rearranging the terms to get the scalling/addition factors you need, should be second nature, a thing I do in my head. Before I got to that point, I had a much harder time working with these things!

Thank you.