Skip to content
This repository has been archived by the owner on Nov 26, 2020. It is now read-only.

Configuration XML

donghokang edited this page Nov 27, 2019 · 32 revisions

You can create RaiSim world from configuration XML.

XML Schema

Note that in the following sections, bolds are required while italics are optional:

  • raisim
    • objectClass: Class for objects. can instantiate
    • visualClass: Class for visuals. can instantiate
    • world: RaiSim World model
      • params: Simulation parameters
      • objects: List of RaiSim object. These objects are governed by RaiSim physics.
    • visuals: List of "visual" objects that are objects for visualization-only purposes. These objects are not governed by RaiSim physics.

In XML, it is as follows:

<raisim>
    <!-- CLASS SPECIFICATION -->    
    <objectClass>
        <!-- Object classes: see "Object class" section -->
    </objectClass>
    <visualClass>
        <!-- Visual classes: see "Visual class" section -->
    </visualClass>

    <!-- SIMULATION SPECIFICATION -->
    <world>
        <params>
            <!-- Parameter: see "Parameter" section -->
        </params>
        <objects>
            <!-- Objects: see "Object" section -->
        </objects>
    </world>

    <!--VISUALS SPECIFICATION -->
    <visuals>
        <!-- Visuals -->
    </visuals>
</raisim>

Object class

An object class can instantiate RaiSim objects with identical specification. It is defined under raisim/objectClass. See the following XML example.

<raisim>
    <objectClass>
        <box className="SmallBox" xLength="0.5" yLength="0.2" zLength="0.1" mass="1"/>
        <box className="BigBox" xLength="1" yLength="0.4" zLength="0.2" mass="5"/>
    </objectClass>
    <world>
        <objects>
            <instance name="smallBox1" class="SmallBox">
                <pos x="-2" y="-2" z="5"/>
                <quat w="1" x="0" y="0" z="0"/>
            </instance>
            <instance name="smallBox2" class="SmallBox">
                <pos x="-2" y="2" z="5"/>
                <quat w="1" x="0" y="0" z="0"/>
            </instance>
            <instance name="bigBox1" class="BigBox">
                <pos x="2" y="-2" z="5"/>
                <quat w="1" x="0" y="0" z="0"/>
            </instance>
            <instance name="bigBox2" class="BigBox">
                <pos x="2" y="2" z="5"/>
                <quat w="1" x="0" y="0" z="0"/>
            </instance>
        </objects>
    </world>
</raisim>

The object class named "SmallBox" defines a box object with size (0.5 m, 0.2 m, 0.1 m) and mass 1kg while "BigBox" defines a box object with size (1 m, 0.4 m, 0.2 m) and mass 1kg while In raisim/world/objects, two instances of "SmallBox" class and another two instances of "BigBox" class are defined. Thus RaiSim creates two identical boxes with (0.5, 0.2, 0.1) and mass 1kg and two identical boxes with (1, 0.4, 0.2) and mass 5kg in the world.

The attributes of an object class are identical with attributes of an object, except object class has className attribute instead of "name" attribute.

The attributes of an object instance are as follows:

  • name
  • class
<instance name="bigBox1" class="BigBox">

Visual Class

A visual class can instantiate visual objects with identical specification. It is defined under raisim/visualClass.

The attributes of an visual class are identical with [attributes of a visual], except visual class has className attribute instead of "name" attribute.

The attributes of an visual instance are as follows:

  • name
  • class
<instance name="sphereMarker1" class="SphereMarker">

Parameter

  • gravity: Gravitational acceleration
    • x (float): X-axis component of gravity (m/s2)
    • y (float): Y-axis component of gravity (m/s2)
    • z (float): Z-axis component of gravity (m/s2)
    <gravity x="0" y="0" z="-9.81"/>
  • erp: Error reduction parameter
    • erp (float): Position-level erp
    • erp2 (float): Velocity-level erp
    <erp erp="0.1" erp2="0.1"/>

Object

An Object elements define RaiSim objects under raisim/world/objects.

The following xml example creates a sphere RaiSim object named "ball" with 0.5 m radius and 1 kg mass. The position of the "ball" is set to (-1, -1, 5) and the quaternion is set to (1, 0, 0, 0) i.e. identity.

<raisim>
    ...
    <world>
        <objects>
            <sphere name="ball" radius="0.5" mass="1">
                <pos x="-1" y="-1" z="5"/>
                <quat w="1" x="0" y="0" z="0"/>
            </sphere>
        </objects>
    </world>
    ...
</raisim>

Common attributes

  • name (string): Name of the object.
  • mass (float): Mass of the object
  • collisionGroup (int): Collision Group of the object.
  • collisionMask (int): Collision Mask of the object.

Common children elements

Element names and individual attributes

