Geometric Modelling in OpenRAVE: Difference between revisions

From ISRWiki
Jump to navigation Jump to search
No edit summary
 
(16 intermediate revisions by the same user not shown)
Line 111: Line 111:
    </Body>
    </Body>
  </KinBody>
  </KinBody>
As can be seen in the example, within the block '''<Geom>''', you have to define the following parameters:
'''<Geom type="type"'''>, where "''type''" can be "'''sphere'''", "'''cylinder'''", "'''box'''"
'''<diffuseColor>''', declares the color that will have the geometry. The colors are encoded in RGB percentage, ie, R, G, B, can only take real values between 0 & 1. for a list of colors, can be check the following site: [http://en.wikipedia.org/wiki/X11_color_names#Color_names RGB Color Codes]
'''<transparency>''', solids can also have a percentage of transparency, and this is given by real values between 0 & 1, where 0 is the object completely opaque, & 1 is the object completely transparent.
In order to display this object and if you have installed the VisLab Edition, just type in the terminal the following:
openrave Vislab/OR1_Objects/red_ball.kinbody.xml
=== Cylinder ===
The cylinder is defined by two parameters, Radio and Height. As the Sphere, and as we shall see later, the cylinder & the cuboid can also be described by general parameters such as color and transparency. Below there is an example of how to declare the construction of a cylinder.
<KinBody name="Green_Cylinder">
<!--   GREEN CYLINDER, Cylinder Shape
    Circle face in plane X,Z
    Extruded in Y Axis
    Measurements: r=0.04 m , h=0.06 m
    Origin of Reference Frame: [0, 0, h/2]
    openrave Desktop/green_cylinder.kinbody.xml
    -->
  <Body name="cilindro" type="dynamic">
    <!--  -->   
    <translation>0 0 0</translation>
    <rotationaxis>1 0 0 0</rotationaxis>
    <!--  -->
    <Geom type="cylinder">
    <!--Cylinder Shape
    Circle face in plane X,Z
    Extruded in Y Axis - Default -
    Measurements: r=0.04 m , h=0.06 m
    Origin of Reference Frame: [0, 0, h/2] -->
      <translation>0 0 0</translation>
      <rotationaxis>1 0 0 0</rotationaxis>
      <radius>0.04</radius>
      <height>0.06</height>
      <diffuseColor>0 1 0</diffuseColor>
      <transparency>0</transparency>
    </Geom>
    <!--  -->
  </Body>
</KinBody>
As can be seen in the example, within the block '''<Geom>''', you have to define the next parameters:
<Geom Type="type">, where "type" can be "sphere", "cylinder", "box"
'''<radius>''' & '''<height>''' are the parameters that describe the cylinder. In describing these parameters, one need only keep in mind that the cylinder is extruded by definition always on the Y axis. This extrusion can be modified by applying a rotation, either in X, Z, or some combination of both. We shall see later how to apply this rotations.
'''<translation>'''. Now a new element appears. Translation is an xyz vector of real values and their units are defined in meters. Translation is used to perform a translation of the solid in the direction specified by the vector [x y z]. The result of doing this is that the origin of the Reference System of the object, is changed. This can be seen as if the new frame of reference [-x -y -z]. This is explained in the following figure.
'''A MISSING FIGURE HERE!!!!'''
This is very useful, since for example, we often like to have the origin at the center of the lower base of the object and not the center of mass (centroid), for example, when we wish to place on a plane
as a table, or floor, etc ...
'''A MISSING FIGURE HERE!!!!'''
If <translation> is declared as [0 0 0], then there will be no change of the origin of the reference frame of the object. therefore remain the default, being this the centroid, where the radius = 0 and in the middle of its height.
'''<rotationaxis>''' Allows you to change the orientation of the object relative to its centroid. <rotationaxis> is a vector of the form [x, y, z, theta°], which a rotation vector is defined for the axis of rotation, and an angle (in degrees) of such rotation. You can make several rotations followed each other, writing each line for each rotation, or it can described a rotation matrix (matrix resulting from rotations of Euler angles).
[[Image:Euler angles.gif]]
An example of three rotations..: 1) R(x,90°) --> 2) R(y,45°) --> 3) R(z,45°) ...:
      <rotationaxis>1 0 0 90</rotationaxis>
      <rotationaxis>0 1 0 45</rotationaxis>
      <rotationaxis>0 0 1 45</rotationaxis>
... or, using the rotation matrix, where T = R(z,45°)R(y,45°)R(x,90°)...
<rotationmat>t11 a12 t13 t21 t22 t23 t31 t32 t33</rotationmat> ...:
      <rotationmat>0.5 0.5 0.7 0.5 0.5 -0.7 -0.7 0.7 0</rotationmat>
