Running SITL to Test a Collision Avoidance Software

Hi Y’all.

I am an undergraduate researcher trying to test a distributed detect and avoid protocol on SITL drones. However, I can’t for the life of me figure out how to test the Collision Avoidance Software with even one SITL drone. I know this might be really basic, but I’m lost, and any help that anyone can provide would be much appreciated.

Thanks! :blush:

Hey Gabriella,

I know exactly what you mean, this stuff is quite confusing. Honestly, I am not 100% sure I know how to detect obstacles in the SITL simulated environment. However, there are some tricks you can possibly take advantage of. For example, if you want to run the collision avoidance behavior defined by the param AVOID_BEHAVE, you can set:

  • AVOID_ENABLE = 1 ( use fence for avoidance input sensing )
  • FENCE_ENABLE = 1 ( enable fence functionality )

This way, when you create a fence in SITL and fly the drone into it, it should detect the fence as an obstacle and then run the collision avoidance algorithm implemented in one of the avoidance library files. I am not entirely sure how to set up an actual obstacle in SITL, unfortunately. You can look at my other post on obstacle avoidance on tips for how to set up rangefinders. One thing that you might consider is possibly setting up SITL with gazebo if you want better visualization or using the log files from mission planner if you are using that ( I think those have a good way of viewing the flight data ).

I haven’t gotten around to fully testing these features yet, so I am not entirely sure all this will work.
Hope this helps you get started!

-Varun

Hello @gabriellasanford,
As @vchadha explained, I think Gazebo can be a good solution. Depending on what you want to test, you can use sensors (like LIDAR, sonars, stereocameras etc.) for the detection on one side, and use the SITL of ArduCopter to evaluate your avoidance algorithm. It can looks like something like that :
Untitled%20Diagram

I recommand you to have a look to ROS and Mavros.
You can manage all the components :

  • For Gazebo, you can generate your own model (it can takes time if you are not familiar with. IRIS drone already exist for a start)
  • SITL already exists, it is well documented
  • Your code can be in python, or cpp, where you can implement your smart avoidance (and also action like take off, land, go there etc). In real life, it will be like a companion computer giving order to your controller (Pixhawk or others).

And for the communication

I hope it is clear, if not, let me know !

3 Likes

Hello, How is it going? I am trying to combine the Gazebo with SITL. It seems okay for command via Mavproxy (mode, takeoff, RC…). However, for some feedback information (distance sensor, magnetic…) could you suggest how we gain them from the models back to mavproxy (our codes)? Thanks.