0
$\begingroup$

Gazebo Answers logo

Hello,

I am new at Gazebo/ROS integration tool and I am using ROS groovy with Gazebo 1.3. Yet I am just able to get my hands on sdf xml programming and exported my mesh in gazebo environment.

How should I handle my mesh model to get it running? Should I import part by part?

roslaunch gazebo_worlds empty_world.launch

rosrun gazebo spawn_model -file model.sdf -gazebo -z 200 -model my_robot

Any help regarding this will be appreciated.


Originally posted by skhan on Gazebo Answers with karma: 131 on 2013-03-15

Post score: 2

$\endgroup$

1 Answer 1

0
$\begingroup$

Gazebo Answers logo

Hi,

Here is a tutorial how to import a mesh in gazebo. You could also create an sdf model and import it in the .world file.

<include>
  <uri>model://mesh_model</uri>
  <pose>0 0 1 0 0 0</pose>
</include>

In order to load it save the mesh_model in ~/.gazebo/models folder.

UPDATE

One link with many mesh collisions visuals:

    <model name="my_mesh_one_link">
      <link name="mesh_link">

        <visual name="visual1">
          <geometry>
            <mesh><uri>file://my_mesh1.dae</uri></mesh>
          </geometry>
        </visual>
        <collision name="collision1">
          <geometry>
            <mesh><uri>file://my_mesh1.dae</uri></mesh>
          </geometry>
        </collision>

        <visual name="visual2">
          <geometry>
            <mesh><uri>file://my_mesh2.dae</uri></mesh>
          </geometry>
        </visual>
        <collision name="collision2">
          <geometry>
            <mesh><uri>file://my_mesh2.dae</uri></mesh>
          </geometry>
        </collision>

      </link>
    </model>

For every mesh a different link:

    <model name="my_mesh_many_links">

      <link name="mesh_link1">
        <visual name="visual1">
          <geometry>
            <mesh><uri>file://my_mesh1.dae</uri></mesh>
          </geometry>
        </visual>
        <collision name="collision1">
          <geometry>
            <mesh><uri>file://my_mesh1.dae</uri></mesh>
          </geometry>
        </collision>
      </link>

      <link name="mesh_link2">
        <visual name="visual2">
          <geometry>
            <mesh><uri>file://my_mesh2.dae</uri></mesh>
          </geometry>
        </visual>
        <collision name="collision2">
          <geometry>
            <mesh><uri>file://my_mesh2.dae</uri></mesh>
          </geometry>
        </collision>
      </link>

    </model>

With the later model you can add joints between the links. If you want them to behave statically between them use only one link.

Cheers, Andrei


Originally posted by AndreiHaidu with karma: 2108 on 2013-03-15

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by skhan on 2013-03-15:
@AndreiHaidu Thanks, I am aware of it that how I import it but for simulation I have to import part by part or whole design?

Comment by AndreiHaidu on 2013-03-15:
Well, you can either create for every mesh file a link, and then add joints between the links. Or if you want all the pieces in a single link, then you just add more collisions and visuals. I updated the answer with an example. Hope it helps :)

Comment by skhan on 2013-03-20:
Thanks I try this approach

Comment by IsaacS on 2014-11-15:
Tutorial URL moved to http://gazebosim.org/tutorials?tut=import_mesh&cat=build_robot

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.