In order to display this object and if you have installed the VisLab Edition, just type in the terminal the following:
openrave Vislab/OR1_Objects/green_cylinder.kinbody.xml
=== Cuboid ===
The cuboid, or rectangular prism, is defined by three parameters, x, y, z. Although this is mathematically well in OpenRAVE, the construction of this solid should be declared as follows: [x/2 y/2 z/2].
Below there is an example of how to declare the construction of a cuboid in OpenRAVE and after that, the explanation of each element of the block is given.
<KinBody name="Blue_Cuboid">
  <Body name="Cuboid" type="dynamic">
    <translation>0 0 0</translation>
    <rotationaxis>1 0 0 0</rotationaxis>
<!-- comment -->
    <Geom type="box">
      <translation>0 0 0.039</translation>
      <rotationaxis>1 0 0 0</rotationaxis>
      <extents>0.0195 0.0195 0.039</extents>
      <diffuseColor>0 0 1</diffuseColor>
      <transparency>0</transparency>
    </Geom>
<!-- comment -->
  </Body>
</KinBody>
As can be seen in the example, within the block <Geom>, you have to define the extents parameter within the <Geom> block:
'''<extents>''' serves to declare the dimensions of the cuboid, where the parameters are <extents>x/2 y/2 z/2</extents>
As well as the sphere and cylinder, are also attributable '''color''', '''transparency''', '''rotation''' and '''translation'''.
In order to display this object and if you have installed the VisLab Edition, just type in the terminal the following:
openrave Vislab/OR1_Objects/blue_cuboid.kinbody.xml
with this we have learned how to describe elemental shaped objects in OpenRAVE. Now, let's move to see more modelling stuff.
== Composition of simple geometries ==
An example is the following..:
<KinBody name="table">
  <Body name="mesa" type="dynamic">
    <translation>0 0 0</translation>
    <rotationaxis>0 0 1 0</rotationaxis>
  <!-- comment -->
    <Geom type="cylinder">
      <translation>0.25 0.55 0.35</translation>
      <rotationaxis>1 0 0 90</rotationaxis>
      <radius>0.025</radius>
      <height>0.70</height>
      <diffuseColor>0.9 0.9 0.9</diffuseColor>
    </Geom>
  <!-- comment -->
    <Geom type="cylinder">
      <translation>-0.25 0.55 0.35</translation>
      <rotationaxis>1 0 0 90</rotationaxis>
      <radius>0.025</radius>
      <height>0.70</height>
      <diffuseColor>0.9 0.9 0.9</diffuseColor>
    </Geom>
  <!-- comment -->
    <Geom type="cylinder">
      <translation>-0.25 -0.55 0.35</translation>
      <rotationaxis>1 0 0 90</rotationaxis>
      <radius>0.025</radius>
      <height>0.70</height>
      <diffuseColor>0.9 0.9 0.9</diffuseColor>
    </Geom>
  <!-- comment -->
    <Geom type="cylinder">
      <translation>0.25 -0.55 0.35</translation>
      <rotationaxis>1 0 0 90</rotationaxis>
      <radius>0.025</radius>
      <height>0.70</height>
      <diffuseColor>0.9 0.9 0.9</diffuseColor>
    </Geom>
  <!-- comment -->
    <Geom type="box">
        <translation>0 0 0.725</translation>
        <extents>0.3 0.6 0.025</extents>
        <diffuseColor>0 0 0</diffuseColor>
    </Geom>
  <!-- comment --> 
  </Body>
</KinBody>
== Objects with complex geometries ==
An example is this..:
<KinBody name="mug">
<!-- comment --> 
    <RotationAxis>1 0 0 90</RotationAxis> 
<!-- comment --> 
  <Body type="dynamic">
<!-- comment -->
    <Geom type="trimesh">
      <Data>models/objects/blue_mug_y_up.iv</Data>
      <Render>models/objects/blue_mug_y_up.iv</Render>
    </Geom>     
<!-- comment -->
  </Body>
<!-- comment -->
</KinBody>
= Mechanisms Modelling =
When modelling, we distinguish three kind of mechanisms:
# Hinge Mechanisms (Revoluta)
# Displacement Mechanisms
# Universal  Mechanisms
<KinBody name="Baltazar_Body">
<!-- comment -->
  <Body name="Base" type="dynamic">
    <translation>0 0 0</translation>
    <rotationaxis>1 0 0 0</rotationaxis>
    <Geom type="box">
        <translation>0 0 0</translation>
        <rotationaxis>1 0 0 0</rotationaxis>
        <extents>0.075 0.075 0.10</extents>
        <diffuseColor>0 0 1</diffuseColor>
        <transparency>0.1</transparency>
    </Geom>
  </Body>
<!-- comment -->
  <Body name="Pecho" type="dynamic">
  <!--BASE, box shaped - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  Largest axis in Z -->
    <translation>0 0 0</translation>
    <rotationaxis>1 0 0 0</rotationaxis>
    <Geom type="box">
        <translation>0 0 0.22</translation>
        <rotationaxis>1 0 0 0</rotationaxis>
        <extents>0.13 0.08 0.12</extents>
        <diffuseColor>0 0 1</diffuseColor>
        <transparency>0.1</transparency>
    </Geom>
    <Geom type="box">
