UAVP-NG: Source code release of NGOS - The NG Operating System
Modified by Amir on the 26. Apr 2018 at 01:18 in UAVP-NG | Permalink
NG-badge.png The Next Generation Multicopter team would like to announce the source code release of NGOS - The NG Operating System under a GPLv3 license after 3.5 years of intense development time.


Check out the UAVP-NG homepage for more informations!

Official binaries:

Release source code repository:

List of supported platforms:

  • NG HW-0.10
  • NG HW-0.20
  • NG HW-0.21
  • NG HW-0.22
  • NG HW-0.22-mini

For a complete list of changes refer to the Release Notes at https://ng.uavp.ch/moin/Download

uavp-ng-flang-clean-small-600.jpg

The Beginning

This project was started in summer 2007, half a year after the original UAVP, also a GPL project, was released. All over the world UAVPs started to get built. At that time, many of us started dreaming of bigger and more powerful processors, peripherals and sensors. The current projects available at that time seemed not to be able to scale according to our needs, so the idea of something new was born. In April 2008, about a year later, there were about 500 UAVPs airborne around the world.

Having flown most of the other open projects available at that time some of us decided that they did not offer the resources we wished to have on our copters. Especially when looking into the future it seemed that none of them had the scaling possibilities needed. Studying the available processors we realized that we needed to switch processor types to get the computing power we dreamed of. Neither PIC nor Atmel could provide what we needed.

In the end we decided to go for an ARM7 and started the Next Generation Multicopter Project.

Our Goal

The development of a free Open Source Multicopter software and hardware framework for further research based on a high performance 32bit ARM7 RISC CPU.

The Story

We started work in August 2007 as a small team which met on IRC. The first hardware (HW-0.10) went airborne in January 2008. The software has been extended with a lot of new features after that. We then worked on a new hardware revision (HW-0.20) in summer 2008 and the first prototypes were produced some weeks before the 25C3 congress. The new hardware got airborne in December 2008. After 25C3 we improved the flight control software immensely and started working on the peripheral controllers software support for the new hardware. Having tested and flown HW-0.20 a lot we decided to improve the hardware in summer 2009 and so we started work on the next hardware revision (HW-0.21). We finished that in June 2009 and produced enough boards for all beta testers and developers to thoroughly test the hard and software. The new hardware got airborne in August 2009. Discovering small problems and print issues we decided to produce one last hardware revision 0.22 fixing those before a final release. We hoped to produce this revision before 26C3 and have it ready for a first public release at 26C3. We succeeded and did a hardware release with HW-0.22 at the 26C3 Congress in Berlin.

Finally having a stable hardware platform out in the green, we started working on the source code immediately after returning from the 26C3. Cleaning out the source, commenting and polishing while still implementing new bells and whistles took the time from then until today.

Be aware that this still is work in progress. We decided that it's time to let everybody play with it, now that the hardware has reached a stable state but this is still a very livid project and new hardware revisions and software changes have to be expected any day... ;)

The Design Principles

The design principles of the NG project are simple:

"Complexity, modularity and encapsulation where performance allows it, simplicity and directness where performance requires it."

This has led to a quite complex framework which we started calling the NG Operating System. The system uses abstraction and complex pointer tables where necessity requires it and performance allows it. It uses global variables and breaks encapsulation where performance requires it. We use classic Open Source tools like the autotools suite, gcc and gnu make. We adhere to common C design rules. And we try to provide a user friendly interface with features like help for commands and verbose error messages.

The Key Features

The NGOS has a design rather different from most available flight control software. Instad of building a fully synchronous system as most did, we built a fully asynchronous system which only synchronizes when needed. This allows for a much more modular design and also allowed us to implement modern operating system like features.

A Multicopter only flies as good as its algorithms allow. Since the model is inherently unstable the closed-loop control algorithm is most critical for flying. People tend to have different ideas about the right algorithms. In order to allow different developers to implement different algorithms and to help compare them we designed the NG controller framework.

Our NGOS uses a modular, pluggable extension framework for closed-loop control algorithms, called controllers, and allows for several of them to be implemented at the same time using a simple abstract programming interface. This enables simple extensions to the system's closed-loop control algorithms by people not used to firmware and system programming. The modular controller framework is coupled with a modular configuration framework, allowing each Controller to have a different set of parameters in different configurations. Several controllers have been implemented. We have a good flying heading hold controller, a Kalman filter based integral controller with a lot of features like PT1-compensation and more and last but not least a port of the old Wolferl-controller from the old UAVP, which, BTW, flies very good with a closed-loop running at 1kHz... ;)

The system allows multiple interactive command shells and their spawned commands to be used concurrently on the different physical i/o devices. This means you can log in to your NG several times through one of the two UARTs or the USB port. Other available character devices could be supported as well. The shell command interface is also very modular and allows developers to add new commands quickly for debugging and testing purposes. A command can "take over its controlling tty", which allows an implemented shell command to put the shell to sleep, take over the physical i/o device and start doing with it what it likes. This allows for implementing new communication protocols (for ground station communication or similar) side by side with older and/or different protocols without having side effects or worse.

