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 ...