<!-- box
Largest axis in Z
Measurements: x=0.35 m, y=0.16 m, z=0.24 m
      Origin of Reference Frame: [0, 0, 0] <<base>> -->
        <translation>0 0 0.46</translation>
        <rotationaxis>1 0 0 0</rotationaxis>
        <extents>0.175 0.08 0.12</extents>
        <diffuseColor>0 0 1</diffuseColor>
        <transparency>0.1</transparency>
    </Geom>
  </Body>
<!-- comment --> 
  <Joint type="hinge" name="q1">
  <!-- q1    ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
Revoluta en Z Axis
Range: -90° to 80° -->
  <Body>Base</Body>
    <Body>Pecho</Body>
    <offsetfrom>Pecho</offsetfrom>
    <weight>0</weight>
    <limitsdeg>-90 80</limitsdeg>
    <axis>0 0 1</axis>
    <anchor>0 0 0</anchor>
    <maxvel>0.5</maxvel>
    <resolution>0.5</resolution>
  </Joint>
<!-- comment --> 
  <Body name="Hombro" type="dynamic">
<!--BASE, box shaped - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Largest axis in Z-->
    <translation>-0.235 0 0.52</translation>
    <rotationaxis>1 0 0 0</rotationaxis>
    <Geom type="box">
<!-- box
Largest axis in Z
Measurements: x=0.12 m, y=0.06 m, z=0.09 m
    Origin of Reference Frame: [0, 0, 0] <<base>> -->
        <translation>0 0 </translation>
        <rotationaxis>1 0 0 90</rotationaxis>
        <extents>0.06 0.03 0.045</extents>
        <diffuseColor>0 0 1</diffuseColor>
        <transparency>0.1</transparency>
    </Geom>
  </Body>
<!-- comment --> 
  <Joint type="hinge" name="q2">
  <!-- q2    ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° 
Revoluta en X Axis
Range: -90° to 80° -->
  <Body>Pecho</Body>
    <Body>Hombro</Body>
    <offsetfrom>Hombro</offsetfrom>
    <weight>0</weight>
    <limitsdeg>-90 80</limitsdeg>
    <axis>1 0 0</axis>
    <anchor>0 0 0</anchor>
    <maxvel>0.5</maxvel>
    <resolution>0.5</resolution>
  </Joint>
<!-- comment --> 
  <Body name="Ante_Brazo" type="dynamic">
<!--BASE, box shaped - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Largest axis in Z-->
    <translation>-0.295 0 0.52</translation>
    <rotationaxis>1 0 0 0</rotationaxis>
    <Geom type="cylinder">
    <!--Cylinder Shape
Circle face in plane Y,Z
Extruded in X Axis
Measurements: r=0.07 m , h=0.10 m -->
        <translation>0 0 0</translation>
        <rotationaxis>0 0 1 0</rotationaxis>
        <radius>0.035</radius>
        <height>0.10</height>
        <diffuseColor>0.28 0.24 0.55</diffuseColor>
        <transparency>0</transparency>
    </Geom>
<Geom type="box">
<!-- box
Largest axis in Z
Measurements: x=0.06 m, y=0.09 m, z=0.25 m
    Origin of Reference Frame: [0, 0, 0] <<base>> -->
        <translation>0 0 -0.125</translation>
        <rotationaxis>1 0 0 0</rotationaxis>
        <extents>0.03 0.045 0.125</extents>
        <diffuseColor>0 0 1</diffuseColor>
        <transparency>0.1</transparency>
    </Geom>
  </Body>
<!-- comment -->
  <Joint type="hinge" name="q3">
  <!-- q3    ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° 
Revoluta en Y Axis
Range: -90° to 80° -->
  <Body>Hombro</Body>
    <Body>Ante_Brazo</Body>
    <offsetfrom>Ante_Brazo</offsetfrom>
    <weight>0</weight>
    <limitsdeg>-90 80</limitsdeg>
    <axis>0 1 0</axis>
    <anchor>0 0 0</anchor>
    <maxvel>0.5</maxvel>
    <resolution>0.5</resolution>
  </Joint>
<!-- comment --> 
  <Body name="Brazo" type="dynamic">
<!--BASE, box shaped - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Largest axis in Z-->
    <translation>-0.295 0 0.27</translation>
    <rotationaxis>1 0 0 0</rotationaxis>
    <Geom type="cylinder">
    <!--Cylinder Shape
Circle face in plane Y,Z
Extruded in X Axis
Measurements: r=0.07 m , h=0.10 m -->
        <translation>0 0 0</translation>
        <rotationaxis>0 0 1 90</rotationaxis>
        <radius>0.0465</radius>
        <height>0.07</height>
        <diffuseColor>0.28 0.24 0.55</diffuseColor>
        <transparency>0</transparency>
    </Geom>
