APM Planner Automation


I have a developed a sensor network which detects gunshots for anti-poaching purposes. When a gunshot is detected, the event data is sent to a sensor server for further analysis and triangulation of the gunshot location. Currently the prototype is running on Arduino Due boards with Xbee coms but this will soon be changed to a less power consuming custom PC board with incorporated and more secure communications.

I wish to incorporate fixed wing UAV’s in this concept with as little human interaction as possible, no manual transfer of event waypoints, no manual take-off etc. The entire system must be automated. The Aircraft will be switched on and docked on a catapult launcher which will be controlled by a microcontroller. The APM telemetry link will be established and connected between the aircraft and the GCS.  


As per the attached image the entire process will be as follows,

1. Get event data from the sensor network

2. Triangulate the gunshot source and provide a GPS coordinate.

3. Generate a UAV script which might look as follows:

  • TAKEOFF (from home position)
  • LOITER @ -24.123456, 24.123456 (until a new command is issued via APM Planner or failsafe gets triggered)

4. Send this UAV script to APM planner which includes

  • Instruct APM Planner via a script to upload the waypoints to the aircraft
  • Instruct APM Planner via a script to do an automated MISSION START command


5. Send a command to the launch controller to trigger the catapult launcher and release the aircraft


How can I do the following?

1. Send a Take-Off command and waypoint information (script) directly to APM Planner

2. Initiate the Mission Start Command from a script immediately after the Waypoint upload has been confirmed maybe via a script without having to push a button.

3. I have used TCP ports for numerous software interactions; can a TCP Server port for commands from other software be opened in APM Planner?


Has anyone done something similar already?


E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones


  • Hi Petrus, did you manage to get a solution for this? I'm also involved in something similar but have yet to be able to find a solution to this.

  • John, The system will have a Pilot in the loop, the only automation which is required will be the transfer of the gunshot source waypoint and an automatic takeoff. The entire system will be manned, but by automating the above mentioned we can start ruling out certain human error and improve reaction time, especially when it comes to the transfer of an decimal geo coordinate


    Gerhard, the aircraft cruise speed is in the region of 120 Km/h, which will provide us with 3 minutes flight time over a distance of 10Km. We will keep the loiter wide  and decrease airspeed to approximately 80 Km/h over the target. In reply to the rest of your comment, it has already been considered and taken into account during operation. Please note that these planes are not for searching or patrolling areas, they are used in a reactive role whereby we already know the exact location, we need situational awareness and recorded video of the crime. We can also follow the poacher while making his exit and have ground teams setup an ambush at his predicted exit point.


    Phil, thank you very much, we have been working on this for over a year and believe that this concept will help in the fight. We will scale it up and we are trying our very best to keep the price as affordable as possible. If it proves successful in South Africa, we will take it across the globe.


    Pat, thank you, I will look into MAVproxy but as Gerhard said, we should not take the GCS APM Planner out of the loop.

  • Interesting...a fully automated system that requires no human control...?

    Hmmm what could probably go wrong ? If you ever succede and set up a company DO NOT call it Cyberdyne systems :-D

  • Transmitting the wp's directly through MAVlink to the uav without showing this in the GCS is very risky, how can you verify the uav is still functioning correctly?  You do need to have feedback about what the uav is trying to do, otherwise it may as well be a fly-away.

    Assuming 10km distance and 60km/h flight, you'll be 6 minutes on the way. As you suggest, that's pushing the limit already.

    Sounds like what you want to do is a more sophisticated mission planner above the simple "GCS interface", one which includes mission and task planning to be able to dynamically respond to the scenario.

    If you have public data about the terrain, you can exploit this geo data to calculate potential exit routes or hiding places (unless the terrain is homogeneous) using a couple of AI algorithms. Beyond that, you should attempt to categorize the terrain to understand the difficulty of transport (speed) in blocks. This helps to understand how fast the search area is growing, in which direction and where the most likely exit routes are located. For some easy data, consider openstreetmap databases. In your area it's probably a bit sparse, but the good thing is that they have existing software to add your own data and interfaces to use the db.

    Positive search focuses on actually finding the guys, but sometimes a negative search (scanning areas to confirm that's where they're not) can be very effective from the perspective of total effort, because it could take a lot of effort for the good guys on the ground to get somewhere. It will always be a collaborative effort though.

    The typical response to these events is that people start a grid search starting from the event location. As you indicated, they're starting to flee after 5 mins. The best strategy is to find methods to keep the search area constrained.

    Sounds like a very interesting project you have there :).

  • Petrus,

    That's a terrific combination of ideas and technology. It's great to see such ideas applied to the poaching problem. The poachers seems to be winning the battle. Ideas and technology like this are needed for leverage against them, imo. Congrats!  

    Do you see ways of getting this project funded and scaled-up in a major way? So it can have a global impact? 

  • Developer

    If you want to send mavlink messages to guide arduplane to some position defined by your sensors, perhaps start with Mavproxy, a simple command line GCS. It is easy to extend Mavproxy with modules written in python. Look at the sample module for joystick or for a simple example of a Mavproxy module which talks to an external input and sends a mavlink message.


  • Stefan, Thank you I will look into MAVlink.h. The launcher will have external power and will be controlled and monitored by a microcontroller. The microcontroller will also indicate whether there is an airplane on the launcher, including its status. We might have numerous of these setups across the area to be covered and the system will interrogate the closest launcher on status, if that aircraft is already out it will send an aircraft from a 2nd launcher


    The poachers don't hit only one spot, they have numerous teams and hit different areas at the same time.

  • @ Gerhard, Thank you I will look into that post and see if and how it can help.

    Gary, there will be a pilot in the loop, probably waiting for an event to take place and then scrable into the seat as if it was the Battle of Britain. I wish to shorten the timespan from the actual gunshot until we have an aircraft in the air. It will only be a matter of seconds if it can be automated, if we need to manually transfer the GPS waypoint to the aircraft, valuable time is lost and also a very high probability of the actual GPS waypoint information. As you know, the areas which has to be covered can be very large and flight time from a base position to the event location might be 10 Km or more. We have max 5 minutes to be on location, by that time the poacher is on his way out.


    So by automating the take-off and waypoint with a script, the airplane can be in the air, heading to the waypoint when the pilot takes the seat.

  • Why do you want to go through APM-Planner? If the plane is switched on, you could send the mission directly to the APM via telemetry. Check Arduplane source code on GitHub! The MAVLink.h is fairly easy to understand - at least I did understand it and I'm rather a hobby programmer than a real developer.

    Another question: How do you solve the power problem? If the plane is switched on while on mission-standby, it's continuously drawing current from the battery. Or do you have some kind of external power source incorporated into the launch system?

  • Moderator

    Legislators will always want a man in the loop at some stage. At the moment most countries with regs permit one airframe one pilot only. I don't see that changing much for a while.

This reply was deleted.