Robotics StackExchange | Archived questions

Import .dae Gazebo-1.0.0-RC2

Hello, I know there are more threads like here: http://answers.ros.org/question/11013/importing-collada-meshes-into-a-gazebo-world or http://answers.ros.org/question/1862/gazebo-world-file-from-a-collada-file or http://answers.ros.org/question/2914/create-rough-terrain-for-used-in-gazebo

but my problem is the next:

I have a few models in collada with their images in the follow distribution (for example):

chair3
-images
-----DSCI0887noCulling.jpg
-----Wood_Bamboo_LightnoCulling.jpg
-----Wood_CherrynoCulling
-model
-----chair.dae
-----chair.stl
-doc.kml
-textures.txt

ok inside model/chair.dae I have:

.
.
.
.
<library_images>
          <image id="Wood_CherrynoCulling-image" name="Wood_CherrynoCulling-image">
             <init_from>../images/Wood_CherrynoCulling.jpg</init_from>
          </image>
          <image id="Wood_Bamboo_LightnoCulling-image" name="Wood_Bamboo_LightnoCulling-image">
             <init_from>../images/Wood_Bamboo_LightnoCulling.jpg</init_from>
          </image>
          <image id="DSCI0887noCulling-image" name="DSCI0887noCulling-image">
             <init_from>../images/DSCI0887noCulling.JPG</init_from>
          </image>
       </library_images>
.
.
.
.

but my problem is: How I imoport to gazebo ChairColladaWorld.world the chair.dae?

I try with:

  <model:physical name="chair">
   <xyz>5.0 -5.0 0.1</xyz>
   <rpy>0 0 0</rpy>
   <static>true</static>
   <body:trimesh name="chair">
      <geom:trimesh name="chair">
        <scale>1.0 1.0 1.0</scale>
        <mesh>chair.dae</mesh>
        <visual>
           <scale>1.0 1.0 1.0</scale>
           <mesh>chair.dae</mesh>
        </visual>
      </geom:trimesh>
  </body:trimesh>
 </model:physical>

But it seems like the sytaxis is old, I can't find more examples and I need a little help here.

I try with:

  <model name="chair" static="true">
   <origin pose="0 0 0 0 0 0"/>
   <body:trimesh name="chair">
      <geom:trimesh name="chair">
        <scale>1.0 1.0 1.0</scale>
        <mesh>chair.dae</mesh>
        <visual>
           <scale>1.0 1.0 1.0</scale>
           <mesh>chair.dae</mesh>
        </visual>
      </geom:trimesh>
  </body:trimesh>
 </model:physical>

But I think I am doing something wrong.

Of course, I try with:

export GAZEBORESOURCEPATH=~/models/chair3/model

With that export, I think is enough to Gazebo to find the path to the model .dae and their images.

errors lunching:

$ gzserver ChairColladaWorld.world
Gazebo multi-robot simulator, version 1.0.0-RC2
Copyright (C) 2011 Nate Koenig, John Hsu, Andrew Howard, and contributors.
Released under the Apache 2 License.
http://gazebosim.org

Error [parser.cc:520] XML Element[model:physical], child of element[world] not defined in SDF. Ignoring.[world]
Error [parser.cc:511] Error reading element
Error [parser.cc:313] Unable to parse sdf element[gazebo]
Warning [parser.cc:235] parser for sdf version 1.0 failed, trying to parse as old deprecated format
namespace error : Namespace prefix model on physical is not defined
<model:physical name="chair">
                            ^
namespace error : Namespace prefix body on trimesh is not defined
<body:trimesh name="chair">
                          ^
namespace error : Namespace prefix geom on trimesh is not defined
<geom:trimesh name="chair">
                          ^
Entity: line 63: parser error : Opening and ending tag mismatch: world line 3 and gazebo
</gazebo>
         ^
Entity: line 65: parser error : Premature end of data in tag gazebo line 2

^
Error [parser_deprecated.cc:1210] Could not parse the xml
Warning [parser.cc:241] parsing using deprecated world file failed trying old model format.
namespace error : Namespace prefix model on physical is not defined
<model:physical name="chair">
                            ^
namespace error : Namespace prefix body on trimesh is not defined
<body:trimesh name="chair">
                          ^
namespace error : Namespace prefix geom on trimesh is not defined
<geom:trimesh name="chair">
                          ^
Entity: line 63: parser error : Opening and ending tag mismatch: world line 3 and gazebo
</gazebo>
         ^
Entity: line 65: parser error : Premature end of data in tag gazebo line 2

^
Error [parser_deprecated.cc:1151] Could not parse the xml
Error [parser.cc:247] parse as old deprecated model file failed.
Error [Server.cc:75] Unable to read sdf file[ChairColladaWorld.world]
Error [server_main.cc:116] Could not open file[ChairColladaWorld.world]

Ok, after a lot of work in this issue, I finish find the solution:

In the ___.world it is necessary:

.
.
.

    <model name="mesh_model">
      <origin pose="0 0 2.0 0 0 0"/>
      <link name="body">
        <inertial mass="1.0">
          <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/>
        </inertial>

        <collision name="geom">
          <geometry>
            <mesh filename="chair.dae" scale="0.01 0.01 0.01"/>
          </geometry>
        </collision>

        <visual name="visual">
          <geometry>
            <mesh filename="chair.dae" scale="0.01 0.01 0.01"/>
          </geometry>
          <material script="Gazebo/WoodPallet"/>
        </visual>
      </link>
    </model>

But the next question is: how I load the textures and the materials? because the line:

    <visual name="visual">
      <geometry>
        <mesh filename="chair.dae" scale="0.01 0.01 0.01"/>
      </geometry>
      <material script="Gazebo/WoodPallet"/>
    </visual>

Load the gazebo script and not the image file found in the .dae How could I change or tell Gazebo where is load the file in format .jpg or .png?? I see in the .dae this lines:

  <library_images>
      <image id="Wood_CherrynoCulling-image" name="Wood_CherrynoCulling-image">
         <init_from>../images/Wood_CherrynoCulling.jpg</init_from>
      </image>
      <image id="Wood_Bamboo_LightnoCulling-image" name="Wood_Bamboo_LightnoCulling-image">
         <init_from>../images/Wood_Bamboo_LightnoCulling.jpg</init_from>
      </image>
      <image id="DSCI0887noCulling-image" name="DSCI0887noCulling-image">
         <init_from>../images/DSCI0887noCulling.JPG</init_from>
      </image>

But doesn't load :(

Could anybody help me?

Thanks!! Thanks!! Thanks!!

Asked by pmarinplaza on 2012-03-13 01:38:51 UTC

Comments

Answers