<Geom type="box">
<!-- box
Largest axis in Z
Measurements: x=0.06 m, y=0.09 m, z=0.30 m
      Origin of Reference Frame: [0, 0, 0] <<base>> -->
        <translation>0 0 -0.15</translation>
        <rotationaxis>1 0 0 0</rotationaxis>
        <extents>0.03 0.045 0.15</extents>
        <diffuseColor>0 0 1</diffuseColor>
        <transparency>0.1</transparency>
      </Geom>
  </Body>
<!-- comment --> 
  <Joint type="hinge" name="q4">
  <!-- q4    ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
Revoluta en X Axis
Range: -90° to 80° -->
  <Body>Ante_Brazo</Body>
    <Body>Brazo</Body>
    <offsetfrom>Brazo</offsetfrom>
    <weight>0</weight>
    <limitsdeg>-90 80</limitsdeg>
    <axis>1 0 0</axis>
    <anchor>0 0 0</anchor>
    <maxvel>0.5</maxvel>
    <resolution>0.5</resolution>
  </Joint>
<!-- comment -->   
</KinBody>
= Robots Modelling =
An example of a Robot build by an already existing mechanism
<Robot name="Baltazar_Robot">
  <!--
  This is the Baltazar Robot
  openrave Vislab/OR3_Robots/Baltazar.robot.xml
  -->
  <KinBody file="Vislab/OR3_Robots/Baltazar.kinbody.xml"/>
  <!-- Specifying the manipulator structure-->
  <Manipulator name="Baltazar_Arm">
    <base>Base</base>          <!-- base link-->
    <effector>Palm</effector>  <!-- last link where end effector is attached-->
    <Translation>0 0 0</Translation>
    <armjoints>q1 q2 q3 q4 q6</armjoints> <!-- the joints composing of the arm, n joint names-->
    <!-- the id of the inverse kinematics solver, it is not necessary to-->
    <!-- GRIPPER -->
    <joints>q11 q12 q13 q21 q22 q23 q51 q52 q53</joints>      <!-- the gripper k joints used for contact-->
    <closingdirection>1 1 1 1 1 1 1 1 1</closingdirection> <!-- k floats -->
    <palmdirection>0 0 -1</palmdirection> <!-- 3 floats -->
    <!-- grasp goal with respect to the effector-->
  </Manipulator>
</Robot>
= Environments Modelling =
an example of describing an Environment..:
<Environment>
  <camtrans>-0.7 -3 0.8</camtrans>
  <camrotaxis>1 0 0 90</camrotaxis>
  <KinBody name="Piso" file="Vislab/OR1_Objects/Piso_Vislab.kinbody.xml">
    <Translation>0 0 0</Translation>
    <rotationaxis>0 0 1 0</rotationaxis>
  </KinBody>
  <KinBody name="Mesa" file="Vislab/OR1_Objects/mesa_01.kinbody.xml">
    <Translation>-1.1 0 0</Translation>
    <rotationaxis>0 0 1 0</rotationaxis>
  </KinBody>
  <KinBody name="green_cylinder" file="Vislab/OR1_Objects/green_cylinder.kinbody.xml">
    <Translation>-0.95 0.3 0.75</Translation>
    <rotationaxis>0 0 1 40</rotationaxis>
  </KinBody>
  <KinBody name="blue_cuboid" file="Vislab/OR1_Objects/blue_cuboid.kinbody.xml">
    <Translation>-1.25 0.3 0.75</Translation>
    <rotationaxis>0 0 1 20</rotationaxis>
  </KinBody>
  <KinBody name="Blue_Mog" file="Vislab/OR1_Objects/blue_mug.kinbody.xml">
    <Translation>-1.25 -0.3 0.75</Translation>
    <rotationaxis>0 0 1 0</rotationaxis>
  </KinBody>
  <KinBody name="red_ball" file="Vislab/OR1_Objects/red_ball.kinbody.xml">
    <Translation>-0.95 -0.3 0.75</Translation>
    <rotationaxis>0 0 1 0</rotationaxis>
  </KinBody>
  <KinBody name="Baltazar" file="Vislab/OR2_Mechanisms/Baltazar.kinbody.xml">
    <Translation>-0.5 0 0.5</Translation>
    <rotationaxis>0 0 1 -90</rotationaxis>
  </KinBody>
</Environment>

Latest revision as of 15:02, 20 January 2011

When experimenting with simulations in OpenRAVE, mainly we have the following stages:

  1. Geometric Modelling. Here is where you create your enviroment (scenario), and create the Robots and the objects.
  2. Knowledge base generation. When Rosen Diankov created OpenRAVE, he designed its structure in such a way that there were some modules (plug-ins) that automatically generate some databases in off-line mode. Some examples of these data bases, are the inverse kinematics, the grasping plug-in, reachability and inverse reachability computation, detectability and others. More about the knowledge base generation will be discused in other section.
  3. Scripting. Of course, if we want to run some special simulation, we have to code it. This can be done in Python language, in Matlab Scripts, in Octave Scripts, or ultimately in C++.
  4. Interfacing Simulations. We also want to try our experiments in real Robots, and to do so, we can interface our simulation environment with the Robots. This is done with ROS.

