Introducing a robust multitasking OS 06.05.2013 1 Michael Fritscher
Introducing a robust multitasking operating system for real-time - - PowerPoint PPT Presentation
Introducing a robust multitasking operating system for real-time - - PowerPoint PPT Presentation
Introducing a robust multitasking operating system for real-time demands 06.05.2013 Introducing a robust multitasking OS Michael Fritscher 1 Agenda Introduction Architecture Function tests Benchmarks Conclusion
Introducing a robust multitasking OS 06.05.2013 2 Michael Fritscher
Agenda
- Introduction
- Architecture
- Function tests
- Benchmarks
- Conclusion
- Outlook
Introducing a robust multitasking OS 06.05.2013 3 Michael Fritscher
Introduction
- Robot platform (Merlin) existent
- New Microcontroller (XE167) and the IDE already working
- BUT: The used OS had neither the performance nor the support functions which were
needed by many tasks
Status before
Introducing a robust multitasking OS 06.05.2013 4 Michael Fritscher
Introduction
Design and Implementation of a new foundation for many different applications for the future Needed attributes:
- Containment and abstraction
- Preemptive multitasking
- Real time
- Detection and Reaction of error states
- Easy to develop with (It will be used by students)
Goals
Introducing a robust multitasking OS 06.05.2013 5 Michael Fritscher
Tasks
Task prototype: „Sensing-Processing-Reaction“
Wait for signals (releasing control) Get the control back Which signals were fired? Prozess the signals React
Signals fired
Introducing a robust multitasking OS 06.05.2013 6 Michael Fritscher
Architecture
Communication Task 1 Task … Task n IPC Frameworks (actuators, sensors, streams) I2C Data pre/post processing Common data structures Scheduler / Stacks Signals Heap Drivers
Overview
Memory (Stack, Page pointers, MPU) RTC Timer / Counters IRQs UART (COM, I2C, SPI) CAN A/D Convertors Digital I/O XE167 Core
Introducing a robust multitasking OS 06.05.2013 7 Michael Fritscher
Architecture: Scheduler
Normal operation
Task1
(preempted by scheduler)
Task2
(release control by itself)
skipped Task …
(waiting for event)
Task n Scheduler
Get control Loose control Get control Release control
Introducing a robust multitasking OS 06.05.2013 8 Michael Fritscher
Architecture: Scheduler
Incoming signal
Task1
(preempted by scheduler)
Task2
(release control by itself)
Task …
(waiting for event which fired)
Task n Scheduler
Loose control Get control
Introducing a robust multitasking OS 06.05.2013 9 Michael Fritscher
Architecture: Memory
- Stack
- Heap
Stack 2
Checksum Canary
Stack n
Checksum Canary
… Stack 1
Checksum Canary
Object 1
- Obj. n
Bitmap
empty
Canary Canary
3 … … End 1 End
Introducing a robust multitasking OS 06.05.2013 10 Michael Fritscher
Architecture: IPC
Inter Process Communication
IPC management list List 1 List n List … List 2 IPC message list Signal Size Number Msg 1 Msg n Msg … Msg 2 „double linked lists“
Introducing a robust multitasking OS 06.05.2013 11 Michael Fritscher
Architecture: Frameworks
Task Framework Filter Driver Hardware
Sensors, Actuators, Streams, I2C
Task Framework Filter Driver Hardware Task Framework Driver FIFO Hardware Task Framework Device driver I2C driver Hardware
Sensors Actuators Streams I2C
Introducing a robust multitasking OS 06.05.2013 12 Michael Fritscher
Architecture
- Connection to the outside world
- Normal task
- Uses the IPC system
- Connection orientated (with keep alives)
- Every packet is acked
- CRC-16
- No escaping of the payload
Communications task
Introducing a robust multitasking OS 06.05.2013 13 Michael Fritscher
- Integrity tests: During the normal operation
– Helps a lot against programmer’s mistakes
- Initialization tests: During booting
– Tests almost every component very thoroughly (almost no time issue here) – Helps a lot against regressions or undesired side effects of alterations
- System tests: Manually triggered
– Performance & usably tests
Function tests
Overview
Introducing a robust multitasking OS 06.05.2013 14 Michael Fritscher
Function tests: Integrity
- During the normal operation
- Crucial components: Scheduler, Memory, IRQ-Handlers
- “Test as much as possible and feasible regarding performance”
- Helps a lot against programmer's failures
– Invalid parameters – Invalid memory access (despite of having only a simple MMU!) – Abuse of system functions
Reactions: Useful error messages, restart to regain a safe state or halt
Introducing a robust multitasking OS 06.05.2013 15 Michael Fritscher
Function tests: during initialization
- During booting
- Very thoroughly test of all components of the system
– Heap/Stack – Queues – Scheduler – also with a set of test tasks
- Detection of hardware failures, regressions and undesired side effects of alterations
- Duration: 3 seconds
Introducing a robust multitasking OS 06.05.2013 16 Michael Fritscher
Function tests: The whole system
- Synthetic tests
– Test the interaction between the components – Complex test tasks, which interact with each other (directly or timely) – Only the board and optionally an oscilloscope required
- Realistic Test
– Use-case which could occur in normal use – Tests the suitability of the API and the system – Chosen scenario:
- Learn and retrace a way path with obstacle avoidance
- Control with ultrasonic sensors
Overview
Introducing a robust multitasking OS 06.05.2013 17 Michael Fritscher
- Two tasks
- Large set of tasks
Real time characteristics (delays of incoming signals): Results
Benchmarks
Without Delay in milliseconds Delay in milliseconds Distribution Distribution
Introducing a robust multitasking OS 06.05.2013 18 Michael Fritscher
- Impact of the integrity tests
- IPC: 90k-172k messages per second
- Stability over longer runtime
- Context switches: 40-800µs (depends on
the amount of integrity tests)
Results ff.
Benchmarks
Calc packets per second Calc packets per second
Without any
Time in s
Introducing a robust multitasking OS 06.05.2013 19 Michael Fritscher
Benchmarks
- No crashes or bad behavior
- Delays: Exactly as estimated, no spikes, even with complex scenarios
- Performance: Without the integrity tests near the maximum (IRQ-Handlers etc. need
to be into consideration)
- Very fair to the tasks
- No complex and bug-provoking search of parameters for the scheduler
- Context switches are fairly fast (~ 3k cycles)
Summery
Introducing a robust multitasking OS 06.05.2013 20 Michael Fritscher
- Task: Learn and retrace a way path with
- bstacle avoidance – control with
ultrasonic sensors
- Method: save the relative timestamps
and the commandos
- Tests:
– Duration of the implementation 2 days! – Stability / reliability – Accurateness (measured using iSpace from Nikon)
Realistic test
Tests of the whole system
Taught Retraced Retraced, with obstacles
Introducing a robust multitasking OS 06.05.2013 21 Michael Fritscher
Conclusion
- A Operating System was designed and implemented, with following reached goals:
– Robustness – Multitasking – Real time facility – Easy usage – can be used by students as well as scientific officers
- Also frameworks and drivers for several devices
- Lots of tests which prove both the performance and the suitability
=> Creation of a sustainable basis for many applications in the field of robotics
Introducing a robust multitasking OS 06.05.2013 22 Michael Fritscher
Outlook
- Adaption to several other robots – like the Scooter (Fit4Age)
- Several drivers – including more tests for external components
- Implementing more schedule algorithms
- Adaption to ROS (Robot Operating System)
- Multi microcontroller systems
Introducing a robust multitasking OS 06.05.2013 23 Michael Fritscher