
                MTN File Format

- function
   Provides motion data information for a robot.

- byte order
   little endian

- data type definition

   type : Strings are composed by the following definition.

      offset  size    type    contents                        data
      -------+-------+-------+-------------------------------+-------
         0      1     uc      length
         1      x     ch      characters

    length:
        The number of characters in a string
    characters:
        String data

- File Format

      offset  size    type    contents                        data
      -------+-------+-------+-------------------------------+-------
         0      1     ch      magic 0                         'O'
         1      1     ch      magic 1                         'M'
         2      1     ch      magic 2                         'T'
         3      1     ch      magic 3                         'N'
         4      24    cp      Section 0
         28     x     cp      Section 1
         x      x     cp      Section 2
         x      x     cp      Section 3

    magic 0-3:
        file magic

    1. Section 0
         Section0 is the header of fundamental items.  It has a fixed
length.

      offset  size    type    contents                        data
      -------+-------+-------+-------------------------------+-------
      0       4       lw      Section Number                  0
      4       4       lw      Section Size                    24
      8       4       lw      Number of Sections              4
      12      2       wd      Major Version                   1
      14      2       wd      Minor Version                   2
      16      2       wd      Number of keyframes
      18      2       wd      Frame Rate                      16
      20      4       lw      Reserved                        0

    Section Number:
        Serial Number of this section
    Section Size:
        The size of this section (in bytes)
    Number of Sections:
        The number of sections contained in this file
    Major Version:
        The major version number of Format
    Minor Version:
        The minor version number of Format
    Number of keyframes:
        The number of keyframes in this file
    Frame Rate:
        Motion replay speed [msec/frame]

    2. Section 1
    This header describes the fundamental names. It has a variable length.
    Note: Use padding when the Section Size is less than 4 bytes.

      offset  size    type    contents                        data
      -------+-------+-------+-------------------------------+-------
      0       4       lw      Section Number                  1
      4       4       lw      Section Size
      8       x       Strings Motion Name
      x       x       Strings Creator
      x       x       Strings Design Label
      x       0-3             Padding                         0

    Section Number:
        Serial Number of this section
    Section Size:
        The size of this section (in bytes)
    Motion Name:
        Motion Name is the file name without the mtn extension
    Creator:
        Author name
    Design Label:
        The design label of the robot

    3. Section 2
    This header describes the Joint list.  It has a variable length.
    Note: Use padding when the Section Size is less than 4 bytes.

      offset  size    type    contents                        data
      -------+-------+-------+-------------------------------+-------
      0       4       lw      Section Number                  2
      4       4       lw      Section Size
      8       2       wd      Number of Joints
      x       x       Strings PRM 0
      x       x       Strings PRM 1
      x       x       ....
      x       x       Strings PRM (Number of Joints -1)
      x       0-3             Padding                         0

    Section Number:
        Serial Number of this section
    Section Size:
        The size of this section (in bytes)
    Number of Joints:
        The number of Joints used in this file
    PRM:
        The CPC Primitive Locator name of a Joint used in this file

    9.4. Section 3
    This head describes the type of motion data. It has a variable length.
    Note: Use padding when the section Size is less than 4 bytes.

      offset  size    type    contents                        data
      -------+-------+-------+-------------------------------+-------
      0       4       lw      Section Number                  3
      4       4       lw      Section Size
      8       4       lw      Data Type                       0
      12      x       cp      Data Section

    Section Number:
        Serial Number of this section
    Section Size:
        The size of this section (in bytes)
    Data Type:
        The kind of Motion Data
        0 : angle line data

    4-1. Data Section
    The following is the data format when the Data Type is 0.

    [Roll] [Pitch] [Yaw]
    [Joint Data]
    {
      [Number of Interpolate frame]
      [Roll] [Pitch] [Yaw]
      [Joint Data]
    }  X (Number of Keyframes - 1)

      offset  size    type    contents                        data
      -------+-------+-------+-------------------------------+-------
      0       4       lw      Roll
      4       4       lw      Pitch
      8       4       lw      Yaw
      12      x       cp      Joint Data Section
      x       4       lw      Number of Interpolation frames
                              .....
    Roll:
        Robot's BODY roll (in Micro radian)
        (when it leans to the right, plus)

    Pitch:
        Robot's BODY pitch (in Micro radian)
        (when it leans backward, plus)

    Yaw:
        Robot's BODY yaw (in Micro radian)
        (when it turns to the left, plus)

    Joint Data Section:
        The joint data is associated with the corresponding PRM
        String in Section 2.

    Number of Interpolation frames:
        The number of interpolation frames with the former frame.

    9.4-1-1. Joint Data Section

      offset  size    type    contents                        data
      -------+-------+-------+-------------------------------+-------
      0       4       lw      Joint Data 0
      4       4       lw      Joint Data 1
                              .....
      x       4       lw      Joint Data (Number of Joints)

    Joint data:
    The position of a joint (in Micro radians)

