We're been making progress on the ArduPilot code and are getting closer to releasing a proper beta. In the meantime, here's an update (and, for the brave, a pre-alpha look at the code):

The basic outlines of the code (GPS parser, navigation loops, altitude control, servo control, etc) are written. The GPS parser is pretty well tested and works okay. The navigation algorithms have been tested on a simulator, but still need to be tested in the real world. The servo control needs to be tuned. Basically, the basics seem to be working okay, but it can't fly a plane yet. If you want to see it in its pre-alpha stage, you can download it here. Comments and suggestions very gratefully received.

If nothing else, the code as it now stands is at least a tutorial on GPS parsing, basic navigation principles and RC interfaces. It's more than just a port of our Basic Stamp autopilot--we've really upgraded the navigation routines and waypoint handling, as well. Over the next few weeks, it will actually become a useful autopilot, too!

(Note: this is the code for ArduPilot. Jordi is writing the enhanced version for ArduPilot Pro, and that won't be ready for a few more months)

Some observations on writing the code to this point:

1) One of the hardest things to work with on Arduino is serial. The IDE uses the hardware serial pins, so if you're also using them for your GPS, you have to unplug your GPS every time you're uploading new code (you can still share the pins with the IDE for debugging text while the code is running). More troubling is that the serial routines aren't as rock-solid as those of the Basic Stamp, so it's easy to flood the buffers or otherwise mess up the serial timing if certain loops in your code are running faster or slower than you expected. You can actually do serial on any digital pin using software serial routines (either the official one or the better AFSoftSerial), but the timing problems are even worse for the software routines and because they don't use hardware interrupts, they take a toll on processor power.

2) For me, the hardest part about switching from Basic Stamp to Arduino (which is basically C) is that I keep forgetting to use a double "=" for logical comparisons. "if (x = y)" will always return true, because you're actually setting x to y in the statement. The correct syntax is "if (x == y)". I know that everyone is now slapping their head at what a noob I am, but the truth is that I've been programming in C long enough to know this. The problem is that I also program in other languages that don't have that syntax. I can't tell you how many hours I've wasted tracking down bugs that came from making that mistake.

3) On a positive note, after the nightmare of Basic Stamp's integer-only math and tiny variable memory, it's an absolute joy to use floating point without a second thought and use as many variables (even two-dimensional arrays) as I want. That alone is worth the price of porting the code to Arduino.

Views: 898

Comment by dincer hepguler on July 19, 2008 at 12:08am
please know that we appreciate your efforts very much. i ordered my v3 board and some missing components (attiny, gps socket etc) from sparkfun and it should arrive nowadays. i will be pleased to test the first member board made.. i downloaded the alpha code and working on it trying to understand what it is doing ( i am not an expert c programmer). but humbly may i note that, the sharing of serial (IDE and GPS conflict) could be overcomed by a simple jumper. i got and assembled the ladyada's gps logger shield for Arduino and it works great with Google Earth. the same sharing problem was there and there is a jumper near the serial which you can pull out and upload new program while gps is plugged and working. the jumper temporarily disconnects the GPS..
hoping to receive new updates of the code... may the luck and power be with you...


You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2020   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service