The followings are supported object element names and corresponding attributions:

  • ground: Infinite ground 2D plane
  • heightmap: Terrain heightmap
    • option1: From PNG file
      • centerX
      • centerY
      • xSize
      • ySize
      • heightScale
      • heightOffset
    • option2: Randomly sampled
      • centerX
      • centerY
      • xSize: (default: 10.0)
      • ySize: (default: 10.0)
      • heightScale: (default: 2.0)
      • xSamples (int): (default: 100)
      • ySamples (int): (default: 100)
      • fractalOctaves (int): (default: 5)
      • fractalLacunarity (float): (default: 2.0)
      • fractalGain (float): (default: 0.5)
  • sphere: Sphere object
    • radius (float): Radius of the sphere (m)
  • box: Box object
    • xLength (float): Length of the box in x-axis (m)
    • yLength (float): Length of the box in y-axis (m)
    • zLength (float): Length of the box in z-axis (m)
  • cylinder: Cylinder object
    • radius (float): Radius of the cylinder (m)
    • height (float): Height of the cylinder (m)
  • capsule: Capsule object
    • radius (float): Radius of the capsule (m)
    • height (float): Height of the capsule (including caps) (m)
  • mesh: Mesh object
    • fileName (string): File path of the mesh file.
    • inertia (float list): Inertia matrix in (Ixx Iyy Izz Ixy Ixz Iyz)
    • com (float list): Position of center of mass w.r.t body frame.
    • scale (float): Scale of mesh.
    <mesh name="bunny" fileName="bunny.obj" inertia="1 1 1 0 0 0" com="0 0 0" mass="1" scale="10"/>
  • as: Articulated system object
  • instance: Instance of an Object Class. See Object Class section.

Visual

An Visual elements define visual objects under raisim/visuals. Visual objects are not governed by RaiSim physics and only for visualization purpose. Once you create visual objects, the objects are added to RaiSimUnity scene.

The following xml example creates a box visual object named "boxmarker" with dimension (1 m, 1 m, 1 m). The position of the "ball" is set to (-1, -1, 5) and the quaternion is set to (1, 0, 0, 0) i.e. identity.

<raisim>
    ...
    <visuals>
        <box name="boxmarker" xLength="1" yLength="1"  zLength="1">
            <pos x="-1" y="1" z="5"/>
            <quat w="1" x="0" y="0" z="0"/>
        </box>
    </visuals>
    ...
</raisim>

Common attributes

  • name (string): Name of the object.
  • color (float list): Color of the object. (default: 1.0 1.0 1.0 1.0)
  • glow (bool): Glow effect on RaiSimUnity. (default: true)

Common children elements

Element names and individual attributes

  • sphere: Sphere visual
    • radius (float): Radius of the sphere (m)
  • box: Box visual
    • xLength (float): Length of the box in x-axis (m)
    • yLength (float): Length of the box in y-axis (m)
    • zLength (float): Length of the box in z-axis (m)
  • cylinder: Cylinder visual
    • radius (float): Radius of the cylinder (m)
    • height (float): Height of the cylinder (m)
  • capsule: Capsule visual
    • radius (float): Radius of the capsule (m)
    • height (float): Height of the capsule (including caps) (m)

Other elements

The following elements are commonly used.

  • pos: Position of the object/visual in world frame
    • x (float): X-coordinate in world frame (m)
    • y (float): Y-coordinate in world frame (m)
    • z (float): Z-coordinate in world frame (m)
  • quat: Quaternion of the object/visual w.r.t world frame
    • w (float)
    • x (float)
    • y (float)
    • z (float)

Examples

Heightmap

<raisim>
    <world>
        <objects>
            <heightmap name="ground" centerX="0" centerY="0" xSize="20" ySize="20" heightScale="3"
                       xSamples="50" ySamples="50" fractalOctaves="3" fractalLacunarity="2" fractalGain="0.25"/>
            <as name="anymal" urdfPath="/home/donghok/Workspace/unity/raisimUnity/Assets/Resources/objects/Resources/anymal/anymal.urdf">
                <state qpos="0 0 2 1.0 0.0 0.0 0.0 0.03 0.4 -0.8 -0.03 0.4 -0.8 0.03 -0.4 0.8 -0.03 -0.4 0.8"
                       qvel="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"/>
            </as>
            <sphere name="ball" radius="0.5" mass="1" material="default" collisionGroup="1" collisionMask="-1">
                <pos x="-1" y="-1" z="5"/>
                <quat w="1" x="0" y="0" z="0"/>
            </sphere>
            <box name="box" xLength="1" yLength="1" zLength="1" mass="1">
                <pos x="-1" y="1" z="5"/>
                <quat w="1" x="0" y="0" z="0"/>
            </box>
            <cylinder name="cylinder" radius="0.5" height="0.5" mass="1">
                <pos x="1" y="-1" z="5"/>
                <quat w="1" x="0" y="0" z="0"/>
            </cylinder>
            <capsule name="capsule" radius="0.5" height="1" mass="1">
                <pos x="1" y="1" z="5"/>
                <quat w="1" x="0" y="0" z="0"/>
            </capsule>
        </objects>
    </world>
</raisim>