Overview of VRML Model

In OpenHRP, models that forms the robot and environmental objects, are defined by using the language called VRML2.0 (Virtual Reality Markup Language) which used to define 3D models. Each entity in the environment required an individual model file. Which means, to express a situation of a robot standing on the floor, you will need two VRML files(***.wrl); one for the floor and another for the robot, which would make two VRML files in total.

Basic layout of a VRML file is as follows.

Header:
PROTO declaration part (Declare the PROTO Structure)
The rest:
Real-model definition part (Declare the instances that uses PROTO)

PROTO declaration part is used to define new nodes that were not originally defined in VRML97. Therefore we use a node called "PROTO", which is similar to the concept of structure C language(For more details, please refer "PROTO Node").
The basic layout of real-model definition part is as follows:

    Humanoid sample(The root node of the whole model)
     + Joint WAIST (The center of the robot. A free point floats in the space)
     | ...
     |  + Joint Chest
     |    + Joint Head
     |    + Joint Left Arm
     |    + Joint Right Arm
     |
     + Joint Left Leg
     |
     + Joint Right Leg

This means, "Left leg", "Right leg" and the "Chest" are connected to the "Waist" which is floating in the space, and so as "Left arm", "Right arm" and the "Head" are connected to the "Chest".

The PROTO Node

In OpenHRP, the model is made by assembling instances of the following PROTO nodes. The PROTO node used here is based on PROTO node enacted by h-anim1.1, which is originaly used to describe human figure, and we extended/modified it to be use with OpenHRP model description. These OpenHRP PROTO nodes we will be using are Humanoid, Joint and Segment. We create models by combining instances of the these nodes and making a layered structure.

Apart from the three PROTO nodes mentioned above, we have prepared PROTO nodes to define various sensors. Camera, 6 axis ForceSensor, GyroSensor, AccelerationSensor and RangeSensor can be simulated by including each sensor in to the hierarchy.

Here, we explain the items defined by each node.

If the user have not defined values for each node, the default values in the fourth column of the list below, will be applied.

Humanoid

Humanoid is the root node of the model.

PROTO Humanoid [
  field         SFVec3f     bboxCenter        0 0 0
  field         SFVec3f     bboxSize          -1 -1 -1
  exposedField  SFVec3f     center            0 0 0
  exposedField  MFNode      humanoidBody      [ ]
  exposedField  MFString    info              [ ]
  exposedField  MFNode      joints            [ ]
  exposedField  SFString    name              ""
  exposedField  SFRotation  rotation          0 0 1 0
  exposedField  SFVec3f     scale             1 1 1
  exposedField  SFRotation  scaleOrientation  0 0 1 0
  exposedField  MFNode      segments          [ ]
  exposedField  MFNode      sites             [ ]
  exposedField  SFVec3f     translation       0 0 0
  exposedField  SFString    version           "1.1"
  exposedField  MFNode      viewpoints        [ ]
]
{
  Transform {
    bboxCenter       IS bboxCenter
    bboxSize         IS bboxSize
    center           IS center
    rotation         IS rotation
    scale            IS scale
    scaleOrientation IS scaleOrientation
    translation      IS translation
    children [
      Group {
        children IS viewpoints
      }
      Group {
        children IS humanoidBody 
      }
    ]
  }
}

bboxCenter Not used in OpenHRP.
bboxSize Not used in OpenHRP.
center Refer "center" of Joint node.
humanoidBody The field that child nodes hang to. 0 or more Joint nodes and 0 or 1 Segment node can be hanged.
info Contain comments related to the model.
joints Stores the list of defined Joints.
name Used to specify model name.
rotation Refer "rotation" of Joint node.
scale Refer "scale" of Joint node.
scaleOrientation Refer "scaleOrientation" of Joint node.
segments Stores the list of defined Segments.
sites Not used in OpenHRP.
translation Refer "translation" of Joint node.
version Used to specify version number of the model.
viewpoints specifies the aspect position in the virtual environment.

Only one Humanoid node that becomes the root node of the model can be exist. Moreover, all the Joint/Segment names that you used are enumerated in the joints/segments field of the Humanoid node.

Joint

The Joint node specifies the Link Structure.

