Home | Tutorials | Wiki | Issues
Ask Your Question
2

gazebo default directory and can not insert model

asked 2012-11-08 09:28:33 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

  1. where is the gazebo difault directory,I use virtualbox run ros and gazebo, I can only insert the default model from its default directory, and must use "sudo" command to modify the model file.so when I follow tutorial 'build a robot' , I can't insert the model from my created directory, why? Please help me.
  2. In the tutorial 'build a robot', after creating ~/.gazebo/models/manifest.xml file and ~/.gazebo/models/my_robot/model.sdf file, but I can not insert it , because I can not find the file and gazebo only can insert .model file, why? how to solute it?
  3. gazebo_models,but I find the example model in the opt/ros/fuerte/stacks/simulator_gazebo/gazebo/gazebo/share/model, how can I change the default directory to my created directory ~/.gazebo/models/

thanks

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
2

answered 2012-11-09 09:53:08 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Answered it earlier, i suggest just posting one question?

You can set the default directories for models using (go sudo gedit ~/.bashrc and add this for example)

export GAZEBO_MODEL_PATH=path/to/models

For world files gazebo looks in your current directory (i think) and the resource path.

export GAZEBO_RESOURCE_PATH=path/to/worlds.

But you can always all this path stuff by creating a world file completely without inserts, yourworld.sdf

<?xml version="1.0" ?>
<gazebo version="1.2">
  <world name="default">
     <model name="yourmodel">
        <link name='yourlink'>
         <self_collide>false</self_collide>
          <pose>0.0000 0.0000 0.0000 0.000 0.000 0.000</pose>

          <collision name='yourlink'>
            <geometry>
            <box><size>0.6 0.5 0.34</size></box>
            </geometry>                 
          </collision>
          <visual name='yourlink'>
          <geometry>
             <box><size>0.6 0.5 0.34</size></box>
          </geometry>
        </visual>
      </link>    
     </model>
  </world>
</gazebo>

Save it as yourmodel.sdf. Then go in prompt and type gazebo yourmodel.sdf (in that directory)

edit flag offensive delete link more

Comments

it looks like lugd1229 is using ros, in which case the export commands wouldn't work right?

mcevoy.andy gravatar imagemcevoy.andy ( 2012-11-09 10:25:08 -0600 )edit

yes ,I use simulator_gazebo ,then I try to use plain gazebo, maybe it is more simple. thank you.

lugd1229 gravatar imagelugd1229 ( 2012-11-09 11:30:53 -0600 )edit

Ah yes, i missed the ROS in the first sentence. I guess it won't work.

Erik Stoltenborg gravatar imageErik Stoltenborg ( 2012-11-09 13:56:30 -0600 )edit
0

answered 2016-12-28 03:24:09 -0600

prasad gravatar image

Typically, there are 3 methods to let Gazebo software load a model as mentioned in this answer.

  1. Export GAZEBO_MODEL_PATH properly. (If Gazebo doesn't start at all, then setup Gazebo and environment variables and then export GAZEBO_MODEL_PATH)

  2. Move the models to "gazebo/models" folder directly and include the URI in launch file.

  3. In case this is being used with ROS (which is the typical case), make sure that the models and the code is withinthe workspace. (I was struggling with this and I was attempting multi-robot simulation. I realised that the environment variables are sourced in the first instance and sourcing them again from second workspace or any other folder can be difficult. Reference : http://wiki.ros.org/catkin/Tutorials/... )

[Note: I am posting this to help people; I myself struggled to get a working solution (for about 10 hours) and I haven't found any similar information as in this answer]

edit flag offensive delete link more

Comments

@prasaid what you mean by "can be difficult" ? You cannot source more than one workspace?

bxl gravatar imagebxl ( 2017-11-22 14:27:50 -0600 )edit
0

answered 2016-10-24 08:53:45 -0600

bergercookie gravatar image

export the following shell variables (e.g. in your ~/.bashrc):

  1. export GAZEBO_MODEL_PATH=path/to/models
  2. export GAZEBO_RESOURCE_PATH=path/to/worlds.

Also make sure that all the .sdf files in the model path are inside their corresponding folders and have a model.config file beside them. If the latter is not there the model is not going to be found by gazebo. e.g.

MODELS_DIRECTORY/
|
|-->pioneer_3at/
    |
    |--> model.sdf
    |--> model.config
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2012-11-08 09:28:33 -0600

Seen: 9,676 times

Last updated: Nov 14 '12