Import Gazebo Models


Download

  1. Clone the github repositry.
  2. 
    git clone https://github.com/osrf/gazebo_models
        
  3. Copy the models with the repo to the directory ~/.gazebo/models.

Insert

  1. Run gazebo
  2. Press Insert Tab, and press the model and drag to the background.

Modify launch and world files

  1. In worlds folder, have your world settings in postbox.world.
  2. 
    <?xml version="1.0">
    <sdf version="1.5">
    
      <world name="default">
       
        <include>
          <uri>model://sun</uri>
        </include>
        <include>
          <uri>model://ground_plane</uri>
        </include>
        <include>
          <uri>model://postbox</uri>
          <pose>1 0 0 0 0 0</pose>
        </include>
    
      </world>
    </sdf>
        
  3. Can try running gazebo postbox.world.
  4. In launch folder, postbox_world.launch
  5. 
    <?xml version="1.0" encoding="UTF-8"?>
    <launch>
      <arg name="debug" default="false"/>
      <arg name="gui" default="false"/>
      <arg name="pause" default="true"/>
      <arg name="world" default="$(find my_package)/worlds/postbox.world"/>
    
      <include file="$(find gazebo_ros)/launch/empty_world.launch">
        <arg name="world_name" value="$(arg world)"/>
        <arg name="debug" value="$(arg debug)"/>
        <arg name="gui" value="$(arg gui)"/>
        <arg name="paused" value="$(arg pause)"/>
        <arg name="use_sim_time" value="true"/>
      </include>
    
    </launch>
        
  6. Test with roslaunch my_package postbox_world.launch.
  7. To initialize gazebo gui, set arg gui to True. To allow physics simulation and free-fall, set arg pause to False.
  8. Don't forget catkin_make and source devel/setup.bash.

References


  1. github osrf/gazebo_models
  2. [Gazebo in 5 minutes] 002 - How to add gazebo models to a simulation
  3. Gazebo -- Model structure and requirements