PROTO Joint [
  exposedField     SFVec3f      center              0 0 0
  exposedField     MFNode       children            []
  exposedField     MFFloat      llimit              []
  exposedField     MFFloat      lvlimit             []
  exposedField     SFRotation   limitOrientation    0 0 1 0
  exposedField     SFString     name                ""
  exposedField     SFRotation   rotation            0 0 1 0
  exposedField     SFVec3f      scale               1 1 1
  exposedField     SFRotation   scaleOrientation    0 0 1 0
  exposedField     MFFloat      stiffness           [ 0 0 0 ]
  exposedField     SFVec3f      translation         0 0 0
  exposedField     MFFloat      ulimit              []
  exposedField     MFFloat      uvlimit             []
  exposedField     SFString     jointType           ""
  exposedField     SFInt32      jointId             -1
  exposedField     SFVec3f      jointAxis           0 0 1

  exposedField     SFFloat      gearRatio           1
  exposedField     SFFloat      rotorInertia        0
  exposedField     SFFloat      rotorResistor       0
  exposedField     SFFloat      torqueConst         1
  exposedField     SFFloat      encoderPulse        1
]
{
  Transform {
    center           IS center
    children         IS children
    rotation         IS rotation
    scale            IS scale
    scaleOrientation IS scaleOrientation
    translation      IS translation
  }
}

center Center position of joints' rotation axis.
Specify this, as an offset value relative to the origin of local coordinate system.
children Used to specify the child nodes.
A child node can be consist of number of Joint nodes and/or 1 Segment node.
llimit(1) Lower bound value of the Joint rotation angle[rad].
Dafault value : "-∞"
lvlimit(1) Lower bound value of the Joint rotation angular velocity[rad/s].
Dafault value : "-∞"
limitOrientation Not used in OpenHRP.
name Name of the Joint.
rotation Orientation of the local coordinate system.
Specify the offset value, relative to the parent node.
scale Allows to set scaling. When setting up scaling, keep the position specified in "center", as your scaling center.
scaleOrientation Used to specify the orientation of the coordinate system that uses for scaling.
(Does not matter, even if you skip defining this.)
stiffness Not used in OpenHRP.
translation Position of the local coordinate system.
Specify the offset value, relative to the parent node.
ulimit(1) Upper bound value of the Joint rotation angle[rad].
Dafault value : "+∞"
uvlimit(1) Upper bound value of the Joint rotation angular velocity[rad/s].
Dafault value : "+∞"
jointType Here you can specify the type of the Joint.
Your choices are: free / slide / rotate / fixed.
free
Allows to translate along and rotate around all 3 coordinate axes (6 degrees of freedom[DOF]).
Can be used only for root node.
rotate
Allows to rotate only around the coordinate axis specified in "jointAxis". (1 DOF)
slide
Allows translate only along the coordinate axis specified in "jointAxis". (1 DOF)
fixed
The joint is allowed no translation, no rotation. (0 DOF)
jointId Used to specify the ID number of the Joint.
"jointId" is used to specify the element's index number of an array, when storing attribute values such as joint-angle in the array format. When developing the controller of a robot, in most situations, joint-angle of the controllable joints can only be loaded or modified. Therefore we can say that jointid is assigned for such controllable joints. (However, it is not necessarily to be like that.) "JointId" must be assigned according to the following rules.
  • "JointId" must start from 0(zero).
  • "jointId" should be a continuous sequence of integers having no gaps(spaces) or duplicates.

Please note that the type of this field has been changed; SFFloat, the type used in previous version of OpenHRP, has been changed to SFInt32 type with OpenHRP version3.
jointAxis Used to specify the axis of the joint.
In the previous version of OpenHRP, the axis was specified by either of the character strings "X","Y" or "Z". But with OpenHRP3, users are allowed to specify an axis to an arbitrary direction, by using vectors.Although the old specification format is still supported, we recommand using vector specification from now on.
gearRatio Gear ratio;
If the deceleration ratio from the motor to the joint is 1/100, assign as 100.
gearEfficiency Deceleration efficiency of the gear;
If the efficiency is 60%, assign as 0.6 .
If this field has not specified, the deceleration efficiency will be assumed as 100%.
rotorInertia The Moment of Inertia of motor rotor [kgm^2]
rotorResistor Resistance of a motor coil[Ohm] -(Used with Controller)
torqueConst Torque constant [Nm/A] -(Used with Controller<)/td>
encoderPulse Encoder pulse count [pulse/rotate] -(Used with Controller)

(1) : These values are not used for simulation. These are for controller to read and control as appropriate not to go over the limits. Default value will be applied if not specified.

