~ulbrich [email protected] Ulbrich – [email protected] 25 I4 Copter Abstract – Hardware...

37
Lehrstuhl für Informatik 4 Verteilte Systeme und Betriebssysteme Friedrich-Alexander-Universtät Erlangen-Nürnberg HotSys Praktikum I4Copter: Architektur und Aufbau 01.12.2010 Peter Ulbrich http://www4.cs.fau.de/~ulbrich [email protected]

Transcript of ~ulbrich [email protected] Ulbrich – [email protected] 25 I4 Copter Abstract – Hardware...

Page 1: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Lehrstuhl für Informatik 4Verteilte Systeme und BetriebssystemeFriedrich-Alexander-Universtät Erlangen-Nürnberg

HotSys Praktikum

I4Copter: Architektur und Aufbau01.12.2010

Peter Ulbrich

http://www4.cs.fau.de/[email protected]

Page 2: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Übersicht

Modulorientierte Entwicklung von (Echtzeit-) Systemen Phase 1: Einordnung / Analyse Phase 2: Modularisierung Phase 3: Komposition

I4Copter Projektübersicht Hardware Software

2P.Ulbrich, M.Hoffmann, J. Kleinöder HotSys Praktikum WS10/11

Page 3: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

ModularisierungPhase 1 – Analyse

3Peter Ulbrich – [email protected]

Page 4: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Einordnung – Phase 1 Beziehungen zwischen Ereignis n und Ergebnis m zeitlich – wie viel Zeit darft verstreichen → Termine

physikalisch – wie ist das Ergebnis zu bestimmen?

Page 5: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Zielsetzung physikalisches Objekt Welche Größen sind relevant?

Wie hängen diese Größen zusammen?

Echtzeitsystem Welche Ereignisse gilt es zu behandeln?

Welche Zeitschranken gilt es einzuhalten?

Welche Beziehung Zeitschranke ↔ physikalisches Objekt gibt es?

Wie sieht das physikalische Modell aus? Welche Größen des physikalischen Objekts muss man abbilden?

Wie bildet man diese Größen ab?

Page 6: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

ModularisierungPhase 2 – Modularisierung

6Peter Ulbrich – [email protected]

Page 7: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Was ist ein Modul? Wie teilt man ein System in Module auf? Welche Module gibt es in meinem System? Wie sind diese Module gekoppelt? Wie interagieren diese Module? Welche Module kann man zusammenfassen?

Identifikation von Modulen – Phase 2

Page 8: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Softwarekomponente Klasse Prozedur Package Übersetzungseinheit

hat eine wohldefinierte Funktion hat eine wohldefinierte Schnittstelle

Was ist eine Komponente / ein Modul?

Page 9: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Algorithmus existiert nicht! ist anwendungsbezogen – hängt vom System ab ist subjektiv – hängt vom Designer ab mögliche Kriterien

Partitionierung des Systems Größe der Module Komplexität der Module externe Schnittstelle der Module Beziehung und Kommunikation der Module untereinander

- sowie die daraus resultierende Programmhierarchie Bereich der Kontrolle und des Einflusses eines Moduls

erfordert Erfahrung

Wie gliedert man ein System in Module?

Page 10: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Maß für die Unabhängigkeit von Modulen niedrige Kopplung

einfach zu verstehen wartbar verlässlich stabil

hohe Kopplung hohes Maß an „Collateral Evolution“

Hauptfaktoren Komplexität von Information Informationstyp Kommunikationsmethode Art der Kopplung

Kopplung von Modulen

Page 11: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

unidirektionaler Datenfluss

Kopplung – Informationstyp

bidirektionaler Datenfluss

unidirektionaler Kontrollfluss

bidirektionaler Kontrollfluss

bidirektionaler Daten- und Kontrollfluss

D

D

C

C

D

C

A

A

A

A

A B

B

B

B

Bgeringe Kopplung

starke Kopplung

Page 12: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Kopplung – Kommunikationsmethodegeringe Kopplung

starke Kopplung

inputcommand

inputcommand

pathological module connection

normal module connection

Page 13: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

SharedDate

SharedCode

Data

Code Code

Data

Module A Module B

Code

Data

Module A

Data

Code

Module B

Concept

Code

Data

Implementation

Content Coupling Module existieren im Konzept keine Trennung in der

Implementierung Common Coupling Stamp Coupling Data Coupling – by reference Data Coupling – by value

Kopplung – Artstarker Kopplung

geringe Kopplung

