paparazzi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Paparazzi-devel] Real Time Paparazzi with ChibiOS/RT


From: Chris
Subject: Re: [Paparazzi-devel] Real Time Paparazzi with ChibiOS/RT
Date: Thu, 10 Oct 2013 15:28:00 +0300
User-agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.0

That is true, i don't doubt the benefits i am just sceptical about the added complexity.
You know what they say, you can't teach an old dog new tricks :-D
In my case i have already started reading about chibios as we speak...
Chris


On 10/10/2013 02:56 PM, Hector Garcia de Marina wrote:
Hi Chris,

it does not sound offensive :P, think that ppz could not be the highest layer of software or the only task running in your micro.

For instance, imagine that you have a "heavy" (in the sense of computation) algorithm or whatever running in your micro. If I am not mistaken, all the tasks in the current firmware are atomic, that
means that once your task starts, the others can not start until the former one is done.  I.e. If you have a heavy task then you will delay the rest of the tasks and this will ruin the control algorithms.

With a scheduler you will avoid such situation. A practical example could be a guidance system based on the optimization of some cost function (computing an optimal path based on some requirements in running time, so there are not fix waypoints), such algorithms usually are heavy but they only need to be run at very low frequency.

Other task could be image processing, I/O operations with SD cards (with no deterministic size of data such as in the logging case), etc




On Thu, Oct 10, 2013 at 12:15 PM, Chris <address@hidden> wrote:
Although i never understood why someone needs a real time OS in real embedded (one microcontroller with ram flash etc, not a full blown computer) i will give it a try.
In my mind to enter a car race you need a racing car, an all around car for racing , family and commuting simply does not exist.
Please forgive me if i sound offensive it is not my intention, i am merely stating my opinion.
Chris



On 10/10/2013 12:28 PM, Michal Podhradsky wrote:
Thanks Hector.

We don't use libopencm3 at all, it is ChibiOS HAL only, so Paparazzi is "shielded" from the hardware.

I've seen the discussion you linked at, and there are some cool ideas (tickless kernel, CPU usage monitor). However, right now we are using ChibiOS 2.6.1 (the latest stable as far as I know). I am not sure how fast is the development on the ChibiOS side, but I assume it is a slower pace than Paparazzi has, so ChibiOS 2.6+ should be good for foreseeable future.

I think ChibiOS 3.x would be cool to try once its stable version is available.

Regards
Michal


On Thu, Oct 10, 2013 at 3:14 AM, Hector Garcia de Marina <address@hidden> wrote:
This is a really nice job, thank you so much for this work.

If I am not mistaken, you are using the HAL layer of ChibiOS right? or at the moment you are mixing the HAL from ChibiOS and libopencm3?

In my opinion, a stable (frozen) version of ChibiOS should be chosen since changes in the code of ChibiOS (specially with HAL) might trigger some issues in the future. Furthermore, there is a new version of
ChibiOS in development (http://forum.chibios.org/phpbb/viewtopic.php?f=3&t=817) , in this new version the HAL will be independent from the Kernel (such as libopencm3). Therefore, it should
be easier to migrate the code to other platforms in a near future.

I guess a discussion should be opened in order to pick up one version of ChibiOS (2.x or 3.x), what do you think Michal?


On Thu, Oct 10, 2013 at 10:55 AM, Michal Podhradsky <address@hidden> wrote:

Dear developers, dear community,


Here is the first version of Real Time Paparazzi, based on ChibiOS/RT(http://www.chibios.org) and extending work of @enacuavlab. It is certainly not a complete work, rather the first step how to adapt Paparazzi to a RT OS. The system is developed and tested on Lia 1.1 (STM32F1, http://paparazzi.enac.fr/wiki/Lisa/M_v2.0) board, so it can be easily used in existing autopilots.

The system architecture is shown below. To change as little code as possible, Paparazzi interfaces with ChibiOS via new main_chibios.c file (main thread, invoking other threads according to the system settings) and via arch/chibios files. Those are basically middleware, translating between high-level architecture independent paparazzi functions (such as uart_transmit) and ChibiOS HAL API (such as sdWrite).

To get the full potential of RT system, the monolithic Paparazzi application had to be split into more individual threads. Threads are effectively replacing periodic function and events. That is probably the biggest change. The rewards are control over task timing and priorities, and hardware independence for Paparazzi. The ChibiOS drivers are also expected to be more efficient, since DMA is natively used where applicable (USART, SPI).

The code is available here: https://github.com/paparazzi/paparazzi/pull/554

Inline image 2

Benefits of ChibiOS/RT&Paparazzi:

  • HAL for interaction with HW (libopencm3 not needed, deployable on any architecture that ChibiOS supports - see http://www.chibios.org/dokuwiki/doku.php?id=chibios:architectures)
  • Real time system (precise control over task timing and priorities via independent threads)
  • Error handling (defined error handlers, timeouts for tasks/threads), fixes for example #531

Features of version 0.1:

  • Paparazzi & ChibiOS compiles and run from Paparazzi center
  • Upload over JTAG or DFU (bootloader)
  • Rotorcraft firmware with ap target (hexarotor_lia_rt.xml)
  • Telemetry and GPS works (as an example of I/O handling - ublox and PprzTransport)
  • Heartbeat and basic OS info available
  • Example of arch/chibios code (uart_arch.*)
For illustration, the current system set-up is shown below:
Inline image 3

Note:

Pending:

  • Finish arch/chibios middleware for all peripherals (SPI, I2C, PWM, PPM)
  • Add threads for subsystems (imu data, ahrs, actuators) and modules
  • Figure out the best way how to interface the current events/periodic functions with threads
  • Mutex for all structs that can be accessed simultaneously (e.g gps, ahrs, ins...)
  • Define timers and error handlers for peripherals (i2C etc)
  • set ChibiOS as a separate github module (so it can be updated by ChibiOS developers)

We would gladly appreciate any feedback on our work, especially code style/attribution, architecture design, interface between Paparazzi and ChibiOS etc. so the RT Paparazzi can fly soon!

With regards
Michal and Cal
http://aggieair.usu.edu/


_______________________________________________
Paparazzi-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel




--

_______________________________________________
Paparazzi-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel




_______________________________________________
Paparazzi-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel


_______________________________________________
Paparazzi-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel




--


_______________________________________________
Paparazzi-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel


reply via email to

[Prev in Thread] Current Thread [Next in Thread]