Joints are defined by using Joint Nodes. Joint Node contains information about the link frame. Child-Parent relationships of Joints, are applied to the Joint Nodes in same way. For instance, let`s consider a human arm; joints of a human arm exists in the order of "Shoulder > elbow > wrist". This can be represented by Joint Nodes as follows;

Arm Link Structure
Fig 1. Arm Link Structure


DEF shoulder Joint {
  children [
    DEF elbow Joint {
      children [
        DEF wrist Joint {
            :
            :
            :
      ]
    }
  ]
}

A Joint having n DOF (n≥2) means, that the Joint is composed of n number of Joints, that are sharing same origin. In this case, define n number of Joints, placing all Link Frames at common origin. For example, human elbow can be consider as a Joint having 2 DOF, as shown below.

An Elbow Link Structure
Fig 2. Elbow Link Structure


In this case, our Joints definition would be as follows.


DEF Elbow0 Joint {      //bending motion 
  children [
    DEF Elbow1 Joint {  //twisting motion

        :
        :
        :
    }
  ]
  translation 0 0 0  // Place all joints at origin
}

Segment

Segment node defines the Link shape.

PROTO Segment [
  field         SFVec3f   bboxCenter        0 0 0
  field         SFVec3f   bboxSize          -1 -1 -1
  exposedField  SFVec3f   centerOfMass      0 0 0
  exposedField  MFNode    children          [ ]
  exposedField  SFNode    coord             NULL
  exposedField  MFNode    displacers        [ ]
  exposedField  SFFloat   mass              0 
  exposedField  MFFloat   momentsOfInertia  [ 0 0 0 0 0 0 0 0 0 ]
  exposedField  SFString  name              ""
  eventIn       MFNode    addChildren
  eventIn       MFNode    removeChildren
]
{
  Group {
    addChildren    IS addChildren
    bboxCenter     IS bboxCenter
    bboxSize       IS bboxSize
    children       IS children
    removeChildren IS removeChildren
  }
}

bboxCenter Not used in OpenHRP.
bboxSize Not used in OpenHRP.
centerOfMass Coordinates of the Center-of-Gravity
children Used to specify Child Nodes. Add here the nodes that define the shape.
coord Not used in OpenHRP.
displacers Not used in OpenHRP.
mass Mass of the Segment.
momentsOfInertia Moment-of-Inertia of the Segment.
name Name of the Segment.
addChildren Not used in OpenHRP.
removeChildren Not used in OpenHRP.

Link Configuration is defined in the Segment Node. Two or more Segment nodes can be set up as a child node of a Joint node.It can also be described as a child node of a Transform node.


DEF JOINT1 Joint {
  children [
    DEF SEGMENT1 Segment {
      children [
          :
      ]
    }
    Transform {
      translation 0 0 0.5
      rotation 1 0 0 1.57
      children DEF SEGMENT2 Segment {
        children [
          :
        ]
      }
    }
  ]
}

For instance, let`s say you want to define the configuration of a human arm from shoulder to elbow. And since this configuration belongs to the shoulder link frame(parent node), the Link structure can be defined as follows;

Link Configuration from Shoulder to Elbow
Fig 3. Link Configuration from Shoulder to Elbow


DEF Shoulder Joint {
  children [
    DEF Shoulder2Elbow Segment {
      children [
        :
        :    <- Specify the actual link shape
        :
      ]
    }
    DEF Elbow Joint {
        :
        :
        :
    }
  ]
}

Parameters that define link characteristics, should be defined under the children field of the Segment node. To define these parameter values, we recommend you to use a modeling tool. However, simple shapes can be edit even manually, by using text editor.

ExtraJoint

ExtraJoint node defines closed link mechanism. Constraint force is generated so that two links may not separate, noting that one joint of a closed link is connected with ball joint.

PROTO ExtraJoint [
  exposedField SFString link1Name 	""
  exposedField SFString link2Name 	""
  exposedField SFVec3f  link1LocalPos 	0 0 0
  exposedField SFVec3f  link2LocalPos 	0 0 0
  exposedField SFString jointType 	"xyz"
  exposedField SFVec3f  jointAxis 	1 0 0
]
{
}

link1NameName of the joint which has received ball joint
link2NameName of the joint to which ball joint is attached
link1LocalPos Connection (joint) position in the local coordinate of the link1Name joint
link2LocalPos Connection (joint) position in the local coordinate of the link2Name joint
jointTypeThe number of constraint axes. xyz:three each other orthogonal axes. xy: two orthogonal axes to the axis specified by jointAxis. z:one axis specified by jointAxis.
jointAxisA unit vector is specified by the local coordinate of the link1Name joint. The meaning of a vector changes by specification of jointType.

Since sample "closed-link-sample.wrl" of a closed link mechanism is in a sample model, please refer to it.

AccelerationSensor

AccelerationSensor node defines 3-axis acceleration sensor.

PROTO AccelerationSensor [
  exposedField SFVec3f    maxAcceleration -1 -1 -1
  exposedField SFVec3f    translation     0 0 0
  exposedField SFRotation rotation        0 0 1 0
  exposedField SFInt32    sensorId        -1
]
{
  Transform {
    translation IS translation
    rotation    IS rotation
  }
}

maxAcceleration Maximum acceleration that can be measured.
translation Specify the position of local coordinate system, by the offset value relative to the parent node coordinate system.
rotation Specify the orientation of local coordinate system, by the offset value relative to the parent node coordinate system.
sensorId Specify the sensor ID. SensorId is assigned for same kind of sonsors in a model in sequential order starting from '0'. Skipping or overlapping id numbers is not allowed. This ID is used to decide the order, when arranging data from same kind of sensors.

