I'm a Programming Intern and I've been given the assignment to control a QuadCopter (using APM 2.5) without the Mission Planner or RC Controller. Some goals are to be able to communicate with the QuadCopter, go to a specified altitude and stay there until it's commanded to land (for now).

I want to be able to control it using programming code from my computer. Has anyone ever heard of such a thing? Does anybody know where there are some good starting points to read about? Where can I go to get more information on controlling the QuadCopter from the source code?

Thanks in advance.

Views: 15618

Reply to This

Replies to This Discussion

Hey Mike, 

I'm looking into something similar. Here are some leads I have found:

If anyone knows of any other good links/leads please let us know. There might be an elephant in the room that I'm missing that could make life much easier. Maybe some hacked away version of ArduPilot already.

It seems like if you want to give the ability for people to navigate around by clicking where to go on a map and specifying altitude, the fly by wire approach would be easier as you let the autopilot do the heavy lifting. I'm pretty sure the loiter and waypoint commands will do the trick for your first part as you described.

Because of the GNU GPL v3/Creative Commons 3.0 BY license of ArduPilot you can just rip out all the good bits of  code, add in your own, and hide away any parts from the users that you need to. Since I don't think lag will be too much of an issue (autopilot makes real time controlling un-necessary)  I'm going to try to make a program in Python that does any processing needed, then gets the APM/Mission Planner to do the next command.  Lucky for me there is already a Python module called MAVProxy for the protocol. Automated GIS surveying here I come! 

I haven't dug too deep into this yet, your post spurred me to look into it just now. 

Good luck, have fun!


Someone here is part of the way there: http://diydrones.com/profiles/blogs/scripted-fixed-wing-acrobatics

Something else in the right direction:  https://code.google.com/p/ardupilot-mega/wiki/ProgrammingArduino 

...and there is a whole sub-section about this: http://diydrones.com/group/learning-to-program-the-ardupilot-mega 

Awesome!! Thank you very much on the info. I'll keep you posted on if we learn anything that may be helpful.

I'm glad I could be of some help. After seeing many threads like this go unanswered I figured some one needed to post more about how to control a RC transmitter with a PC. Or tasty flavors of linux. 

I still haven't found all that I need so I will keep looking too. If you want a more direct way to control the plane/quad without needing an autopilot on board, here is a way to use an Arduino to fake a signal to the trainer port on most RC transmitters:

Your computer tells the Arduino to "pulse 1500 on ch 3" or something like that, the Arduino tells the transmitter through the trainer port, the transmitter sends out a radio signal to the receiver, and finally the receiver tells the servo or motor to do its thing, and bam. Computer to RC controller.

I don't know how much you know about RC, but buddy boxing is when you hook up two transmitters together with a cable (3.5mm audio often), and the "trainer" can override the "trainee's" transmitter if they are going to crash. The trainer just flips a switch and they are able to use their transmitter's controls, but the trainee's transmitter is the one that actually sends out the radio signal. Kinda like those student driver cars with a steering wheel and brake in the passenger side for the instructor.

I figure I'll end up using a mix of both approaches over time with different applications.

Good luck!

I guess essentially what I'm wanting to do with this is kind of create my own Ground Control Station except making it SUPER simple (for the time being). Once it's actually up and running, then I can make it more powerful. I feel that I've gotten close on a couple of attempts but nothing has seemed to stick or at least pan out. Maybe I'm just looking in the wrong place.

Writing up a simple UI shouldn't be a problem. Guess you just have to figure out how you want to communicate with the APM mid-flight. I'm going to use pymavlink myself.  Sending it signals to change altitude, or give it a new waypoint/heading shouldn't be hard.

I'm going to build a crappy remote controlled car thing out of styrofoam and wire hangers to practice/debug my UI/mavlink communication system before risking it with flight. Turning wheels or rotors is the same principle to the APM, and if you have the hardware (car motors, etc) lying around, a very basic car with one motor per wheel can be done in probably less than an hour total. Did I emphasize the crappiness of the car?

I also live on the ocean and have high winds so failure can be very costly.

Good luck!

No, the UI will be easy as cake. I'll have to look further into pymavlink however. The remote control car sounds like a good testing place as well. I'll have to see if I have anything lying around that I can use, even if it doesn't make a remote control car, it could still control some motors. Thanks for the input.

Good luck

I too am using pymavlink. I have a simple script that is interacting with mavutil and the generated mavlink script. I just can't seem to get the auto mode to work without having to use rc controller. If anyone knows away around this it would be great.

I will still be using the controller while testing as a fail safe.

Right now I have too much programming work to do, but within a couple weeks or less I should have some huge time gaps where I can play around with pymavlink. I'll post my scripts and code once I get it working for me.

After that I'm also going to integrate image processing and machine learning into my software for fun. A little goal of mine is to be able to play hide and go seek with my tri/quadcopter.

Gotta love the programmers excuse for screwing around: it's compiling, can't do anything until it finishes! (well executing in Python, but still)

I will also post any code or tips that could help others. 


I'm also really interested in these issues.

We are using MavLink protocol to control a QuadCopter using APM 2.6 (or at least trying). We would like to take off the QuadCopter when a camera detects a target.

By now, we can easily arm the QuadCopter with a computer trough MAVLink, but we're stuck on the take off (we are planing to use missions). If anybody is interested, I can help in arming the QuadCopter with MavLink command.

Any help for take off is welcomed.


The combination of wireless mavlink, python scripting for apm control, video telemetry, and opencv is unbelievably powerful. I am surprised that more people are not exploring this. For example it is possible to create a fully autonomous aerial video quad that can track faces and aim the camera/navigate to get a desired perspective while allowing the subject to move about. Who needs a camera man? The possibilities are endless.

Reply to Discussion



Season Two of the Trust Time Trial (T3) Contest 
A list of all T3 contests is here. The current round, the Vertical Horizontal one, is here

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service