Real-time OS
I wanted to send commands to my UAV during flight. Implementing this on my ground station was not hard at all. Doing the same on my autopilot software turned out not as easy: parsing (and validating data that could be gibberish) data coming from the serial interface could potentially disturb the strict timing needed for my kalman filtering. That strict timing also prevented my from doing some other telemetry and dataprocessing stuff.
It was time to port my code to a real-time operating system. Also a good excuse to start playing with it :-)
I’m not familiar with a lot of those “free” RTOS’s on the net, so I picked up the most common one: FreeRTOS
I had read the documentation a few times before, but never got to the coding part. It turned out pretty easy! Thanks to the modular approach i used in the autopilot software, porting it to FreeRTOS was finished in about an afternoon!
Now I can add various new functionalities without worrying how to fit it in the current code.
Another advantage is “Run time statistics”. Before I thought I used about 40% of the CPU, but it turns out that I’m only using 6% of it:
TickTask 267 <1%
IDLE 49058 94%
5DofTask 2098 4%
ControlTask 481 <1%
GpsTask 16 <1%
- TickTask: the task printing this statistic (once every 5 seconds)
- IDLE: the idle task, when nothing else is running
- 5DofTask: the task calculating the attitude (Kalman)
- ControlTalk: the task calculating the PID control algorithms (50Hz) and the navigation (5Hz)
- GpsTask: the task parsing the GPS strings (5Hz)
|
Tom – what hardware are you running the RTOS on?
— James, 15 June 2009, 10:01 | #
I’m using a dsPic33 running at 80MHz.
The figures are obviously without the RTOS and interrupt overhead.
— Tom, 15 June 2009, 21:11 | #
Hello, Tom.
I am working on modifying the version of Bill Premerlani UAV IMU to gyro stabilize a Camera on my raptor rc helicopter. This board is equpiped with a pic30f4011. do you thing it would be usefull to port it on RTOS ? I have not really a good experience about creating treads and managing queues . but I assume this it not necessary for a basic implementation.
— Sandra, 24 June 2009, 08:54 | #
Hello Sandra,
the Pic30F4011 won’t be powerfull enough. I tried it on my previous hardware (pic30f4013) and the OS used up too much memory.
For your application it own’t add a lot of benefits anyway.
— Tom, 24 June 2009, 09:26 | #
Tom,
You are doing some very interesting stuff here! Could you please point me to any source code for your RTOS stuff. Regards Lewis
— Lewis, 26 July 2009, 17:54 | #
Elmic Systems creates high quality Embedded networking protocols including TCP/IP, IPv6, DHCP, IPsec, PPP, IGMP, telnet, NAT, FTP, TFTP, DNS, SMTP, POP3, Mobile IP, SMNP v1,v2,v3 and more Treck, Inc: Embedded TCP/IP, Embedded IPv6, and related Internet protocols
— mini sd 4gb, 7 January 2010, 15:24 | #