Various sensor nodes are placed under the Joint node in which the sensor is installed. For instance, when attaching an acceleration sensor to the WAIST of the sample model, it can be described as follows.


DEF WAIST Joint
{
     :
  children [
    DEF gsensor AccelerationSensor
    {
        :
    }
     :
  ]
}


GyroSensor

Gyro node defines a 3-axis angular velocity sensor.

PROTO Gyro [
  exposedField SFVec3f    maxAngularVelocity -1 -1 -1
  exposedField SFVec3f    translation        0 0 0
  exposedField SFRotation rotation           0 0 1 0
  exposedField SFInt32    sensorId           -1
]
{
  Transform {
    translation IS translation
    rotation    IS rotation
  }
}

maxAngularVelocity Maximum angular velocity that can be measured.
translation Specify the position of local coordinate system, by the offset value relative to the parent node coordinate system.
rotation Specify the orientation of local coordinate system, by the offset value relative to the parent node coordinate system.
sensorId Specify the sensor ID.

VisionSensor

The VisionSensor Node is used to define Vision sensors.

PROTO VisionSensor
[
  exposedField  SFVec3f     translation       0 0 0
  exposedField  SFRotation  rotation          0 0 1 0
  exposedField  SFFloat     fieldOfView       0.785398
  field         SFString    name              ""
  exposedField  SFFloat     frontClipDistance 0.01
  exposedField  SFFloat     backClipDistance  10.0
  exposedField  SFString    type              "NONE"
  exposedField  SFInt32     sensorId          -1
  exposedField  SFInt32     width             320
  exposedField  SFInt32     height            240
]
{
  Transform
  {
    translation IS translation
    rotation    IS rotation
  }
}

translation Specify the view point relative to the parent nodes' coordinate system.
rotation Specify the view angle relative to the parent nodes' coordinate system.
  • Forward viewing direction ..... Opposite direction of Z-axis (0,0,-1) in local oordinate system
  • Upper viewing direction ..... Direction of Y axis (0,1,0) in local oordinate system
The View Vector
fieldOfView Viewing angle of the camera in [rad]. Valid range is between 0 to pi.
name "Name" of the sensor.
frontClipDistance Distance from the Viewpoint to the front-clip-surface.
backClipDistance Distance from the Viewpoint to the back-clip-surface.
type Specifies the types of information that can be acquired by sensor
"COLOR"
Outputs Color information
"DEPTH"
Outputs Depth information
"COLOR_DEPTH"
Outputs both Color and Depth information
"NONE"
Outputs no information
sensorId ID number of the sensor.
width Width of the image.
height Height of the image.
frameRate Image output rate of camera per second.

ForceSensor

The ForceSensor node is used to define force/torque sensor.

PROTO ForceSensor [  
  exposedField SFVec3f maxForce -1 -1 -1
  exposedField SFVec3f maxTorque -1 -1 -1
  exposedField SFVec3f translation 0 0 0
  exposedField SFRotation rotation 0 0 1 0
  exposedField SFInt32 sensorId -1
]
{
  Transform {
translation IS translation
    rotation IS rotation
  }
}

maxForce The maximum force that can be measured by sensor.
maxTorque The maximum torque that can be measured by sensor.
translation Position of the local coordinate system. Specify this, as an offset value relative to the parent nodes' coordinate system.
rotation Orientation of the local coordinate system. Specify this, as an offset value relative to the parent nodes' coordinate system.
sensorId The ID number of the sensor.

RangeSensor

RangeSensor is used to define distance sensor.

 PROTO RangeSensor [
   exposedField SFVec3f    translation       0 0 0
   exposedField SFRotation rotation          0 0 1 0
   exposedField MFNode     children          [ ]
   exposedField SFInt32    sensorId          -1
   exposedField SFFloat    scanAngle         3.14159 #[rad]
   exposedField SFFloat    scanStep          0.1     #[rad]
   exposedField SFFloat    scanRate          10      #[Hz]
   exposedField SFFloat    maxDistance	    10
 ]
 {
   Transform {
     rotation         IS rotation
     translation      IS translation
     children         IS children
   }
 }
translation Position of the sensor that correspond to the link which this sensor is attached
rotation Orientation of the sensor that correspond to the link which this sensor is attached. According to the sensors's coordinate system, opposite direction of Z-axis (0,0,-1) is the forward measuring direction and XZ is the measuring surface while scanning. Since this is identical to the VisionSensor, the position and orientation of a model that has been used in VisionSensor can also be used for RangeSensor as it is.
sensorId ID number of the RangeSensor installed in this robot
scanAngle Total angle that corresponds to measuring distance [rad].
scanStep Angle size that measures per step while scanning distance [rad]
scanRate Number of scans per second [Hz]
maxDistance Maximum distance that can be measured [m]