Controllers and configurations can be manipulated online using one of mentioned shells above. The controllers output the results of their calculations to a physical hardware abstraction layer called HAL which uses a similar modular framework as the controllers. Different multicopter models (eg. QuadCopter, OktoCopter et al.) can be implemented and flown using different HALs. Different flight styles can be implemented this way as well (X-mode, Reverse-Mode). It's even possible to mix different actors (eg. i2c bl-controllers, pwm-servos and i2c-servos) to control models different from the common multicopters. We already support a whole bunch of HALs (quad, quadX, quadR, Y6, X8, X8X) and new ones are implemented easily.

The above is tightly coupled with a behavior system which allows the user to configure arbitrary behavior rules using simple behavior conditions and behavior actions. Users can customize these behavior rules according to their needs. A behavior rule is defined by a behavior condition (which can have arguments) which, when triggered, executes a defined behavior action (which can have arguments too). Conditions and actions are arbitrary functions implemented separately in the NG framework. The implemented console commands can be used to inspect the currently defined behaviors as well as the predefined conditions and actions. Users are able to define custom new behaviors using the predefined conditions and actions. As each condition and action can receive user chosen parameters these allow further customization by the user.

If you ponder the above behavior concept you will see that every and all of the current UAV features can be mapped to behavior rules. You need calibration on channel 5? You want your camera to make a photo when channel 8 goes to 100%? You would like to turn on the lights, when you have reached 10m or more... it's all possible.

The NGOS supports several different types of RC receivers. It supports the normal sum-signal input as well as the faster sum-signal from the ACT 4+2XS 2.4GHz sum-signal receiver. Furthermore it supports the proprietary serial DSL protocol from ACT which allows us to attach any ACT DSL receiver to the NG. ACT produces great cheap and expensive PPM, PCM, SPCM and 2.4GHz receivers and most of them have a DSL interface. The NGOS contains an rc-mixer which allows to mix several rc input signals in different ways. Currently a primary and a secondary device are supported which can be mixed as teacher/student or for diversity. As the DSL protocol contains the signal quality received the diversity mixer can mix the two signals accordingly. If in teacher/student mode, the mode can be switched using arbitrary behavior rules defined by the above user configurable behavior system.

The NGOS

Do you wonder why we call the firmware an Operating System? Now, we all agree, it is a firmware, but it has become a firmware with many, many operating system like features. The NGOS does hardware probing on startup and activates hardware dependent interrupt handlers. It outputs bootup messages while starting. It is split into user, system and irq context, the closed-loop controller is running on the system level, the user mode shells have to use system calls to use privileged opcode. Furthermore it has a timer scheduler and a task scheduler with a process table, it has a device table and it has tools to inspect all of them. The NGOS's device-probing dependent interrupt handlers could be called drivers. The started consoles implemented as cooperative shell tasks in user context (which are able to fork off commands) executed by a round-robin scheduler conclude the operating system like features.

The Developers and Users

Essentially the NGOS provides a simple API for controllers, configurations, HALs and behaviors programming for developers while giving users of the system very broad possibilities to customize their multicopter and the available features. This way the whole system will be interesting to users and developers with its unique options and possibilities.

The firmware is built modular and enables different closed-loop control algorithms to run side by side to allow different developers to share and compare their algorithms and designs. The abstract closed-loop controller framework allows non-programmers like mathematicians, closed-loop engineers and similar minded folks to implement new closed-loop control algorithms without having to understand more than input and output structures of their algorithms.

The Catch ;)

Please be aware that much of this source code was written by a single person - me. I am an EE engineer specialised in computer sience, system programming, network protocols, high-availability, clustering and security. I'm in no way a specialist for closed-loop controls, embedded system programming and aeronautics. Please be aware of this when studying the chosen solutions and implementations in these fields. I'm sure many experts out there could contribute a lot better solutions.

This all was - and still is - a very interesting experience and a lot of fun for me and I learned more about embedded programming and closed-loop control than I ever imagined I would... ;)

Your Contribution

If you would like to contribute to the project make sure to check the development page in the NG wiki. It can be found at https://ng.uavp.ch/moin/Development

Thanks

I would like to mentions some great guys who joined our team and contributed to improve hardware and software to where we stand:

  • Markus Bechtold
  • Michael Buhr
  • Axel Burri
  • Patrick Schmid
  • Nabil Sayegh
  • Ralf Hager
  • Stefan Agner
  • Tim Pambor
  • Nabil Sayegh

Also special thanks goes to Wolfgang Mahringer wolfgang@dev.uavp.ch who built the original UAVP and infected many of us with the multicopter virus and to Bernd Richter bernd@dev.uavp.ch who infected us with a lot of new ideas and who was a great source of information and knowledge to us.

The Spirit

We hope to be able to provide a platform for experiments, new ideas and research for all Multicopter fans out there!

Best regards!
- Amir Guindehi <amir@datacore.ch> & The NG Team <headdevs@ng.uavp.ch>

Amir Guindehi's Blog

Bits and pieces of my digital life...

Syndication

Validation