Gazebo sensor data to Ardupilot simulated Copter

Hello developers!

My issue is almost the same as this one

I want to use the already implemented collision avoidance algorithm from the Ardupilot 4.3.6 flight stack.

Here is what I have now :

I followed the ardupilot developer document to install Gazebo and attached Terabee Tower Evo Lidar sensor.

I modified terabee_tower_evo sensor’s plugin like bellow

        <update_rate>20</update_rate>
        <plugin name="tera_0" filename="libgazebo_ros_ray_sensor.so">
          <ros>
            <namespace>/gazebo</namespace>
            <remapping>~/out:=range_0</remapping>
          </ros>
          <output_type>sensor_msgs/Range</output_type>
          <radiation_type>infrared</radiation_type>
        </plugin>

and I confirmed the topics /gazebo/range_[0:7] via ros2 topic list with correct data

Here is my Gazebo simulation with an iris drone and the Terabee Tower Evo Lidar sensor on it :

I have some problems to make SITL using Gazebo.
I have no idea to send message from gazebo to the ardupilot DISTANCE_SENSOR.
I want to do that so the collision avoidance will be handle by the Ardupilot simulated Copter. I dont want to handle it with ROS or anything.

If you have any explanation on how to that ! :slight_smile:
Do you even know of its possible ?

Thanks and have a nice day :wink:

I’m not sure of what I’m saying but should I put the PRX_TYPE on 10 = SITL ?
https://ardupilot.org/copter/docs/parameters.html#prx1-type-proximity-type

An other thing is that my DISTANCE_SENSOR.current_distance represents the drone altitude from the ground…

Does someone have an example ? It would be perfect for me :slight_smile:

Have a nice day guys !