Wednesday, January 21, 2015

[RM2] Motion File Format cont. (pose slider bar value)

In the last post we've learned how to translate the motion text file. Now let's look into the pose values representing the position of the joints.

I created a new motion file with a pose,
"L shoulder pitch"  => 10 degree and "L shoulder roll" => -5 degree.

Let's look at the motion file.
The slider number of "L shoulder pitch" is 23, and "L shoulder roll" is 22, so we will look into the 22nd and 23rd numbers.
You can check them by having your cursor over the slider, or by looking at pose slider property.

Here are the represented values:
L shoulder pitch:  23, 10degree, 0x0884 (2180)
L shoulder roll:    22, -5degree, 0xc53e (-15042)  => hex to signed decimal conversion

Let's look at pose slider property.
In the slider property, there is a value for "unit corresponding 1 (deg)".
In this case, the unit value is 218.
2180 / 218 = 10
Wow, we got the value representation of the "shoulder pitch"!
How about the shoulder roll???
-15042 / 218 = -69
... not quite right...

We are missing one more thing to take into a count here.
When we work with those robot, we always do "Calibration" of the servo motors, and those calibration data will be saved and used for calculating the position of the servos as well.
In your robot project folder, there is a init file called "medit_defpose.ini".

Let's take a look at "medit_defpose.ini" file!

Under "Axisenable", our slider 23 is listed at 18th, and the "Defpose_Value" representation at 18th is "0x0000".  For slider 22, it's 0xc980.

Now we have:
L shoulder pitch:  23, 10degree, 0x0884 (2180), 0x0000 (0)
L shoulder roll:    22, -5degree, 0xc53e (-15042), 0xc980 (-13952)

Let's do the calculation!
(2180 - 0)/218 = 10
(-15042 - (-13952))/218 = -5

Wow, that was simple (^_^)/

No comments:

Post a Comment