Pointer transferData

Code

Data

Code Pointer

DataStructureModule A Module B

Data address

Data

Code Code

Data

Module A Module B

Data values

Data

Code Code

Data

Module A Module B

Page 14: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Content Coupling Common Coupling Unterscheidung: globale vs.

private Daten- und Programmbereiche

globale Bereiche von allen Modulen zugreifbar

Stamp Coupling Data Coupling – by reference Data Coupling – by value

Kopplung - Art

Pointer transferData

Code

Data

Code Pointer

DataStructureModule A Module B

Code

Data

Module A

Data

Code

Module B

Concept

Code

Data

Implementation

SharedDate

SharedCode

Data

Code Code

Data

Module A Module B

Data address

Data

Code Code

Data

Module A Module B

Data values

Data

Code Code

Data

Module A Module B

starker Kopplung

geringe Kopplung

Page 15: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Content Coupling Common Coupling Stamp Coupling spezifische Datenstruktur statt

globaler Bereiche nur bestimmte Bereiche werden

geteilt teilende Module müssen

konsistente Sicht auf die Datenstruktur haben

Data Coupling – by reference Data Coupling – by value

Kopplung - Art

Code

Data

Module A

Data

Code

Module B

Concept

Code

Data

Implementation

SharedDate

SharedCode

Data

Code Code

Data

Module A Module B

Pointer transferData

Code

Data

Code Pointer

DataStructureModule A Module B

Data address

Data

Code Code

Data

Module A Module B

Data values

Data

Code Code

Data

Module A Module B

starker Kopplung

geringe Kopplung

Page 16: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Content Coupling Common Coupling Stamp Coupling Data Coupling – by reference Zugriff auf Daten per Referenzen Konsistenz der Daten durch

Programmiersprache sicher gestellt Data Coupling – by value

Kopplung - Art

Data values

Data

Code Code

Data

Module A Module B

Code

Data

Module A

Data

Code

Module B

Concept

Code

Data

Implementation

SharedDate

SharedCode

Data

Code Code

Data

Module A Module B

Pointer transferData

Code

Data

Code Pointer

DataStructureModule A Module B

Data address

Data

Code Code

Data

Module A Module B

starker Kopplung

geringe Kopplung

Page 17: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Content Coupling Common Coupling Stamp Coupling Data Coupling – by reference Data Coupling – by value nur Werte werden weiter gegeben Module können Zustände anderer

Module nicht ändern sehr sicher hoher Speicherbedarf

Kopplung - Art

Code

Data

Module A

Data

Code

Module B

Concept

Code

Data

Implementation

SharedDate

SharedCode

Data

Code Code

Data

Module A Module B

Pointer transferData

Code

Data

Code Pointer

DataStructureModule A Module B

Data address

Data

Code Code

Data

Module A Module B

Data values

Data

Code Code

Data

Module A Module B

starker Kopplung

geringe Kopplung

Page 18: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

ED

A

C

B

A ideales Module sehr einfach 1 Eingang, 1 Ausgang

einfache Systeme übersichtlich

komplexere Systeme Systemkomplexität steigt schnell an unübersichtlich

Kompromiss einfache Module vs. einfaches System

Kohäsion

ideales Modul

einfaches System

komplexeres System

A

C

B

Page 19: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

fasse Module zu Super-Modulen zusammen Module werden Elemente des Super-Moduls

Kohäsion: ein Maß für den Zusammenhalt der Elemente Anzahl der Verbindungen untereinander Anzahl der Verbindungen nach außen

Kohäsion

Y

XA B

C

D E Y

X

Module Elements

Page 20: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

ModularisierungPhase 3 – Komposition

20Peter Ulbrich – [email protected]

Page 21: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Phase 3 – Komposition Abbildung: Komponenten → Ereignisbehandlungen Ereignisbehandlungen → Betriebsystem

Planung: Prioritätenvergabe oder statische Ablaufplanung

Zulässigkeitsprüfung

Page 22: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Grundlagen Teil 1: Abbildung

Ereignisbehandlungen → BS-Dienste Verknüpfung von Ereignissen mit Ereignisbehandlungen Abhängigkeiten verschiedener Ereignisbehandlungen

Synchronisation kritischer Abschnitte

Modellierung von Datenabhängigkeiten ...

Teil 2: Ablaufplanung Berechnung statischer Ablaufpläne Auswahl eines geeigneten Algorithmus (RMA, DMA, EDF, ...)

