I am trying to follow the instruction from the last section (Multiple Vehicles using SDF Models) of:
I modified single_vehicle_spawn_sdf.launch so it will spawn my sdf model - iris_stereo_camera.
All three drones are able to spawn successfully, but when I try to arm all of them by using:
rosservice call /uav0/mavros/cmd/arming True
rosservice call /uav1/mavros/cmd/arming True
rosservice call /uav2/mavros/cmd/arming True
Only uav0 were able to arm. The other two returns false to the service. This is strange because I can see all three services when tying rosservice list.
This is my single_vehicle_spawn_sdf.launch:
<?xml version="1.0"?> <launch> <!-- Posix SITL environment launch script --> <!-- launchs PX4 SITL and spawns vehicle --> <!-- vehicle pose --> <arg name="x" default="0"/> <arg name="y" default="0"/> <arg name="z" default="0"/> <arg name="R" default="0"/> <arg name="P" default="0"/> <arg name="Y" default="0"/> <arg name="drone_ns" default=""/> <!-- vehcile model and config --> <arg name="est" default="ekf2"/> <!-- <arg name="vehicle" default="iris_stereo_camera"/> --> <arg name="vehicle" default="iris"/> <arg name="model" default="iris_stereo_camera"/> <arg name="ID" default="1"/> <env name="PX4_SIM_MODEL" value="$(arg vehicle)" /> <env name="PX4_ESTIMATOR" value="$(arg est)" /> <arg name="mavlink_udp_port" default="14560"/> <arg name="mavlink_tcp_port" default="4560"/> <!-- PX4 configs --> <arg name="interactive" default="true"/> <!-- generate sdf vehicle model --> <arg name="cmd" default="xmlstarlet ed -d '//plugin[@name="mavlink_interface"]/mavlink_tcp_port' -s '//plugin[@name="mavlink_interface"]' -t elem -n mavlink_tcp_port -v $(arg mavlink_tcp_port) $(find px4)/Tools/sitl_gazebo/models/$(arg model)/$(arg model).sdf"/> <param command="$(arg cmd)" name="model_description"/> <!-- PX4 SITL --> <arg unless="$(arg interactive)" name="px4_command_arg1" value=""/> <arg if="$(arg interactive)" name="px4_command_arg1" value="-d"/> <node name="sitl_$(arg ID)" pkg="px4" type="px4" output="screen" args="$(find px4)/build/px4_sitl_default/etc -s etc/init.d-posix/rcS -i $(arg ID) -w sitl_$(arg vehicle)_$(arg ID) $(arg px4_command_arg1)"> </node> <!-- spawn vehicle --> <node name="$(arg vehicle)_$(arg ID)_spawn" output="screen" pkg="gazebo_ros" type="spawn_model" args="-sdf -param model_description -model $(arg vehicle)_$(arg ID) -x $(arg x) -y $(arg y) -z $(arg z) -R $(arg R) -P $(arg P) -Y $(arg Y)"/> </launch>
And this is my multi_uav_mavros_sitl_sdf.launch, I have not modify anything in this launch file
> <?xml version="1.0"?>
<launch> <!-- MAVROS posix SITL environment launch script --> <!-- launches Gazebo environment and 2x: MAVROS, PX4 SITL, and spawns vehicle --> <!-- vehicle model and world --> <arg name="est" default="ekf2"/> <arg name="vehicle" default="iris"/> <arg name="world" default="$(find mavlink_sitl_gazebo)/worlds/empty.world"/> <!-- gazebo configs --> <arg name="gui" default="true"/> <arg name="debug" default="false"/> <arg name="verbose" default="false"/> <arg name="paused" default="false"/> <!-- Gazebo sim --> <include file="$(find gazebo_ros)/launch/empty_world.launch"> <arg name="gui" value="$(arg gui)"/> <arg name="world_name" value="$(arg world)"/> <arg name="debug" value="$(arg debug)"/> <arg name="verbose" value="$(arg verbose)"/> <arg name="paused" value="$(arg paused)"/> </include> <!-- UAV0 --> <group ns="uav0"> <!-- MAVROS and vehicle configs --> <arg name="ID" value="0"/> <arg name="fcu_url" default="udp://:14540@localhost:14580"/> <!-- PX4 SITL and vehicle spawn --> <include file="$(find px4)/launch/single_vehicle_spawn_sdf.launch"> <arg name="x" value="0"/> <arg name="y" value="0"/> <arg name="z" value="0"/> <arg name="R" value="0"/> <arg name="P" value="0"/> <arg name="Y" value="0"/> <arg name="vehicle" value="$(arg vehicle)"/> <arg name="mavlink_udp_port" value="14560"/> <arg name="mavlink_tcp_port" value="4560"/> <arg name="ID" value="$(arg ID)"/> </include> <!-- MAVROS --> <include file="$(find mavros)/launch/px4.launch"> <arg name="fcu_url" value="$(arg fcu_url)"/> <arg name="gcs_url" value=""/> <arg name="tgt_system" value="$(eval 1 + arg('ID'))"/> <arg name="tgt_component" value="1"/> </include> </group> <!-- UAV1 --> <group ns="uav1"> <!-- MAVROS and vehicle configs --> <arg name="ID" value="1"/> <arg name="fcu_url" default="udp://:14541@localhost:14581"/> <!-- PX4 SITL and vehicle spawn --> <include file="$(find px4)/launch/single_vehicle_spawn_sdf.launch"> <arg name="x" value="0"/> <arg name="y" value="4"/> <arg name="z" value="0"/> <arg name="R" value="0"/> <arg name="P" value="0"/> <arg name="Y" value="0"/> <arg name="vehicle" value="$(arg vehicle)"/> <arg name="mavlink_udp_port" value="14561"/> <arg name="mavlink_tcp_port" value="4561"/> <arg name="ID" value="$(arg ID)"/> </include> <!-- MAVROS --> <include file="$(find mavros)/launch/px4.launch"> <arg name="fcu_url" value="$(arg fcu_url)"/> <arg name="gcs_url" value=""/> <arg name="tgt_system" value="$(eval 1 + arg('ID'))"/> <arg name="tgt_component" value="1"/> </include> </group> <!-- UAV2 --> <group ns="uav2"> <!-- MAVROS and vehicle configs --> <arg name="ID" value="2"/> <arg name="fcu_url" default="udp://:14542@localhost:14582"/> <!-- PX4 SITL and vehicle spawn --> <include file="$(find px4)/launch/single_vehicle_spawn_sdf.launch"> <arg name="x" value="0"/> <arg name="y" value="-4"/> <arg name="z" value="0"/> <arg name="R" value="0"/> <arg name="P" value="0"/> <arg name="Y" value="0"/> <arg name="vehicle" value="$(arg vehicle)"/> <arg name="mavlink_udp_port" value="14562"/> <arg name="mavlink_tcp_port" value="4562"/> <arg name="ID" value="$(arg ID)"/> </include> <!-- MAVROS --> <include file="$(find mavros)/launch/px4.launch"> <arg name="fcu_url" value="$(arg fcu_url)"/> <arg name="gcs_url" value=""/> <arg name="tgt_system" value="$(eval 1 + arg('ID'))"/> <arg name="tgt_component" value="1"/> </include> </group> </launch> <!-- to add more UAVs (up to 10): Increase the id Change the name space Set the FCU to default="udp://:14540+id@localhost:14550+id" Set the malink_udp_port to 14560+id) -->
Are there any additional changes I need to make in order to successfully arm all three drones?
Also, if I change the model arg in signle_vehicle_spawn_sdf.launch back to iris instead of iris_stereo_camera, I was able to arm all three drones.