In this section of the tutorial, we will focus on the Geometric Modelling.

Models Classification

In OpenRAVE, geometric models are xml files that describe the geometry, and configuration of objects in the simulations. We distinguish four four kind of models:

  1. Objects. These are the simpler elements of an environment. my_object.kinbody.xml
  2. Mechanisms. These are also objects, but the special characteristic, is that they have relative movements between links, specially if they are open-chain mechanisms. my_mechanism.kinbody.xml
  3. Robots. These are special xml files, and their internal structure is conformed by one or several mechanisms. They also describe which links are active when computing manipulation tasks. my_robot.robot.xml
  4. Environments. These xml files hold the entire description of how the 3D world is structured. They load the objects, and robots that will play a roll in the simulation. my_environment.env.xml

Is very inportant for you to know that, if the model that you want to use already exists in the library, you don't have to model it again, just use the existing one. So, where are the models? ...In OpenRAVE we have three main directories were the models are allocated.

  • /usr/local/share/openrve/data/
  • /usr/local/share/openrve/robots/
  • /usr/local/share/openrve/models/

In the first and in the second directories, you will find mixed models of objects, robots and environments, and in the third, you just will find geometric description files with extension *.wrl (VRML 97) and *.iv (Open Inventor).

If you are using the VisLab Edition, then you will also have the extra directory:

  • /usr/local/share/openrve/Vislab/

There, you will find the models of the typical objects and the robots that are used at the VisLab, like Baltazar, Chico, Wizzy, and some toys.


Objects Modelling

We distinguish three kind of object modelling:

  1. Elemental geometric shaped objects
  2. Composition of simple geometries
  3. Objects with complex geometries

first we will discuss how simple geometries are described in xml files, then, we will show how to build up an object with the addition of these elemental geometries, and finally, we will show how to make use of existing geometric models from CAD files, such as VRML, 3DStudio, Open Inventor and so on.

In this section, the main objective is that you learn how descriptions are done in the xml files. Although you probably will directly use the already available objects in the library, this part of the tutorial will be enough for you to know how to create your own models. Let's get start with the elemental Geometric shaped objects!!.


Elemental Geometric shaped objects

In OpenRAVE shapes can be edited manually. To do this, the description of objects can be three of the next elemental geometries:

  • Sphere
  • Cylinder
  • Cuboid

Additionally, we have to describe, for each of these geometries, the next parameters:

  • Static or dynamic
  • Initial position
  • Initial orientation
  • color
  • transparency

As static objects, they have, for example, walls, floor, etc. As dynamic objects, you have all the objects that can move & they are subject to gravity, such as: tables, doors, etc.. Let's see the general structure of an elemental geometry object.

<KinBody name="my_object_name">
    <Body name="my_body_name" type="dynamic">
    
        <Geom type="cylinder">
        
        ........
        </Geom>
    </Body>
</KinBody>

In this example, we can distinguish three blocks of declaration:

  • <Kinbody> ... </ Kinbody>
  • <Body> ... </ Body>
  • <Geom> .. </ Geom>

For the moment, Ignore Kinbody & Body blocks, which are explained later.

<Geom> serves to establish the existence of a geometric figure, a solid within the simulation space. When you declare a string <Geom> in OpenRAVE, the physics of Collision Engines & checkers, use this information to carry out simulations of collisions between objects.

The following examples explain the construction of the three basic solids that can be created OpenRAVE manually. (Sphere, cylinder, cuboid)


Sphere

The sphere is the simplest solid that can be built in OpenRAVE (manually) since this geometry is defined by a single parameter: Radio. Below there is an example of how to declare the construction of a sphere in OpenRAVE and after that is the explanation of each element of the block is given.

<KinBody name="Red_Ball">
  <Body name="Sphera" type="dynamic">
  
    <Geom type="sphere">
    	  
      	<radius>0.08</radius>
      	<diffuseColor>1 0 0</diffuseColor>
      	<transparency>0</transparency>
    </Geom>
  </Body>
</KinBody>

As can be seen in the example, within the block <Geom>, you have to define the following parameters:

<Geom type="type">, where "type" can be "sphere", "cylinder", "box"

<diffuseColor>, declares the color that will have the geometry. The colors are encoded in RGB percentage, ie, R, G, B, can only take real values between 0 & 1. for a list of colors, can be check the following site: RGB Color Codes

<transparency>, solids can also have a percentage of transparency, and this is given by real values between 0 & 1, where 0 is the object completely opaque, & 1 is the object completely transparent.