Planbarkeitsanalyse: Antwortzeitanalyse, CPU-Auslastung, ...

...

Page 23: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Komposition: Eingaben Ereignisbehandlungen welche Ereignisse:

- zeitliche Parameter: periodisch, aperiodisch, sporadisch- Herkunft: physikalische bzw. logische Ereignisse

welche Termine: hart, fest, weich

Abhängigkeiten- gerichtete Abhängigkeiten- gegenseitiger Ausschluss ↔ kritische Abschnitte

Komponenten funktionale und temporale Spezifikation

Laufzeitsystem funktionale und temporale Spezifikation

Page 24: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

I4CopterArchitektur & Aufbau

24Peter Ulbrich – [email protected]

Page 25: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

I4Copter – Übersicht Component Architecture for Safety-critical Embedded Systems Term: 08/2007 now

CoSa Component Framework Basic Framework: Reuse & Abstraction Component isolation and interaction Sensor system abstraction & sensor fusion components

CoRed Software Redundancy Component-level software redundancy Input-to-output protection

I4Copter Evaluation System Quadrotor helicopter “Source of inspiration”

25Peter Ulbrich – [email protected]

Page 26: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

I4Copter Abstract – Hardware

26Peter Ulbrich – [email protected]

Resembles automotive and industry applications

Custom made sensor periphery board 8 sensors, heterogeneous interfaces

Automotive microcontroller Infineon TriCore TC1796 150MHz / 64KB+1MB RAM

3 units build: Ikarus, Apollo, Deadalus

Page 27: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

I4Copter Abstract – Software & Control I4Copter flight-control application Based on CoSa component framework

Written in C++, comprises ~26.000LOC Core components: signal processing, flight control, behaviour control, navigation

Feedback control system Model-based controller and plant Matlab Simulink

Main attitude controller: Three layers cascaded structure

Altitude control (beta)

Trajectory tracking control (under devel.)

Sensor fusion & state observation Orientation: Tilt angle, direction (heading)

Altitude, vertical acceleration and speed

27Peter Ulbrich – [email protected]

Page 28: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

I4Copter – Abstract View

28Peter Ulbrich – [email protected]

Page 29: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Framework basics – Components

29Peter Ulbrich – [email protected]

Page 30: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Framework Basics - Abstraction Component reuse Hardware abstraction OS abstraction Basic device drivers

TriCore HAL Analog, digital or bus channel Application specifies output port

Implements hardware internal routing and configuration

Prevents double assignments

30Peter Ulbrich – [email protected]

Page 31: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Isolation – Component Connectors Distributing state messages between protection domains

Component isolation Spatial: Utilising TriCore memory protection (OS support) Temporal: Utilising real-time operating system

CoSa connector pattern Overcome memory protection boundaries

Automatic mapping to appropriate mechanism (message, shared memory)

31Peter Ulbrich – [email protected]

Page 32: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

CoSa Sensor Abstraction

Unhinge sensor processing and control engineering

CoSa sensor class components Persistent physical measurement Interface for controller

Sensor device driver(s) abstraction

Real-time and control theory requirements

CoSa sensor fusion components Extending sensor class components

Deviation criterion

32Peter Ulbrich – [email protected]

Page 33: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

CoSa Real-Time Analysis Support Dealing with complex jobs Common resource analysis Implicit vs. explicit synchronisation

Operational Mode Management Round-based arbiter for component-mode

Exception Handling Connector like Coupled with debugging support

33Peter Ulbrich – [email protected]

Page 34: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

CoSa based I4Copter Application

34Peter Ulbrich – [email protected]

Page 35: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Getting started (1)

I4Copter SVN Repository http://www4.informatik.uni-erlangen.de/i4cosa/I4Copter/I4Copter/trunk/

Login: Peter

Codebasis enthält auch Code von KooperationspartnernWeitergabe derzeit nicht erlaubt!

CodeBlocks Projekt (auch) I4Copter.workspace

Flashen mit dem Trace32 System/ebu.cmm

35Peter Ulbrich – [email protected]

Page 36: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Getting started (2)

36Peter Ulbrich – [email protected]

Page 37: ~ulbrich ulbrich@cs.fau...Peter Ulbrich – ulbrich@cs.fau.de 25 I4 Copter Abstract – Hardware Peter Ulbrich – ulbrich@cs.fau.de 26 Resembles automotive and industry applications

Ende

ENDE

Fragen?

37P.Ulbrich, M.Hoffmann, J. Kleinöder HotSys Praktikum WS10/11