Robotics StackExchange | Archived questions

How to simulate multiple erlecopters in Gazebo?

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'?>
<launch>
    <!-- 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/empty.world" />
  <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)/xacro.py '$(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
         -urdf
         -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" >
    </node> 
</group>
  <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)"/>
  </include>

</launch> 

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

/clock
/command/motors
/command/rate
/diagnostics
/erlecopter/command/attitude
/erlecopter/command/motor_speed
/erlecopter/fix
/erlecopter/fix_velocity
/erlecopter/gazebo/command/motor_speed
/erlecopter/ground_truth/imu
/erlecopter/ground_truth/odometry
/erlecopter/ground_truth/pose
/erlecopter/ground_truth/pose_with_covariance
/erlecopter/ground_truth/position
/erlecopter/ground_truth/transform
/erlecopter/imu
/erlecopter/motor_speed/0
/erlecopter/motor_speed/1
/erlecopter/motor_speed/2
/erlecopter/motor_speed/3
/erlecopter/motors
/erlecopter/waypoint
/erlecopter/wind
/gazebo/link_states
/gazebo/model_states
/gazebo/parameter_descriptions
/gazebo/parameter_updates
/gazebo/set_link_state
/gazebo/set_model_state
/imu
/ns1/erlecopter/bottom/camera_info
/ns1/erlecopter/bottom/image_raw
/ns1/erlecopter/bottom/image_raw/compressed
/ns1/erlecopter/bottom/image_raw/compressed/parameter_descriptions
/ns1/erlecopter/bottom/image_raw/compressed/parameter_updates
/ns1/erlecopter/bottom/image_raw/compressedDepth
/ns1/erlecopter/bottom/image_raw/compressedDepth/parameter_descriptions
/ns1/erlecopter/bottom/image_raw/compressedDepth/parameter_updates
/ns1/erlecopter/bottom/image_raw/theora
/ns1/erlecopter/bottom/image_raw/theora/parameter_descriptions
/ns1/erlecopter/bottom/image_raw/theora/parameter_updates
/ns1/erlecopter/bottom/parameter_descriptions
/ns1/erlecopter/bottom/parameter_updates
/ns1/erlecopter/fix
/ns1/erlecopter/fix/position/parameter_descriptions
/ns1/erlecopter/fix/position/parameter_updates
/ns1/erlecopter/fix/status/parameter_descriptions
/ns1/erlecopter/fix/status/parameter_updates
/ns1/erlecopter/fix/velocity/parameter_descriptions
/ns1/erlecopter/fix/velocity/parameter_updates
/ns1/erlecopter/fix_velocity
/ns1/erlecopter/front/camera_front_info
/ns1/erlecopter/front/image_front_raw
/ns1/erlecopter/front/image_front_raw/compressed
/ns1/erlecopter/front/image_front_raw/compressed/parameter_descriptions
/ns1/erlecopter/front/image_front_raw/compressed/parameter_updates
/ns1/erlecopter/front/image_front_raw/compressedDepth
/ns1/erlecopter/front/image_front_raw/compressedDepth/parameter_descriptions
/ns1/erlecopter/front/image_front_raw/compressedDepth/parameter_updates
/ns1/erlecopter/front/image_front_raw/theora
/ns1/erlecopter/front/image_front_raw/theora/parameter_descriptions
/ns1/erlecopter/front/image_front_raw/theora/parameter_updates
/ns1/erlecopter/front/parameter_descriptions
/ns1/erlecopter/front/parameter_updates
/ns1/iris/mavlink/from
/ns1/iris/mavlink/to
/ns1/mavlink/from
/ns1/mavlink/to
/ns1/mavros/battery
/ns1/mavros/cam_imu_sync/cam_imu_stamp
/ns1/mavros/extended_state
/ns1/mavros/global_position/compass_hdg
/ns1/mavros/global_position/global
/ns1/mavros/global_position/local
/ns1/mavros/global_position/raw/fix
/ns1/mavros/global_position/raw/gps_vel
/ns1/mavros/global_position/rel_alt
/ns1/mavros/imu/atm_pressure
/ns1/mavros/imu/data
/ns1/mavros/imu/data_raw
/ns1/mavros/imu/mag
/ns1/mavros/imu/temperature
/ns1/mavros/local_position/odom
/ns1/mavros/local_position/pose
/ns1/mavros/local_position/velocity
/ns1/mavros/manual_control/control
/ns1/mavros/mission/waypoints
/ns1/mavros/radio_status
/ns1/mavros/rc/in
/ns1/mavros/rc/out
/ns1/mavros/rc/override
/ns1/mavros/setpoint_accel/accel
/ns1/mavros/setpoint_position/local
/ns1/mavros/setpoint_raw/attitude
/ns1/mavros/setpoint_raw/global
/ns1/mavros/setpoint_raw/local
/ns1/mavros/setpoint_raw/target_attitude
/ns1/mavros/setpoint_raw/target_global
/ns1/mavros/setpoint_raw/target_local
/ns1/mavros/setpoint_velocity/cmd_vel
/ns1/mavros/state
/ns1/mavros/time_reference
/ns1/mavros/vfr_hud
/ns1/mavros/wind_estimation
/ns1/sonar_down
/ns1/sonar_front
/rosout
/rosout_agg
/scan
/sonar_down
/sonar_front
/tf
/tf_static

As you can see some are indeed there are topics like /ns1/erlecopter/topic_name while others are just /erlecopter/topic_name. An example of duplicate topic is /ns1/erlecopter/fix and /erlecopter/fix. Also I should add that I'm able to change modes and take off through the mavproxy window. However, the erlecopter just keeps going up.

any thoughts??

Thank you so much,

Hugo

Asked by Hugo Sardinha on 2017-06-02 10:42:32 UTC

Comments

Answers

If anyone is interested, please refer to this post

http://forum.erlerobotics.com/t/multi-uav-platform/3414

Asked by Hugo Sardinha on 2018-11-22 07:17:27 UTC

Comments