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 (^_^)/

Friday, January 16, 2015

[RM2] Motion File Format

Let's analyze motion file!
If you open one of your RM2 motion file, you will see lots of numbers and chars etc...

I added comments in the pose name so that i can easily see what the blocks are in the editor.

Here is what you see in the text editor.


Let's look at them!

Line1:  _MOTION_FORMAT:[ POSEDEF_V1R4 ]
I'm guessing those are the definitions for the type of motion file and identifying what formatting it is.

Line2:  _ENABLE_AXIS:[62]
this is the definition for number of enabled axis(slider bars)?

Line4:  _MOTION_INFO:[[]]-[50]-[10]-[9]-[0]-[1]-[-1]
Line5:  _STARTMOT:
Those lines represents the "Start Block".
[[]]:  this is the name of the pose, since its start block and does not have name, it's being empty.
[50]-[10]:  this is the position of the pose block.  take a look at other "MOTION_INFO" it has the same values as (x, y) noted in the name of the pose blocks.
[9]:  this is some value associated with the "arrow ->" going from the start block to the next.  if you change the position of the "dot" on the arrow, the value will change.
[0]:  Not 100% sure about this but if we follow the lest of the blocks, this should be the value for the second arrow, which does not exist on the start block. I would say keep it "0" for the start block.
[1]:  This is the identification of the block which the arrow is connected to.
_STARTMOT:  this is the identification for start block.
[-1]:  This is the indication of the block which the second arrow is connected to.  there is no second arrow on the start block, so its showing up "-1".

Line7:  _MOTION_INFO:[[P0 (50,50) 50step START->P1]]-[50]-[50]-[23]-[6]-[3]-[-1]
Line8:  _POSE:[50]-[0x0000,0x0aa5,0x3e97,0xf5c8,0x0000,0X0000,0x0000,0xf55b,0xc169, ....
Those lines represents the first pose block "P1".
_MOTION_INFO:  This part looks the same as the start block...
<!>  Notice that this pose is connected to the second pose and mysteriously the identification indicated here says "3".  Let's keep eye on this value to see if we can figure out how this work...
_POSE:[50]:  the value 50 is the number of the steps.  You can chek it by looking at other pose blocks.
[0x0000,0x0aa5,0x3e97 ...:  Those values are the value representing the "slider", you can check them by changing one and see the difference.

Line10:  _MOTION_INFO:[[   END   ]]-[50]-[736]-[16]-[46]-[-1]-[-1]
Line11:  _ENDMOT:
Those lines represents the end block.... Well, why it's showing up after the first pose block???
The order of the pose blocks listed in the motion file is the order of the blocks created.  When you create a new file, it will automatically creates "Start", "Pose0", and "End" blocks.  Therefore, the end block comes before the second pose block. That's my guess...

Line13:  [[P1 (45,133) 40step P1->P2]]-[45]-[133]-[6]-[6]-[4]-[-1]
Line14:  _POSE:[40]-[0x0000,0x0aa5,0x3e97,0xf5c8,0x0000,0X0000,0x0000,0xf55b,0xc169,...
Those lines represent the second pose block.
this pose has value "4" as the indication of the connecting pose!

Line16:  _MOTION_INFO:[[P2 (49,208) 30step P2->END]]-[47]-[201]-[6]-[6]-[5]-[-1]
Line17:  _POSE:[30]-[0x0000,0x0aa5,0x3e97,0xf5c8,0x0000,0X0000,0x0000,0xf55b,0xc169,
Those lines represent the third pose block.
Now the connection pose is "5"!

Line19:  _MOTION_INFO:[[OP1 CR64 CTSUB CON255 OP1-IF1]]-[47]-[265]-[6]-[6]-[6]-[-1]
Line20:  _VARCON:[0]-[64]-[255]
Those lines represent the operational block.  
All the parameters used for operation is in the line 20.
 _VARCON:  indication of operation block
[0]:  indication of type of operation. In this case, its constant subtraction
[64]:  The memorry address where the calculation result is stored.
[255]:  constant value.
This block has connection pose value "6".

Line22:  _MOTION_INFO:[[IF1 V64>50 YP1 NBK]]-[46]-[334]-[54]-[46]-[7]-[3]
Line23:  _MIF:[1]-[64]-[50]
Those lines represent the condition block.  
[1]:  this represents type of condtion its looking for. in this case, it's "Greater than".
[64]-[50]:  values used for checking the conditions.
[7]-[3]:  Indication of connection blocks 

Line25:  _MOTION_INFO:[[BK1 YP2 NEND]]-[53]-[397]-[16]-[46]-[2]-[4]
Line26:  _OLDLOOP
Those lines represent the break block.
[2]-[4]:  indicates connecting blocks.


Now, have you figure out how find out which block connects to which???
By looking at how I have them connected to in the RM2, here is the number representation of the blocks.

Start:  0
P0:  1
P1:  3
P2:  4
OP1: 5
IF1: 6
BK1:  7
END: 2

You should notice it by now that the numbering of the blocks are based on the order you see in the editor (order of the blocks that created).
You can see that by ordering them by how its listed in the text editor.

Start:  0
P0:  1  
END: 2
P1:  3
P2:  4
OP1: 5
IF1: 6
BK1:  7

Wow!  That's really simple isn't it???
Now you can creat a simulation software and create your robot project from your own simulator!!!
\(^-^)/