Example

 ADDRESS : +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F 0123456789ABCDEF
           +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
          -------------------------------------------------
00000000 : 4F 4D 54 4E 00 00 00 00 18 00 00 00 04 00 00 00 : OMTN............
00000010 : 01 00 00 00 05 00 00 00 00 00 00 00 01 00 00 00 : ................
00000020 : 26 00 00 00 04 63 64 23 31 10 53 6F 6E 79 20 43 : &....cd#1.Sony C
00000030 : 6F 72 70 6F 72 61 74 69 6F 6E 07 44 52 58 2D 37 : orporation.DRX-7
00000040 : 30 30 02 00 00 00 A8 01 00 00 12 00 13 50 52 4D : 00...........PRM
00000050 : 3A 2F 72 30 2F 63 30 2D 4A 6F 69 6E 74 3A 6A 30 : :/r0/c0-Joint:j0
00000060 : 16 50 52 4D 3A 2F 72 30 2F 63 30 2F 63 31 2D 4A : .PRM:/r0/c0/c1-J
00000070 : 6F 69 6E 74 3A 6A 31 19 50 52 4D 3A 2F 72 30 2F : oint:j1.PRM:/r0/
00000080 : 63 30 2F 63 31 2F 63 32 2D 4A 6F 69 6E 74 3A 6A : c0/c1/c2-Joint:j
00000090 : 32 1C 50 52 4D 3A 2F 72 30 2F 63 30 2F 63 31 2F : 2.PRM:/r0/c0/c1/
000000A0 : 63 32 2F 63 33 2D 4A 6F 69 6E 74 3A 6A 33 13 50 : c2/c3-Joint:j3.P
000000B0 : 52 4D 3A 2F 72 32 2F 63 30 2D 4A 6F 69 6E 74 3A : RM:/r2/c0-Joint:
000000C0 : 6A 30 16 50 52 4D 3A 2F 72 32 2F 63 30 2F 63 31 : j0.PRM:/r2/c0/c1
000000D0 : 2D 4A 6F 69 6E 74 3A 6A 31 19 50 52 4D 3A 2F 72 : -Joint:j1.PRM:/r
000000E0 : 32 2F 63 30 2F 63 31 2F 63 32 2D 4A 6F 69 6E 74 : 2/c0/c1/c2-Joint
000000F0 : 3A 6A 32 13 50 52 4D 3A 2F 72 33 2F 63 30 2D 4A : :j2.PRM:/r3/c0-J
00000100 : 6F 69 6E 74 3A 6A 30 16 50 52 4D 3A 2F 72 33 2F : oint:j0.PRM:/r3/
00000110 : 63 30 2F 63 31 2D 4A 6F 69 6E 74 3A 6A 31 19 50 : c0/c1-Joint:j1.P
00000120 : 52 4D 3A 2F 72 33 2F 63 30 2F 63 31 2F 63 32 2D : RM:/r3/c0/c1/c2-
00000130 : 4A 6F 69 6E 74 3A 6A 32 13 50 52 4D 3A 2F 72 34 : Joint:j2.PRM:/r4
00000140 : 2F 63 30 2D 4A 6F 69 6E 74 3A 6A 30 16 50 52 4D : /c0-Joint:j0.PRM
00000150 : 3A 2F 72 34 2F 63 30 2F 63 31 2D 4A 6F 69 6E 74 : :/r4/c0/c1-Joint
00000160 : 3A 6A 31 19 50 52 4D 3A 2F 72 34 2F 63 30 2F 63 : :j1.PRM:/r4/c0/c
00000170 : 31 2F 63 32 2D 4A 6F 69 6E 74 3A 6A 32 13 50 52 : 1/c2-Joint:j2.PR
00000180 : 4D 3A 2F 72 35 2F 63 30 2D 4A 6F 69 6E 74 3A 6A : M:/r5/c0-Joint:j
00000190 : 30 16 50 52 4D 3A 2F 72 35 2F 63 30 2F 63 31 2D : 0.PRM:/r5/c0/c1-
000001A0 : 4A 6F 69 6E 74 3A 6A 31 19 50 52 4D 3A 2F 72 35 : Joint:j1.PRM:/r5
000001B0 : 2F 63 30 2F 63 31 2F 63 32 2D 4A 6F 69 6E 74 3A : /c0/c1/c2-Joint:
000001C0 : 6A 32 13 50 52 4D 3A 2F 72 31 2F 63 30 2D 4A 6F : j2.PRM:/r1/c0-Jo
000001D0 : 69 6E 74 3A 6A 30 13 50 52 4D 3A 2F 72 31 2F 63 : int:j0.PRM:/r1/c
000001E0 : 31 2D 4A 6F 69 6E 74 3A 6A 31 03 00 00 00 BE 01 : 1-Joint:j1......
000001F0 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
00000200 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
00000210 : 3B 56 FD FF 00 00 00 00 50 FD 07 00 3B 56 FD FF : ;V......P...;V..
00000220 : 00 00 00 00 50 FD 07 00 3B 56 FD FF 00 00 00 00 : ....P...;V......
00000230 : 51 FD 07 00 3B 56 FD FF 00 00 00 00 50 FD 07 00 : Q...;V......P...
00000240 : 00 00 00 00 00 00 00 00 23 00 00 00 00 00 00 00 : ........#.......
00000250 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
00000260 : 00 00 00 00 00 00 00 00 3B 56 FD FF 00 00 00 00 : ........;V......
00000270 : 50 FD 07 00 3B 56 FD FF 00 00 00 00 50 FD 07 00 : P...;V......P...
00000280 : 3B 56 FD FF 00 00 00 00 51 FD 07 00 3B 56 FD FF : ;V......Q...;V..
00000290 : 00 00 00 00 50 FD 07 00 00 00 00 00 00 00 00 00 : ....P...........
000002A0 : 19 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
000002B0 : 00 00 00 00 00 00 00 00 32 52 09 00 00 00 00 00 : ........2R......
000002C0 : 3B 56 FD FF 00 00 00 00 50 FD 07 00 3B 56 FD FF : ;V......P...;V..
000002D0 : 00 00 00 00 50 FD 07 00 3B 56 FD FF 00 00 00 00 : ....P...;V......
000002E0 : 50 FD 07 00 3B 56 FD FF 00 00 00 00 50 FD 07 00 : P...;V......P...
000002F0 : 00 00 00 00 00 00 00 00 19 00 00 00 00 00 00 00 : ................
00000300 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
00000310 : 32 52 09 00 00 00 00 00 3B 56 FD FF 00 00 00 00 : 2R......;V......
00000320 : 50 FD 07 00 3B 56 FD FF 00 00 00 00 50 FD 07 00 : P...;V......P...
00000330 : 3B 56 FD FF 00 00 00 00 50 FD 07 00 3B 56 FD FF : ;V......P...;V..
00000340 : 00 00 00 00 50 FD 07 00 00 00 00 00 00 00 00 00 : ....P...........
00000350 : 23 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : #...............
00000360 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
00000370 : 3B 56 FD FF 00 00 00 00 50 FD 07 00 3B 56 FD FF : ;V......P...;V..
00000380 : 00 00 00 00 50 FD 07 00 3B 56 FD FF 00 00 00 00 : ....P...;V......
00000390 : 51 FD 07 00 3B 56 FD FF 00 00 00 00 50 FD 07 00 : Q...;V......P...
000003A0 : 00 00 00 00 00 00 00 00 4F 4D 54 4E 00 00 00 00 : ........OMTN....
000003B0 : 18 00 00 00 04 00 00 00 01 00 00 00 12 00 00 00 : ................
000003C0 : 00 00 00 00 01 00 00 00 27 00 00 00 05 63 64 23 : ........'....cd#
000003D0 : 31 34 10 53 6F 6E 79 20 43 6F 72 70 6F 72 61 74 : 14.Sony Corporat
000003E0 : 69 6F 6E 07 44 52 58 2D 37 30 30 02 00 00 00 A8 : ion.DRX-700.....
000003F0 : 01 00 00 12 00 13 50 52 4D 3A 2F 72 30 2F 63 30 : ......PRM:/r0/c0
00000400 : 2D 4A 6F 69 6E 74 3A 6A 30 16 50 52 4D 3A 2F 72 : -Joint:j0.PRM:/r
00000410 : 30 2F 63 30 2F 63 31 2D 4A 6F 69 6E 74 3A 6A 31 : 0/c0/c1-Joint:j1
00000420 : 19 50 52 4D 3A 2F 72 30 2F 63 30 2F 63 31 2F 63 : .PRM:/r0/c0/c1/c
00000430 : 32 2D 4A 6F 69 6E 74 3A 6A 32 1C 50 52 4D 3A 2F : 2-Joint:j2.PRM:/
00000440 : 72 30 2F 63 30 2F 63 31 2F 63 32 2F 63 33 2D 4A : r0/c0/c1/c2/c3-J
00000450 : 6F 69 6E 74 3A 6A 33 13 50 52 4D 3A 2F 72 32 2F : oint:j3.PRM:/r2/
00000460 : 63 30 2D 4A 6F 69 6E 74 3A 6A 30 16 50 52 4D 3A : c0-Joint:j0.PRM:
00000470 : 2F 72 32 2F 63 30 2F 63 31 2D 4A 6F 69 6E 74 3A : /r2/c0/c1-Joint:
00000480 : 6A 31 19 50 52 4D 3A 2F 72 32 2F 63 30 2F 63 31 : j1.PRM:/r2/c0/c1
00000490 : 2F 63 32 2D 4A 6F 69 6E 74 3A 6A 32 13 50 52 4D : /c2-Joint:j2.PRM
000004A0 : 3A 2F 72 33 2F 63 30 2D 4A 6F 69 6E 74 3A 6A 30 : :/r3/c0-Joint:j0
000004B0 : 16 50 52 4D 3A 2F 72 33 2F 63 30 2F 63 31 2D 4A : .PRM:/r3/c0/c1-J
000004C0 : 6F 69 6E 74 3A 6A 31 19 50 52 4D 3A 2F 72 33 2F : oint:j1.PRM:/r3/
000004D0 : 63 30 2F 63 31 2F 63 32 2D 4A 6F 69 6E 74 3A 6A : c0/c1/c2-Joint:j
000004E0 : 32 13 50 52 4D 3A 2F 72 34 2F 63 30 2D 4A 6F 69 : 2.PRM:/r4/c0-Joi
000004F0 : 6E 74 3A 6A 30 16 50 52 4D 3A 2F 72 34 2F 63 30 : nt:j0.PRM:/r4/c0
          -------------------------------------------------
           +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
