Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Sure you can. I did exactly this with lots of worlds by just creating a catkin package called quad_world with a launch file in it that spawns the quadcopter and all kinds of other stuff (I used quadrotor_empty_world.launch as base).

As follows: start.launch contains:

<arg name="world_name" default="$(find quad_world)/worlds/" />
<include file="$(find quad_world)/launch/world.launch">
  <arg name="world_name" default="$(arg world_name)"/>

<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch" />

world.launch is the following: <launch>

  <!-- these are the arguments you can pass this launch file, for example paused:=true -->
  <arg name="paused" default="false"/>
  <arg name="use_sim_time" default="true"/>

  <arg name="headless" default="false"/>
  <arg name="debug" default="false"/>
  <arg name="verbose" default="false" />

  <arg name="world_name" />

  <!-- set use_sim_time flag -->
  <group if="$(arg use_sim_time)">
    <param name="/use_sim_time" value="true" />

  <!-- set command arguments -->
  <arg unless="$(arg paused)" name="command_arg1" value=""/>
  <arg     if="$(arg paused)" name="command_arg1" value="-u"/>
  <arg unless="$(arg headless)" name="command_arg2" value=""/>
  <arg     if="$(arg headless)" name="command_arg2" value="-r"/>
  <arg unless="$(arg verbose)" name="command_arg3" value=""/>
  <arg     if="$(arg verbose)" name="command_arg3" value="--verbose"/>
  <arg unless="$(arg debug)" name="script_type" value="gzserver"/>
  <arg     if="$(arg debug)" name="script_type" value="debug"/>

  <!-- start gazebo server-->
  <node name="gazebo" pkg="gazebo_ros" type="$(arg script_type)" respawn="false" output="screen"
    args="$(arg command_arg1) $(arg command_arg2) $(arg command_arg3) $(arg world_name)" />

  <!-- start gazebo client -->
  <node name="gazebo_gui" pkg="gazebo_ros" type="gzclient" respawn="false" output="screen"/>


Good luck with your project!