ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How to simulate multiple erlecopters in Gazebo?

asked 2017-06-02 10:42:32 -0500

Hugo Sardinha gravatar image

Hi everyone. Is there any particular way to, correctly, launch multiple erlecopters in a Gazebo simulation. I'm asking this because I tried to launch the .xacro file within a group like <group ns="ns1"> ... </group>

and even though everything appears to be well without errors, when I do rostopic list there several topics outside the ns1 namespace, some of which even appear to be duplicated. I tried to look in the .xacro files and the topics appear to be local, so they should come in the specified namespace. Please check below my launch file:

<?xml version='1.0'?>
    <!-- start world -->

  <arg name="simRate" default="nan"/>
  <!-- Enable simulation clock -->
  <param name="use_sim_time" type="bool" value="true" />

  <arg name="world_name" default="$(find multi_uav)/worlds/" />
  <arg name="gui" value="true" />
  <arg name="headless" value="false" /> 

  <env name="GAZEBO_MODEL_PATH" value="$(find ardupilot_sitl_gazebo_plugin)/meshes/meshes_sensors"/>

<group ns="ns1">  
    <include file="$(find mavros)/launch/mavlink_bridge.launch"></include>

    <arg name="namespace" default="ns1"/>   
    <arg name="enable_logging" default="true"/>
        <arg name="enable_ground_truth" default="true"/>
    <arg name="log_file" default="erlecopter"/>
    <include file="$(find mavros)/launch/apm_sitl.launch"></include>
    <arg name="name" default="erlecopter1"/>
    <arg name="model" default="$(find ardupilot_sitl_gazebo_plugin)/urdf/erlecopter_base.xacro"/>
    <arg name="tf_prefix" default="$(arg namespace)"/>
    <arg name="debug" default="true"/>
    <arg name="verbose" default="true"/>

  <!-- Initial pose for the drone -->
    <arg name="x" default="0.0"/> <!-- [m], positive to the North -->
    <arg name="y" default="0.0"/> <!-- [m], negative to the East -->
    <arg name="z" default="0.08"/> <!-- [m], positive Up -->
    <arg name="roll" default="0"/> <!-- [rad] -->
    <arg name="pitch" default="0"/> <!-- [rad] -->
    <arg name="yaw" default="3.1415"/> <!-- [rad], negative clockwise -->

  <!-- send the robot XML to param server -->
    <param name="robot_description" command="
    $(find xacro)/ '$(arg model)'
    enable_logging:=$(arg enable_logging)
    enable_ground_truth:=$(arg enable_ground_truth)
    log_file:=$(arg log_file)"
    <param name="tf_prefix" type="string" value="$(arg tf_prefix)" />

  <!-- push robot_description to factory and spawn robot in gazebo -->
    <node name="spawn_erlecopter" pkg="gazebo_ros" type="spawn_model"
   args="-param robot_description
         -x $(arg x)
         -y $(arg y)
         -z $(arg z)
         -R $(arg roll)
         -P $(arg pitch)
         -Y $(arg yaw)
         -model $(arg name)"
   respawn="false" output="screen" >
  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="paused" value="true"/>   <!-- value unrelevant due to Arducopter plugin steps --> 
    <arg name="headless" value="$(arg headless)"/>
    <arg name="gui" value="$(arg gui)"/>
    <arg name="world_name" value="$(arg world_name)"/>


I based my launch file on the erlecopter_spawn.launch and the topics I get are

/ns1/erlecopter/bottom/image_raw/compressed ...
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-11-22 06:17:27 -0500

Hugo Sardinha gravatar image

If anyone is interested, please refer to this post

edit flag offensive delete link more

Question Tools



Asked: 2017-06-02 10:42:32 -0500

Seen: 1,262 times

Last updated: Nov 22 '18