In order to display this object and if you have installed the VisLab Edition, just type in the terminal the following:

openrave Vislab/OR1_Objects/red_ball.kinbody.xml


Cylinder

The cylinder is defined by two parameters, Radio and Height. As the Sphere, and as we shall see later, the cylinder & the cuboid can also be described by general parameters such as color and transparency. Below there is an example of how to declare the construction of a cylinder.


<KinBody name="Green_Cylinder">
  <Body name="cilindro" type="dynamic">
        
    <translation>0 0 0</translation>
    <rotationaxis>1 0 0 0</rotationaxis>
    <Geom type="cylinder">
    
      <translation>0 0 0</translation>
      <rotationaxis>1 0 0 0</rotationaxis>
      <radius>0.04</radius>
      <height>0.06</height>
      <diffuseColor>0 1 0</diffuseColor>
      <transparency>0</transparency>
    </Geom>
  </Body>
</KinBody>

As can be seen in the example, within the block <Geom>, you have to define the next parameters:

<Geom Type="type">, where "type" can be "sphere", "cylinder", "box"

<radius> & <height> are the parameters that describe the cylinder. In describing these parameters, one need only keep in mind that the cylinder is extruded by definition always on the Y axis. This extrusion can be modified by applying a rotation, either in X, Z, or some combination of both. We shall see later how to apply this rotations.

<translation>. Now a new element appears. Translation is an xyz vector of real values and their units are defined in meters. Translation is used to perform a translation of the solid in the direction specified by the vector [x y z]. The result of doing this is that the origin of the Reference System of the object, is changed. This can be seen as if the new frame of reference [-x -y -z]. This is explained in the following figure.

A MISSING FIGURE HERE!!!!

This is very useful, since for example, we often like to have the origin at the center of the lower base of the object and not the center of mass (centroid), for example, when we wish to place on a plane as a table, or floor, etc ...

A MISSING FIGURE HERE!!!!

If <translation> is declared as [0 0 0], then there will be no change of the origin of the reference frame of the object. therefore remain the default, being this the centroid, where the radius = 0 and in the middle of its height.

<rotationaxis> Allows you to change the orientation of the object relative to its centroid. <rotationaxis> is a vector of the form [x, y, z, theta°], which a rotation vector is defined for the axis of rotation, and an angle (in degrees) of such rotation. You can make several rotations followed each other, writing each line for each rotation, or it can described a rotation matrix (matrix resulting from rotations of Euler angles).

An example of three rotations..: 1) R(x,90°) --> 2) R(y,45°) --> 3) R(z,45°) ...:

     <rotationaxis>1 0 0 90</rotationaxis>
     <rotationaxis>0 1 0 45</rotationaxis>
     <rotationaxis>0 0 1 45</rotationaxis>

... or, using the rotation matrix, where T = R(z,45°)R(y,45°)R(x,90°)... <rotationmat>t11 a12 t13 t21 t22 t23 t31 t32 t33</rotationmat> ...:

     <rotationmat>0.5 0.5 0.7 0.5 0.5 -0.7 -0.7 0.7 0</rotationmat>

In order to display this object and if you have installed the VisLab Edition, just type in the terminal the following:

openrave Vislab/OR1_Objects/green_cylinder.kinbody.xml


Cuboid

The cuboid, or rectangular prism, is defined by three parameters, x, y, z. Although this is mathematically well in OpenRAVE, the construction of this solid should be declared as follows: [x/2 y/2 z/2]. Below there is an example of how to declare the construction of a cuboid in OpenRAVE and after that, the explanation of each element of the block is given.

<KinBody name="Blue_Cuboid">
  <Body name="Cuboid" type="dynamic">
    <translation>0 0 0</translation>
    <rotationaxis>1 0 0 0</rotationaxis>
    <Geom type="box">
      <translation>0 0 0.039</translation>
      <rotationaxis>1 0 0 0</rotationaxis>
      <extents>0.0195 0.0195 0.039</extents>
      <diffuseColor>0 0 1</diffuseColor>
      <transparency>0</transparency>
    </Geom>
  </Body>
</KinBody>

As can be seen in the example, within the block <Geom>, you have to define the extents parameter within the <Geom> block:

<extents> serves to declare the dimensions of the cuboid, where the parameters are <extents>x/2 y/2 z/2</extents>

As well as the sphere and cylinder, are also attributable color, transparency, rotation and translation. In order to display this object and if you have installed the VisLab Edition, just type in the terminal the following:

openrave Vislab/OR1_Objects/blue_cuboid.kinbody.xml

with this we have learned how to describe elemental shaped objects in OpenRAVE. Now, let's move to see more modelling stuff.

Composition of simple geometries

An example is the following..:


