Script for Sense and Avoid Colision using ADS-B

Hi, everybory

My name is Paulo. I´m a student of Aviation Safety and I need a help for my tesis.
I´m a begginer using python.
I have a problem and I would like a help.
I´m using the Mission Planner to control a drone in the mavproxy (it´s a simulation. There´s no a real drone).
I have a ADS-B receiver connected in my computer and it sends the information of air traffic to the Mission Planner (the image of the airplane appears on the display in Mission Planner).
So… I need a scritp that makes the drone back to home and land when the air traffic is detected.
Can someone help me?

Avoiding traffic is already available.

Beside, it’s no reliability by scripting on a ground station that depends on radio link… And windows.
You can easily change the code on autopilot to do RTL while avoiding proximity to traffic.

Hi, Andre

Thank you for your answer.
Do you have experience in scripts and can you help me how to do it?
I´m a begginer in python.

As I´ve said, there´s no real drone. It´s a simulation using the mavproxy.
So… is there a way to programm (or configure) the autopilot using python or the configurations in the Mission Planner? I´ve tried, but I could not do it.

Sorry, no time to spare, and I don’t use mission planner , so it would take
longer. :slight_smile:

You only need to enable ADSB on the mission planner drone parameters.
Your simulated drone will already avoid the real trafic that the ADSB receives sees.
You do not need to know python the code is in ardupilot\libraries\AC_avoidance and is written in C++.

Thank you, Amilcar
I´ll try do it.

Do I have to set it in any mode after to enable ADSB on the mission planner?

I enabled avoid ads-b on the mission planner, the aircraft appears in display, but the virtual drone in mavlink did not return to home.
Do I have to set some mode in mavproxy (or mission planner)?
The receiver that I use is not the uavionics, but a RTL2832U usb.

You need to enable the adsb receiver in mission planner, then connect the adsb receiver to the pixhawk, configure the pixhawk serial port, and enable the adsb parameter.

google adsb ardupilot
and you get :

Hi, Amilcar

I don´t have a pixhawk, but I can buy this. But, before I buy a pixhawk, I repeat that there´s not a real drone, but a simulated drone (in Mavproxy), wich is controled by Mission Planner. Are sure that it will work with the pixhawk?

Thank you for your attention

And… I have an antenna receiver RealTek RTL2832u (not a uAvionix receiver). Is it possible to connect my antenna in pixhawk? It´s USB.

I do not know if other receivers also work. It is possible to test in the SITL, but for that you need to tell the SITL to listen to a real serial connection on your PC. If you get that running, then it will also work with a pixhawk.

Thank you, Amilcar

I´ll buy a pixhawk and try doing this.

Thank you

Try it on the SITL first, it’s for free.

I’ve already tried it, but it doesn´t go to RTL mode when I set it up on the mission planner.

Does it stop ? Does it move away ? Did you configured it to do RTL ?

If the SITL does not do what you want, pixhawk will not do it either !!

The drone doesn´t stop. It continues its route without return to the home. I configured it to do RTL.
It´s what I do:

  1. Config/Tuning =>Full Parameter List =>ADSB_ENABLE => set 1
  2. Config/Tuning=>Full Parameter Tree=>AVD=>AVD_F_ACTION => set 5

Is there anything else I have to do? Is there anything I’m forgetting to do?

Amilcar… I would like to send prints of my actions to you. Is it possible?

Yes, you can. And I can read portuguese :slight_smile:

Here or email?
My email is