Use PX4 Avoidance for multiple drones

Hey! We are a group of college students working on UAVs. For our final project we need to create a system that simulates a fleet of autonomous drones to carry out inspections of our the college’s roofs. We want to use PX4 Avoidance as part of this system, and we have managed to do it successfully when we only use one drone, like the examples present in the Github repo. We have been trying to use PX4 Avoidance when there is more than one drone, but we are running into some issues. We are able to run the system without using PX4 Avoidance for multiple drones, but once we enable it, that’s where it breaks. We have asked in Github, and now we are asking you for help.

We have the following questions:
1- Can we actually use PX4 Avoidance in more than one drone? Has anyone done it?
2- If so, how can it be done?
3- How much time do you estimate it could take to implement?

Next up there’s the description of how we tried to implement it. We have assigned one namespace to every drone in our simulation (uav0, uav1, etc…) and the ROS topics use that namespace. When we run the system we get the error “Obstacle Avoidance System failed, loitering”. We have seen that other people have encountered this error in the past, so we were hoping you would know how to fix it.

Here’s our file launch_world.launch :


    <arg name="world_file_name" default="fing" />
    <arg name="world_path" default="$(env PGDRONES)/proyectoFinalDrones/our_world/$(arg world_file_name).world" />
    <arg name="pointcloud_topics" default="[/camera/depth/points]"/>
    <arg name="max_sensor_range" default="3"/>

    <!-- Define a static transform from a camera internal frame to the fcu for every camera used -->
    <node pkg="tf" type="static_transform_publisher" name="tf_depth_camera"
          args="0 0 0 -1.57 0 -1.57 fcu camera_link 10"/>

    <node pkg="tf" type="static_transform_publisher" name="tf_downward_camera"
      args="0.1 0 0 0 1.5708 0 fcu downward_camera_link 10"/>

    <!-- Launch PX4, mavros, gazebo -->
    <include file="config.launch" >
      <arg name="ns" value="uav0" />
        <arg name="model" value="iris_two_depth_camera" />
        <arg name="world_path" value="$(arg world_path)" />

    <!-- Load custom console configuration -->
    <env name="ROSCONSOLE_CONFIG_FILE" value="$(find local_planner)/resource/custom_rosconsole.conf"/>

    <!-- Launch local planner -->
    <arg name="manager" default="local_planner_manager"/>

    <node pkg="nodelet" type="nodelet" name="$(arg manager)" args="manager" output="screen"/>
    <node pkg="nodelet" type="nodelet" name="local_planner_nodelet" args="load LocalPlannerNodelet $(arg manager)" output="screen">
      <param name="world_name" value="$(find avoidance)/sim/worlds/$(arg world_file_name).world" />
      <rosparam param="pointcloud_topics" subst_value="True">$(arg pointcloud_topics)</rosparam>
      <rosparam param="max_sensor_range_" subst_value="True">$(arg max_sensor_range)</rosparam>

    <node name="rviz" pkg="rviz" type="rviz" output="screen" args="-d $(find local_planner)/resource/local_planner.rviz" />

    <!-- Launch the mission manager node -->
    <node name="mission_node_uav0" pkg="mission" type="" output="screen">
        <param name="drone_id" value="uav0" />

    <!-- Launch the abort mission node -->
    <node name="abort_node_uav0" pkg="abort" type="" output="screen">
        <param name="drone_id" value="uav0" />

And here’s config.launch:

    <arg name="world_path" default="Mundo por def" />
    <arg name="gui" default="true"/>
    <arg name="ns" default="/"/>
    <arg name="model" default="iris_two_depth_camera"/>
    <arg name="fcu_url" default="udp://:14540@localhost:14557"/>
    <arg name="gcs_url" default="" />   <!-- GCS link is provided by SITL -->
    <arg name="tgt_system" default="1" />
    <arg name="tgt_component" default="1" />
    <arg name="vehicle" default="iris_obs_avoid"/>
    <arg name="x_initial_drone" default="20"/>
    <arg name="z_initial_drone" default="30"/>
    <arg name="y_initial_drone" default="20"/>

    <param name="use_sim_time" value="true" />

    <!-- <node pkg="tf" type="static_transform_publisher" name="map_to_local_origin" args="0 0 0 0 0 map local_origin 30" /> -->

    <!-- Launch rqt_reconfigure -->
    <node pkg="rqt_reconfigure" type="rqt_reconfigure" output="screen" name="rqt_reconfigure" />

    <!-- Launch PX4 SITL -->
    <include file="$(find px4)/launch/px4.launch">
        <arg name="vehicle" value="$(arg vehicle)"/>

    <!-- Launch MavROS -->
    <group ns="$(arg ns)">
        <include file="$(find mavros)/launch/node.launch">
            <arg name="pluginlists_yaml" value="$(find mavros)/launch/px4_pluginlists.yaml" />
            <!-- Need to change the config file to get the tf topic and get local position in terms of local origin -->
            <arg name="config_yaml" value="$(find avoidance)/resource/px4_config.yaml" />
            <arg name="fcu_url" value="$(arg fcu_url)" />
            <arg name="gcs_url" value="$(arg gcs_url)" />
            <arg name="tgt_system" value="$(arg tgt_system)" />
            <arg name="tgt_component" value="$(arg tgt_component)" />

    <!-- Launch Gazebo -->
    <include file="$(find gazebo_ros)/launch/empty_world.launch">
        <arg name="gui" value="$(arg gui)"/>
        <arg name="world_name" value="$(arg world_path)" />

    <!-- Spawn vehicle model -->
    <node name="spawn_model" pkg="gazebo_ros" type="spawn_model" output="screen"
          args="-sdf -database $(arg model) -model $(arg vehicle) -x $(arg x_initial_drone) -z $(arg z_initial_drone) -y $(arg y_initial_drone)">

1 Like

@Jaeyoung-Lim sorry to tag you but do you know if anyone is contributing to PX4 Avoidance at the moment?