XML Syntax Documentation¤
Overview¤
This document describes the XML syntax used to define a physical system. The structure includes elements for defining bodies, joints, geometries, simulation parameters, and rendering properties.
Root Element¤
<x_xy name="example_model">
...
</x_xy>
name
(string, required): The name of the model.
Simulation Parameters¤
<options gravity="0 0 -9.81" dt="0.01" />
gravity
(x y z, optional): Global gravity vector.dt
(float, optional): Simulation time step.
Default Parameters for geom
and body
¤
Changes the default values. For example:
<defaults>
<geom mass="1.0"/>
</defaults>
mass
(float, optional): Default mass of geometries.
World Definition¤
<worldbody>
<body name="base" joint="free" pos="0 0 0">
...
</body>
</worldbody>
<worldbody>
: The root container for all bodies.<body>
: Defines a physical body.name
(string, required): Unique identifier for the body.joint
(string, required): Type of joint connecting to worldbody.pos
(x y z, optional): Position in world coordinates.- for more see section
Bodies
below
Geometry Definition and Rendering Properties¤
<geom type="box" mass="1" size="0.5 0.5 0.5" color="0.8 0.2 0.2" />
mass
(float, required): Mass of geometry.type
(string, required): Shape type (box
,sphere
,cylinder
,xyz
,capsule
).dim
(Vector of floats, required): Dimensions of the geometry. Its dimensionality depends on the type of the geometry.box
: length_x, length_y, length_zsphere
: radiuscylinder
: radius, heightxyz
: unit_vector_lengthcapsule
: radius, length
color
(rgb or string, optional): RGB color (normalised from 0 to 1) of the object or string identifier of a color such as green, blue, red, orange, ...pos
(x y z, optional): Position of geometry in coordinate system of surrouning body. Points to the center of mass of the geometry. Defaults to zeros.euler
(x y z, optional): Euler angles in degree. Orientation of geometry in coordinate system of surrouning body. Mutually exclusive with fieldquat
. Defaults to zeros.quat
(u x y z, optional): Orientation of geometry in coordinate system of surrouning body. Mutually exclusive with fieldeuler
. Defaults to 1 0 0 0.
Bodies¤
<body name="hinge" joint="rx" pos="0 0 1" euler="90 0 0"/>
name
(string, required): Identifier for the body.joint
(string, required): Type of joint. Possible values:free
: 6D free jointcor
: 9D free joint, center of rotation also movesfree_2d
: 3D free joint (1D rotation + 2D translations)frozen
: 0D jointspherical
: 3D rotational jointpx
,py
,pz
(prismatic joints): 1D translational joints around x/y/zrx
,ry
,rz
(revolute joints): 1D rotational joints around x/y/zsaddle
: 2D rotational jointp3d
: 3D translational jointrr
(custom joint): 1D rotational joint with randomised joint axis directionrr_imp
(custom joint): 1D rotational joint with randomised joint axis direction that is not a perfect 1D joint; there is a small secondary rotation possiblersaddle
(custom joint): 2D rotational joint with randomised joint axes directions
pos
(x y z, optional): Position relative to parent body. Defaults to zeros.euler
(x y z, optional): Euler angles in degree. Orientation relative to parent body. Mutually exclusive with fieldquat
. Defaults to zeros.quat
(u x y z, optional): Orientation relative to parent body. Mutually exclusive with fieldeuler
. Defaults to 1 0 0 0.pos_min
(x y z, optional): Lower bound for randomization of thepos
value. Defaults to zeros.pos_max
(x y z, optional): Upper bound for randomization of thepos
value. Defaults to zeros.damping
(Vector of floats, optional): Damping of the joint. It's dimensionality depends on theqd
size of the joint type. So for a 1D joint, this is a single float, for a 3D joint it is three floats. Defaults to zeros.armature
(Vector of floats, optional): Armature of the joint. It's dimensionality depends on theqd
size of the joint type. So for a 1D joint, this is a single float, for a 3D joint it is three floats. Defaults to zeros.spring_stiff
(Vector of floats, optional): Spring stiffness of the joint. It's dimensionality depends on theqd
size. Defaults to zeros.spring_zero
(Vector of floats, optional): Zero point for the spring force of the joint. It's dimensionality depends on theq
size of the joint type. Defaults to 1 0 0 0 forspherical
,cor
, andfree
, and to zeros else.
Example Model¤
<x_xy model="inv_pendulum">
<options gravity="0 0 9.81" dt="0.01"/>
<defaults>
<geom color="white"/>
</defaults>
<worldbody>
<body name="cart" joint="px" damping="0.01">
<geom type="box" mass="1" dim="0.4 0.1 0.1"/>
<body name="pendulum" joint="ry" euler="0 -90 0" damping="0.01">
<geom type="box" mass="0.5" pos="0.5 0 0" dim="1 0.1 0.1"/>
</body>
</body>
</worldbody>
</x_xy>