Hi everyone,

Im currently writing a program that compares the drone's current location coordinates with the waypoints coordinates so once they match a script is executed. My question is how do i access those waypoints that were loaded to the pixhawk via a GCS, is there a topic i can subscribe to that contains these?

Views: 270

Reply to This

Replies to This Discussion

If I understand your question correctly, you want to trigger another plot on your drone when your drone reaches a certain lat and long position automatically without flipping the flight mode switch to Auto?

Please confirm.


Hi Asim,

Thanks for commenting and sorry for the late reply. Im not sure i quite understood the question so First thing first, this is strictly software. Two apps are going to be uploaded to the FC(PIXHAWK). Im writing an app(via uORB messaging in c++) that monitors the current location of the drone so that when its location matches that of the waypoint's, the drone stops and executes the other App, but for this i need to access the waypoints coordinates that were uploaded to the pixhawk, is this possible to do via code?

Theoretically yes, practically not sure :)

Let me get creative here and suggest an alternative way to do what you wan to do. But, are you familiar with Mission planner flight mode feature? if not you need to get familiar with it for this to work.

In layman terms on your radio Tx when you send a command to Pixhawk to go into "Auto" mode, regardless where the drone is in the air, it will go to the starting point that you predefined in mission planner way point, which you have already uploaded into the pixhawk. Once it reaches its predefined starting point (you can set, height, speed etc. etc. in advance), it will to predefined paths.

Run Mission Planner, go to "Flight Plan" tab, create a fake Flight plan, and save the file so you can view it later.

PixHawk is looking for command 

You can watch this video I just uploaded Video

In your software what you need to do is as follows:

1. Your software that monitors the current location of the drone will use the predefined lat and long positions (which are basically the way point starting point prestored in PixHawk) as the software trigger to kick in the Auto Mode. I would give your program +/- 5% lat long tolerance as GPS used on drones are not military standards, so there is always a margin of error.

Once your program see the defined lat long values within defined range, all you need to do is tell PixHawk via software command, inside the PixHawk controller, to go into auto mode.

Simple solution! Conceptually it should wok, however I am not sure inside PixHawk if you can run two routines simultaneously unless there is another block where you can store your program and it doesn't impacts the way point data and other processing power of Pixhawk.

Let me know if this works. if it does, I want a copy of your program :)

p.s Looks like final Engineering program thesis to me :)))

here is screen shot of Flight mode parameters.

Exactly, "Your software that monitors the current location of the drone will use the predefined lat and long positions (which are basically the way point starting point prestored in PixHawk) as the software trigger to kick in the Auto Mode". Now i'm wondering if you known of a way to access these predefined positions in the pixhawk via uORB code?

I also have one more question but its regarding Ground control stations as i'm rather new to this. I know they monitor the position of the drone at a all times, and allow you to set the flight mode and even send "Messages" to the drone. Are they in any way programmable? automizing the GCS via scripting might be more efficient. For example once it reaches x way point position, ill tell the GCS to switch from "AUTO" to flight mode "HOLD", since this is similar to what im trying to do but i'm doing it within the PIXHAWK.

I've read about MAVLINK protocol and it may be a better option than the PIXHAWK's uOrb communication API, but i just havn't seen any proper documentation regarding the code side of it and im sort of lost in properly understading it.

Thanks! And it's not a thesis per say but an essential part of a research collaboration with MIT lincoln labs and other engineers.

Well I am a rookie when it comes to programming PixHawk directly as I am just beginning to get my hands dirty, but we can learn it together :)

Ardu pilot is comprised of libraries which you can call from your program. First check this Link

So the library you need to tap into is called  AP_WPNav - waypoint navigation library and the other one for you need would be the AP_GPS - gps interface library

Your starting point to learn coding Pixhawk is to read all these documentations. Pain in the neck Learning the ArduPilot Codebase. Keep in mind all these documentations are dated to some degree but its a start.

I honestly wish if someone offers a training class on Ardu pilot coding. I would take it in a heart beat.

Ground station use MAVlink protocol to send messages via a 915Mhz TX/Rx to PixHawk or through a direct USB cable.

As long as your done is within telemetry range, for what you are trying to accomplish i think will be easier that you run your program on a lap top, use telemetry to receive GPS Co-ordinates as your trigger, and send Auto mode signal via TX to the drone. This way you don't have to mess with PixHawk programming altogether.

I am sure there are people on this site who have done all this before. May be someone else can chime in here.

Check out this thread..Link

I dont think my original reply went through,

Anyhow, im not at home right now so i'll have to check the links later, this seems promising, Asim. I did a quick search on Ardu Pilot but im not 100% clear with what it exactly is, can you elaborate real quick on it? It's not a GCS that much i figured.
One more thing, thank you for helping me out! I've asked around other places and you are the first person to answer me hahaha.

Red this page. It will give you the history. They are just different versions of PixHawk. Pixhawk is the latest Flight controller.


AND MAKE SURE YOU HELP OTHERS when you learn a thing or two. I am surprised to see so many people view and read questions posted by people and very few volunteer to help. Not good :(

To answer the question, yes GCSs are scriptable. Here's how to script Mission Planner with Python:


Hi Chris,

That's exactly what i was looking for originally. In the hopes that you have done this before, i got three questions i hope you could answer

1)In Script.sendRC, when is the value sent when the "sendnow" boolean is false?

2)Can i somehow check the connection between the drone and the GCS? I know that there are failsafe parameters regarding that specific comm with predefine instructions on what to do according to the value set in case the signal is lost for 5 Secs or more, but what if i want to define my own set of instruction on what to do when that comm is lost?

3)Can i inject waypoints via script? I saw an example that imported mission planner utilities i think? In order to do this But i cant find the library anywhere.

Thanks in advance!

Reply to Discussion


© 2017   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service