Stuff related to MAV's (and UAV's) from a hobbyist's point of view. Info

Autopilot software architecture

I’m used to working with big bloated enterprise architectures. However this is not what I wanted for my autopilot’s architecture.
The main requirents are:
1. Low computational overhead.
2. Easy to understand for the “average hobbyist”.
3. Can be relatively easy adapated for different hardware platforms.
4. Clean.

So I came up with this straightforward 2-layer architecture:

I didn’t use a middle layer to decouple the hardware layer even further from the logic layer. The main reasons for this are requirement 1 and 2, but also because I believe it is hard to predict how different hardware would be used (eg. with or without interrupts).

Open for comments!

29 February 2008, 12:03 | Link | Comments [6]

Progress on the autopilot

I didn’t do this incredible much on the autopilot since the last post. Flight tests and other work took most of my time. On the code, most of the work went into:

  • Documentation. I used doxygen for the code documentation. Maybe the generated documentation won’t be used a lot, but at least a code documentation standard is set with this decision.
  • Waypoint navigation. I added basic waypoint navigation. Right now the waypoints are still defined in the code, but I plan to store them in the Pic’s EEPROM. This would allow about 30 waypoints. Enough to start with!
  • Refactoring. The code was already nicely structured, but I refactored some parts to make it more readable.

I’m still undecided whether configuration should be saved in EEPROM (and thus changeable at run time), or at compile time (as the paparazzi folks do). On the long term, I guess it’d better be changable at run time…

Flight tests were promising. Sunday I flew my easystar in winds with about the same speed as the easystar at 3/4ths throttle. Stabilization was no problem. However I needed to fly the easystar at full throttle most of the time, which indicated that an altitude hold-feature would be very usefull :-) I’m just afraid that the GPS altitude will never be accurate enough…

Before making any part of the code public, Mariano will help me in further testing and improving the autopilot. I think one of his main interests are the development of a CAN bus architecture for adding other modules to the autopilot. Obviously his tests will probably reveal a lot of bugs/improvements due to his other setup (eg. negative shift for PPM?).

For the moment, I can’t tell when it will be released in public. One of the main reasons for this is that I would like another iteration of the hardware design ├ánd I would like to offer the hardware in a webshop because I believe that the hardware availability is one of the major setbacks of the current open source autopilots.

27 February 2008, 20:31 | Link | Comments [1]

First successful autopilot flight

After a long period of bad, rainy & windy weather, we finally had a perfect weekend. Sunny and only 1-2 BF wind. Perfect for testing my autopilot.

After some first tests on Saturday, I discovered my EB-85 GPS was also suffering from a known firmware problem. After a minute of flight, the data coming from my GPS module was useless, and my plane kept flying North instead of circling around the home waypoint. Damn you, E-Tek!
Anyhow, as a quick hack to make things work a bit more reliably, I hot-restart the GPS unit every 50 seconds. Also, I set the maximum roll angle the autopilot will use to 17 degrees. These gentle movements will less likely confuse the GPS unit.

And it worked! The easystar circled nicely around it’s one waypoint (being the take-off position). For 25 minutes, my transmitter was laying on the ground while I was just watching the plane. Must have been a weird sight for the people passing by for a walk on this beautiful day :-)

These are some other things I’m having in mind for my autopilot:

  • Programmable waypoints
  • Improve attitude stabilization on fast unstable planes
  • A downlink with some kind of groundstation software
  • Document the code better
  • Create a new PCB with static and maybe a dynamic pressure sensor… + using a dsPIC with more flash ram.

I only I had more time :-)

13 February 2008, 09:42 | Link | Comments [6]

First flight with my autopilot

Two weeks ago, I crashed my micropilot plane. Repearable, but I thought it might be a better idea to use an “easy” plane for the first tests with my autopilot. Also, the limited space available in my delta plane was an issue. And so I bought an easystar. The space under the canopy is very generous, which makes it easy for testing. I installed ailerons on it to make sure it would respond swiftly to my input on its roll-axis.

The first two flights were quiet a disappointment. Flying level posed no problem at all, but making coordinated turns was not as good as expected. Suddenly, I realised I was flying the easystar in 20km/h winds, while the plane only flies at – like 30km/h? Obviously, the pitching behaviour of the eastar when flying upwind or downwind is completely different. I suppose it was just a bad idea to try it in such high winds… Also, the autostabilizing behaviour of the easystar makes it a bad choice as a roll-stabilized plane.

In the late afternoon, when the wind fell between 5 and 10km/h, I did another test. And it was a success! The easystar flew nicely, no weird pitch behaviour anymore, and coordinated turns (and coming out of) were a success! Yiha!

Right now, I just updated my PID code. Now it is much more general. However, this “clean” approach made the update rate drop from 50 updates per second to 41 updates per second. So I was wondering: If you had an autopilot system, would you mind sacrificing performance for clean, readable code? And what about using integer math instead of floating point math (and thus losing the correct “scientific” units)?

No need to worry just yet: my dsPic runs at 7.8MHz, and its capable of 80MHz :-)

9 January 2008, 20:37 | Link | Comments [9]

Older articles | Newer articles