[Paparazzi-devel] Wasp - A Rewriting Paparazzi Experiment
From:
John Stowers
Subject:
[Paparazzi-devel] Wasp - A Rewriting Paparazzi Experiment
Date:
Fri, 17 Jul 2009 12:11:11 +1200
Hi Guys,
Over the past few months I have been experimenting with rewriting paparazzi, particularly the booz (aka quadrotor parts). I have now been running solely this code for the last few weeks with no crashes, accidents, or surprises, I feel it is a safe time to announce the work.
To run: 1) cd wasp/src 2) create your branch to hold your configuration
3) copy your generated airframe.h and radio.xml from ppz into config 4) perhaps adjust config.h and airframe.h if you have a slightly different hardware configuration to me 5) make upload 6) I also have some ground-station tools (written in python+pygtk) which I am still deciding what to do with. The current paparazzi ground-station is excellent, and I do not wish to offend by releasing another one, especially as my tools talk directly to the serial port, and not over IVY. If you want to take a look at this groundstation, perhaps to test any of the rewritten code, then email me.
Goals; * Re-factor the HW/SW abstraction. Currently the booz HW abstraction is a mixture of both an abstraction of peripherals (I2C, SPI, SSP), and an abstraction of subsystems. I am moving to a subsystem based abstraction only. ins.h, imu.h, ahrs.h, etc. In general, headers define only interfaces, implementations live in subdirs.
* No more macros. None. Every one I see than can be replaced, i will do so. Replace all macros-as-functions with static in-line, and replace all macro constants with enumerations (and use -fshort-enums compiler option). All instances of using macro and pre-processor string expansion to achieve abstraction have been removed or replaced.
* No code in header files, except for the occasional static in-line function. No macros to act as functions in headers.
* No/Less generated code. Communication layer is more dynamic. Separation of dispatch and message assembly. Functions are registered as callbacks for both message sending, and message receiving. * Runtime adjustable telemetry frequency and messages
* Explicit include paths to improve readability. No more "include radio.h" -> "include generated/radio.h", "include airframe.h" -> "include config/airframe.h"
* Configurations are handled by git branches. One configuration per branch. No more makefile generation to abstract configurations. Git can take care of most of the merging for me. * Documentation near the code. All public subsystem interfaces will be documented.
* Build all the code all the time. No (less) conditional compilation. Let -Wl, -gc-sections and the linker remove code that I am not using. * Clean up the build system. Single makefile.
Feature regressions
* Removed flight_plan.h and all navigation layer. Will re-add when I think of a way to do it without so much code generation. * Settings functionality currently missing. Currently re-factoring to be more like the new communication layer, with function pointer like dispatch for setters and getters of values. Incorporating this new implementation with eeproms for persistent storage of settings.
* Only fixed length arrays are supported in the communication protocol
Benchmarking this against paparazzi shows the code size is within 5%, and the performance, measured (by flashing an LED) as time taken to call certain functions is indistinguishable.
TODO * There are still some subsystems that cross the hardware abstraction, which I am working on removing, e.g. analog, and the ins calls hw specific baro calls. * Go back and check my comm protocol is still wire compatible with ppz (I think it should be)
All thoughts appreciated. I probbably have forgotten some things.