<KinBody name="table">
  <Body name="mesa" type="dynamic">
   <translation>0 0 0</translation>
   <rotationaxis>0 0 1 0</rotationaxis>
    <Geom type="cylinder">
      <translation>0.25 0.55 0.35</translation>
      <rotationaxis>1 0 0 90</rotationaxis>
      <radius>0.025</radius>
      <height>0.70</height>
      <diffuseColor>0.9 0.9 0.9</diffuseColor>
    </Geom>
    <Geom type="cylinder">
      <translation>-0.25 0.55 0.35</translation>
      <rotationaxis>1 0 0 90</rotationaxis>
      <radius>0.025</radius>
      <height>0.70</height>
      <diffuseColor>0.9 0.9 0.9</diffuseColor>
    </Geom>
    <Geom type="cylinder">
      <translation>-0.25 -0.55 0.35</translation>
      <rotationaxis>1 0 0 90</rotationaxis>
      <radius>0.025</radius>
      <height>0.70</height>
      <diffuseColor>0.9 0.9 0.9</diffuseColor>
    </Geom>
    <Geom type="cylinder">
      <translation>0.25 -0.55 0.35</translation>
      <rotationaxis>1 0 0 90</rotationaxis>
      <radius>0.025</radius>
      <height>0.70</height>
      <diffuseColor>0.9 0.9 0.9</diffuseColor>
    </Geom>
    <Geom type="box">
       <translation>0 0 0.725</translation>
       <extents>0.3 0.6 0.025</extents>
       <diffuseColor>0 0 0</diffuseColor>
    </Geom>
  </Body>
</KinBody>

Objects with complex geometries

An example is this..:

<KinBody name="mug">
   <RotationAxis>1 0 0 90</RotationAxis>  
  <Body type="dynamic"> 
    <Geom type="trimesh">
      models/objects/blue_mug_y_up.iv
      <Render>models/objects/blue_mug_y_up.iv</Render>
    </Geom>      
  </Body>
</KinBody>

Mechanisms Modelling

When modelling, we distinguish three kind of mechanisms:

  1. Hinge Mechanisms (Revoluta)
  2. Displacement Mechanisms
  3. Universal Mechanisms


<KinBody name="Baltazar_Body">
  <Body name="Base" type="dynamic">
    <translation>0 0 0</translation>
    <rotationaxis>1 0 0 0</rotationaxis>
    <Geom type="box"> 
        <translation>0 0 0</translation>
        <rotationaxis>1 0 0 0</rotationaxis>
        <extents>0.075 0.075 0.10</extents>
        <diffuseColor>0 0 1</diffuseColor>
        <transparency>0.1</transparency>
    </Geom>
  </Body> 
  <Body name="Pecho" type="dynamic">
    <translation>0 0 0</translation>
    <rotationaxis>1 0 0 0</rotationaxis>
    <Geom type="box">
        <translation>0 0 0.22</translation>
        <rotationaxis>1 0 0 0</rotationaxis>
        <extents>0.13 0.08 0.12</extents>
        <diffuseColor>0 0 1</diffuseColor>
        <transparency>0.1</transparency>
    </Geom> 
    <Geom type="box">
        <translation>0 0 0.46</translation>
        <rotationaxis>1 0 0 0</rotationaxis>
        <extents>0.175 0.08 0.12</extents>
        <diffuseColor>0 0 1</diffuseColor>
        <transparency>0.1</transparency>
    </Geom>
  </Body>
  <Joint type="hinge" name="q1">
 	<Body>Base</Body>
    <Body>Pecho</Body>
    <offsetfrom>Pecho</offsetfrom>
    <weight>0</weight>
    <limitsdeg>-90 80</limitsdeg>
    <axis>0 0 1</axis>
    <anchor>0 0 0</anchor>
    <maxvel>0.5</maxvel>
    <resolution>0.5</resolution>
  </Joint>
  <Body name="Hombro" type="dynamic">
    <translation>-0.235 0 0.52</translation>
    <rotationaxis>1 0 0 0</rotationaxis>
    <Geom type="box">
        <translation>0 0 </translation>
        <rotationaxis>1 0 0 90</rotationaxis>
        <extents>0.06 0.03 0.045</extents>
        <diffuseColor>0 0 1</diffuseColor>
        <transparency>0.1</transparency>
    </Geom>
  </Body>
  <Joint type="hinge" name="q2">
 	<Body>Pecho</Body>
    <Body>Hombro</Body>
    <offsetfrom>Hombro</offsetfrom>
    <weight>0</weight>
    <limitsdeg>-90 80</limitsdeg>
    <axis>1 0 0</axis>
    <anchor>0 0 0</anchor>
    <maxvel>0.5</maxvel>
    <resolution>0.5</resolution>
  </Joint>
 <Body name="Ante_Brazo" type="dynamic">
    <translation>-0.295 0 0.52</translation>
    <rotationaxis>1 0 0 0</rotationaxis>
    <Geom type="cylinder">
        <translation>0 0 0</translation>
        <rotationaxis>0 0 1 0</rotationaxis>
        <radius>0.035</radius>
        <height>0.10</height>
        <diffuseColor>0.28 0.24 0.55</diffuseColor>
        <transparency>0</transparency>
    </Geom>
	<Geom type="box">
        <translation>0 0 -0.125</translation>
        <rotationaxis>1 0 0 0</rotationaxis>
        <extents>0.03 0.045 0.125</extents>
        <diffuseColor>0 0 1</diffuseColor>
        <transparency>0.1</transparency>
    </Geom>
 </Body>
  <Joint type="hinge" name="q3">
 	<Body>Hombro</Body>
    <Body>Ante_Brazo</Body>
    <offsetfrom>Ante_Brazo</offsetfrom>
    <weight>0</weight>
    <limitsdeg>-90 80</limitsdeg>
    <axis>0 1 0</axis>
    <anchor>0 0 0</anchor>
    <maxvel>0.5</maxvel>
    <resolution>0.5</resolution>
  </Joint>
 <Body name="Brazo" type="dynamic"> 
    <translation>-0.295 0 0.27</translation>
    <rotationaxis>1 0 0 0</rotationaxis>
    <Geom type="cylinder">
        <translation>0 0 0</translation>
        <rotationaxis>0 0 1 90</rotationaxis>
        <radius>0.0465</radius>
        <height>0.07</height>
        <diffuseColor>0.28 0.24 0.55</diffuseColor>
        <transparency>0</transparency>
    </Geom>
	<Geom type="box">
        <translation>0 0 -0.15</translation>
        <rotationaxis>1 0 0 0</rotationaxis>
        <extents>0.03 0.045 0.15</extents>
        <diffuseColor>0 0 1</diffuseColor>
        <transparency>0.1</transparency>
     </Geom>
 </Body>
  <Joint type="hinge" name="q4">
 	<Body>Ante_Brazo</Body>
    <Body>Brazo</Body>
    <offsetfrom>Brazo</offsetfrom>
    <weight>0</weight>
    <limitsdeg>-90 80</limitsdeg>
    <axis>1 0 0</axis>
    <anchor>0 0 0</anchor>
    <maxvel>0.5</maxvel>
    <resolution>0.5</resolution>
  </Joint>
