Home | Tutorials | Wiki | Issues
Ask Your Question
0

including model.sdf in .world Gazebo7

asked 2017-07-03 17:42:39 -0500

carolo gravatar image

Hi, im working since a couple weeks with gazebo and I have some problems including a model.sdf into a .world file.

I am using Gazebo7 and ROS-kinetic. I already sourced the MODEL_PATH at the .bashrc file

export GAZEBO_MODEL_PATH=/home/MyComputer/sim_ws/src/sim_sdf/models/vehicle/:$GAZEBO_MODEL_PATH

and the simulation is running when I start the model-file on its own. After testing I reduced the model-file:

<?xml version="1.0"?>
<sdf version="1.5">
    <model name="vehicle">
     ....... 
    </model>
</sdf>

To include the model into the world file I use following command:

<?xml version="1.0"?>
<sdf version="1.5">
  <world name="default">
    <include>
      <uri>model://ground_plane</uri>
    </include>
    <include>
      <uri>model://sun</uri>
    </include>

<!-- Model -->
    <model name="vehicle">
      <include>
            <static>false</static>
        <uri>model://vehicle/model.sdf</uri>
        <pose> 0 0 1 0 0 0</pose>
      </include>
    </model>
  </world>
</sdf>

the problem is that gazebo is starting without a model and inside the terminal appears Directory doesn't exist[/home/MyComputer/sim_ws/src/sim_sdf/models/vehicle/model.sdf] So I tried to use

<uri>model://vehicle/model</uri>

that will take ages and still not work or

<uri>model://home/MyComputer/sim_ws/src/sim_sdf/models/vehicle/model</uri>

what also wont work.....

Hopefully there is somebody who had a similar problem and know what to do. I am totally stucked. Thank you in advance

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-07-03 18:04:33 -0500

sloretz gravatar image

It sounds like /home/MyComputer/sim_ws/src/sim_sdf/models/vehicle/ is a single model. That is, it has just one model.config in it. If so The GAZEBO_MODEL_PATH should be set to the directory that contains it. export GAZEBO_MODEL_PATH=/home/MyComputer/sim_ws/src/sim_sdf/models:$GAZEBO_MODEL_PATH. Then the URI should say just the model name <uri>model://vehicle</uri>.

edit flag offensive delete link more

Comments

Thanks for your quick answer. Now the model displays as some boxes and the terminal shows following massage: > libGL error: failed to create drawable

carolo gravatar imagecarolo ( 2017-07-05 06:50:02 -0500 )edit

I solved the problem, this happens when the path of the mesh file is not set correctly.
The following is the correct code:

<geometry>
<mesh>
<uri>/home/MyComputer/ros_ws/src/gazebo_sim/models/vehicle/meshes/DodgeBody.dae</uri>
<scale>2 2 2</scale>
</mesh>
</geometry>

Thanks for your help

carolo gravatar imagecarolo ( 2017-07-08 13:06:52 -0500 )edit

I'd expect `<uri>model://vehicle/meshes/DodgeBody.dae</uri>` to work if the `GAZEBO_MODEL_PATH` is set to the parent directory of `vehicle`. More info about environment variables used by gazebo is here http://gazebosim.org/tutorials?tut=components

sloretz gravatar imagesloretz ( 2017-07-10 10:10:03 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-07-03 17:24:20 -0500

Seen: 1,704 times

Last updated: Jul 05 '17