How do you run multiple hector_quadrotors without separate urdf files?
I'm currently trying to launch multiple hector_quadrotors with a single roslaunch command with ros-hydro. I have got it "working", I have two drones that hover and listen to different 'cmd_vel's.
But to get this to work I had to make my own versions of:
aw_quadrotor.urdf.xacro
aw_quadrotor_base.urdf.xacro
aw_quadrotor_plugins.gazebo.xacro
aw_quadrotor_sensors.gazebo.xacro
aw_quadrotor_simple_controller.gazebo.xacro
And one of these for each drone.
drone0_aw_quadrotor.gazebo.xacro
drone1_aw_quadrotor.gazebo.xacro
When I look at I see that some of the commits it looks like hector_quadrotor should support multiple drones without having to edit all the urdf files.
https://github.com/tu-darmstadt-ros-pkg/hector_quadrotor/commits/hydro-devel
What am I missing? How can I make sure the plugins for gazebo don't confuse drones with the same base_link name with each other? Using namespaces doesn't seem to propagate down into the xacro macros/gazebo plugins.
My files currently look like this.
aw_spawn_two_drones_gazebo.launch
<launch>
<param name="/use_sim_time" value="true"/>
<include file="$(find gazebo_ros)/launch/empty_world.launch">
</include>
<group ns="drone0">
<include file="$(find aw_hector_quadrotor)/launch/spawn_quadrotor.launch">
<arg name="name" value="drone0"/>
<arg name="pos_x" value="0.2"/>
<arg name="namespace_arg" value="drone0"/>
</include>
</group>
<group ns="drone1">
<include file="$(find aw_hector_quadrotor)/launch/spawn_quadrotor.launch">
<arg name="name" value="drone1"/>
<arg name="pos_x" value="2.0"/>
<arg name="namespace_arg" value="drone1"/>
</include>
</group>
</launch>
spawn_quadrotor.launch
<launch>
<!-- push robot_description to factory and spawn robot in gazebo -->
<arg name="name" default="quadrotor"/>
<arg name="pos_x" default="0.0"/>
<arg name="pos_y" default="0.0"/>
<arg name="pos_z" default="0.5"/>
<arg name="namespace_arg" default=""/>
<arg name="model" default="$(find aw_hector_quadrotor)/urdf/$(arg namespace_arg)_aw_quadrotor.gazebo.xacro"/>
<!-- send the robot XML to param server -->
<param name="robot_description" command="$(find xacro)/xacro.py '$(arg model)'" />
<param name="tf_prefix" value="$(arg namespace_arg)" />
<node name="spawn_robot" pkg="gazebo_ros" type="spawn_model"
args="-param robot_description
-urdf
-x $(arg pos_x)
-y $(arg pos_y)
-z $(arg pos_z)
-model $(arg name)"
respawn="false" output="screen">
</node>
</launch>
drone0_aw_quadrotor.gazebo.xacro
<robot name="quadrotor" xmlns:xacro="http://ros.org/wiki/xacro">
<xacro:include filename="$(find aw_hector_quadrotor)/urdf/aw_quadrotor.urdf.xacro" />
<xacro:include filename="$(find aw_hector_quadrotor)/urdf/aw_quadrotor_plugins.gazebo.xacro" />
<!-- Instantiate quadrotor_base_macro once (has no parameters atm) -->
<xacro:quadrotor_base_macro prefix="drone0"/>
<xacro:quadrotor_sensors_gazebo prefix="drone0"/>
<xacro:quadrotor_sensors/>
<xacro:quadrotor_simple_controller prefix="drone0" state_topic="ground_truth/state" imu_topic="raw_imu"/>
</robot>
aw_quadrotor_base.urdf.xacro
<robot xmlns:xacro="http://ros.org/wiki/xacro">
<xacro:include filename="$(find aw_hector_quadrotor)/urdf/sonar_sensor.urdf.xacro" />
<xacro:property name="pi" value="3.1415926535897931" />
<!-- Main quadrotor link -->
<xacro:macro name="quadrotor_base_macro" params="prefix" >
<link name="${prefix}/base_link">
<inertial>
<mass value="1.477" />
<origin xyz="0 0 0" />
<inertia ixx="0.01152" ixy="0.0" ixz="0.0" iyy="0.01152" iyz="0.0" izz="0.0218" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://hector_quadrotor_description/meshes/quadrotor/quadrotor_base.dae"/>
</geometry>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://hector_quadrotor_description/meshes/quadrotor/quadrotor_base.stl"/>
</geometry>
</collision>
</link ...