</KinBody>

Robots Modelling

An example of a Robot build by an already existing mechanism


<Robot name="Baltazar_Robot">

  <KinBody file="Vislab/OR3_Robots/Baltazar.kinbody.xml"/> 
	
  <Manipulator name="Baltazar_Arm"> 
    <base>Base</base>           
    <effector>Palm</effector>   
    <Translation>0 0 0</Translation>
    <armjoints>q1 q2 q3 q4 q6</armjoints> 
    <joints>q11 q12 q13 q21 q22 q23 q51 q52 q53</joints>      
    <closingdirection>1 1 1 1 1 1 1 1 1</closingdirection> 
    <palmdirection>0 0 -1</palmdirection> 
  </Manipulator>
</Robot>

Environments Modelling

an example of describing an Environment..:

<Environment>
  <camtrans>-0.7 -3 0.8</camtrans>
  <camrotaxis>1 0 0 90</camrotaxis>
  <KinBody name="Piso" file="Vislab/OR1_Objects/Piso_Vislab.kinbody.xml">
    <Translation>0 0 0</Translation>
    <rotationaxis>0 0 1 0</rotationaxis>
  </KinBody>
  <KinBody name="Mesa" file="Vislab/OR1_Objects/mesa_01.kinbody.xml">
    <Translation>-1.1 0 0</Translation>
    <rotationaxis>0 0 1 0</rotationaxis>
  </KinBody>
  <KinBody name="green_cylinder" file="Vislab/OR1_Objects/green_cylinder.kinbody.xml">
    <Translation>-0.95 0.3 0.75</Translation>
    <rotationaxis>0 0 1 40</rotationaxis>
  </KinBody>
  <KinBody name="blue_cuboid" file="Vislab/OR1_Objects/blue_cuboid.kinbody.xml">
    <Translation>-1.25 0.3 0.75</Translation>
    <rotationaxis>0 0 1 20</rotationaxis>
  </KinBody>
  <KinBody name="Blue_Mog" file="Vislab/OR1_Objects/blue_mug.kinbody.xml">
    <Translation>-1.25 -0.3 0.75</Translation>
    <rotationaxis>0 0 1 0</rotationaxis>
  </KinBody>
  <KinBody name="red_ball" file="Vislab/OR1_Objects/red_ball.kinbody.xml">
    <Translation>-0.95 -0.3 0.75</Translation>
    <rotationaxis>0 0 1 0</rotationaxis>
  </KinBody>
  <KinBody name="Baltazar" file="Vislab/OR2_Mechanisms/Baltazar.kinbody.xml">
    <Translation>-0.5 0 0.5</Translation>
    <rotationaxis>0 0 1 -90</rotationaxis>
  </KinBody>
</Environment>