a giotto-based helicopter control system - emsoft '02 home page
Post on 12-Mar-2022
6 Views
Preview:
TRANSCRIPT
A Giotto-based Helicopter Control System
Marco A.A. Sanvido1, Christoph M. Kirsch1,Thomas A. Henzinger1, Wolfgang Pree2
1University of California, Berkeley2University of Salzburg, Austria
Second International Workshop on Embedded SoftwareEMSOFT 2002
7 Oct. 2002, Grenoble, FR
EMSOFT 2002, Grenoble 2ms, 10/7/2002
Project Objectives
1. Demonstrate feasibility of Giotto– Implementing a real complex control problem
2. Demonstrate benefits of Giotto– Comparing it with an existing solution
Re-implementing the autopilot control system developed at ETH Zürich (project OLGA)
EMSOFT 2002, Grenoble 4ms, 10/7/2002
About 2m
Swiss Feral Institute of Technologyinterdisciplinary project (1997-2001):
•Helicopter Model (Hunziker AG)
•Control (LQR)
•Navigation (Extended Kalmann Filter)
•Computer System (StrongARM)
•RTOS (HelyOS)
2001 weControl GmbH, makes&produces wePilot1000
The Helicopter
EMSOFT 2002, Grenoble 5ms, 10/7/2002
3 Acc. Sensors
3 Gyros
Temperature
Revolution Compass Laser
GPS
Datalink
Computer
Receiver
Multiplexer
ServosHelicopter
Remote Control
Joystick
GPS
Ground system
Backup pilotGround-
Computer
Datalink
The Platform
EMSOFT 2002, Grenoble 6ms, 10/7/2002
• Sensor Data Evaluation• Flight Control• Trajectory • Flight Data Recording
• Data Visualization• Flight Monitoring• Flight Planning• Flight Commands
The Controller
EMSOFT 2002, Grenoble 7ms, 10/7/2002
The Legacy Control Software Implementation
1. Modular software implementation (Oberon language)
2. Functionality and timing was mixed
3. Functionality (i.e., navigation/control)was hand-coded from Simulink Model
Code:Set of tasks with different priorities, communicating
via shared memory and message passing.
EMSOFT 2002, Grenoble 9ms, 10/7/2002
Given: 1. Units of scheduled host code (application-level tasks).e.g. control law computation
2. Units of synchronous host code (system-level drivers).e.g. device drivers
3. Real-time requirements and data flow between tasks.
Giotto: Glue code that calls 1. and 2. in order to realize 3.
TaskInput ports Output ports
Task Task driver loads task input ports.
The Giotto Programmer’s Model
functionality code
EMSOFT 2002, Grenoble 10ms, 10/7/2002
g
f
Sensors
Actuators
i
s
a25
5
Tasks, Sensors, and Actuators Data Flow
EMSOFT 2002, Grenoble 12ms, 10/7/2002
Platform-independent Software Model
Host code e.g. C, Oberon
Glue code Giotto
Functionality.-Environment time, not platform time.-Concurrency, not distribution.
Timing and interaction.
This kind of software is understood:Host code may (sometimes) be generated automatically.
The software complexity lies in the glue code (minimize jitter!) :Giotto enables requirements-driven rather than platform-driven glue-code programming.
-No time. -Sequential.
EMSOFT 2002, Grenoble 13ms, 10/7/2002
Software Task
read sensor input at time t
write actuator output at time t+d, for fixed d
d>0 is the task's "logical execution time"
The FLET Assumption(Fixed Logical Execution Time)
EMSOFT 2002, Grenoble 14ms, 10/7/2002
Task
Driver
Input ports loaded.
Driver execution takes 0 time. Task execution takes
logically time d.
Output ports read.
Sensor/output ports read.
Sensor Actuator
Actuator/input ports loaded.
Time t Time t Time t+d Time t+d
d
Task duration
The FLET Assumption(Fixed Logical Execution Time)
EMSOFT 2002, Grenoble 15ms, 10/7/2002
Advantages of the FLET:
-predictable timing and value behavior (environment determined programs: no race conditions, minimal jitter)
-portable, composable code (as long as the platform offers sufficient performance)
Disadvantage of the FLET:
-tasks don't always use latest available data (a small price to pay, e.g. model helicopter)
The FLET Assumption
EMSOFT 2002, Grenoble 16ms, 10/7/2002
Simulink Model
Giotto Program for task timing and interaction
C Functions for tasks
E code Platform Code
Platform (minimal OS + hardware)E Machine invokes
S/G Translator
Giotto Compiler
RTW Embedded Coder
C Compiler
The Giotto Tool Chain
EMSOFT 2002, Grenoble 17ms, 10/7/2002
-a virtual machine that mediates the interaction of physical processes (sensors and actuators) and software processes (tasks and drivers) in real time
-the Giotto compiler can be retargeted to a new platform by porting the Embedded Machine
The Embedded Machine
EMSOFT 2002, Grenoble 18ms, 10/7/2002
Enable trigger:future(g,B:) B:
Schedule task:schedule(t)
t
Call driver:call(d)
d
g
Execute driver d now.Hand task t over to the system scheduler (RTOS).
Have code Bexecuted as soon as trigger g becomes true.
The Embedded Machine: Three Instructions
EMSOFT 2002, Grenoble 20ms, 10/7/2002
The Legacy Implementation
Embedded Computer System
RTOS (HelyOS)DeviceDrivers
Control Software
BackgroundTasks
AsynchronousTasks
SynchronousTasks
EMSOFT 2002, Grenoble 21ms, 10/7/2002
Giotto Control Software
Giotto Autopilot Program
The Re-Implementation
Embedded Computer System
RTOS (HelyOS)EmbeddedMachine
Event-Triggered &Non-Time-Critical Software
BackgroundTasks
AsynchronousTasks
GiottoDrivers
GiottoTasks
DeviceDrivers
E code
EMSOFT 2002, Grenoble 22ms, 10/7/2002
Simulink Model
Giotto Program for task timing and interaction
Legacy Oberon functions for
tasks & drivers
E code Platform Code
Platform (HelyOS + hardware)E Machine invokes
S/G Translator
Giotto Compiler Oberon Compiler
The Giotto Tool Chain
EMSOFT 2002, Grenoble 23ms, 10/7/2002
isInitDone
Mode 4: TakeOff
ADFilter 200Hz
NavTakeOff 40Hz
Mode 3: Motor
ADFilter 200Hz
NavRotorUp 40Hz
isEndTakeOff
Mode 5: ControlOff
ADFilter 200Hz
NavPilot1 40Hz
isControlOn
isControlOff
isRotorUp&TakeOff
Mode 2: Idle
ADFilter 200Hz
NavPilot0 40Hz
Mode 1: Init
ADFilter 200Hz
NavInit 40Hz
isStopMotorisStop
Motor
isStartMotor
isStopMotor
isStopMotor
Mode 6: ControlOn
ADFilter 200Hz
NavControl 40Hz
The Controller Modes
EMSOFT 2002, Grenoble 24ms, 10/7/2002
Data Flow in ControlOn mode
ADFilter
NavCon Actuators(6 servo motors)
i
s
a25
5Sensors
(accelerometers, gyroscopes,
temperature)
sSensors(laser, rpm,
GPS, compass)
i
legacy Oberon code
EMSOFT 2002, Grenoble 25ms, 10/7/2002
sensor gps_type GPS uses gps_device;analog_type Analog uses analog_device;
actuator servo_type Servo := servo_inituses servo_device ;
output
filter_type ADFilterOutput := filter_init ;
servo_type NavConOutput := servo_init ;
driver sensing (GPS) output (gps_type gps) { gps_pre_processing ( GPS, gps ) }
task NavCon (filter_type filter, gps_type gps) output (NavOutput)
{ navcon_code ( filter, gps, NavOutput ) }
…
Helicopter Software:Giotto Syntax (Functionality)
ADFilter
NavCon
i
s
a25
5
s
i
EMSOFT 2002, Grenoble 26ms, 10/7/2002
The FLET Assumption(ControlOn mode)
Time (ms)5
Tasks/Drivers
2010 15 250
accelerometers
filter
servos
gps compass rpm
laser pilot
ADFilter
Servo updateNavCon
Giotto tasks
Sensor update
Giotto drivers
Mode switch
gyroscopestemperature
Task input
EMSOFT 2002, Grenoble 27ms, 10/7/2002
…
mode ControlOn() period 25ms
{
actfreq 1 do Actuator ( actuating ) ;
taskfreq 5 do ADFilter ( input ) ;
taskfreq 1 do NavCon ( sensing ) ;
}
…
Helicopter Software:Giotto Syntax (Timing)
Time (ms)5
Tasks/Drivers
2010 15 250
servos
EMSOFT 2002, Grenoble 28ms, 10/7/2002
is
t t+0ms t+5ms t+5ms
ADFilter ADFilters
aaNavCon
Generated E code(ControlOn mode)
s
i
i
EMSOFT 2002, Grenoble 29ms, 10/7/2002
Generated E code(ControlOn mode)
is1
t t+5ms t+5ms
ADFilter ADFilters
aaNavCon
s2
i1
i2
B1: call(a)call(s1)call(s2)call(i1)call(i2)schedule(NavCon)schedule(ADFilter)future(now+5, B2:)return
t+0ms
EMSOFT 2002, Grenoble 30ms, 10/7/2002
Generated E code(ControlOn mode)
is1
t t+5ms t+5ms
ADFilter ADFilters
aaNavCon
s2
i1
i2
B2: call(s)call(i)schedule(ADFilter)future(now+5, B3:)return
t+0ms
EMSOFT 2002, Grenoble 31ms, 10/7/2002
Time (ms)5
Tasks/Drivers
2010 15 250
CPU executing Giotto tasksCPU executing Giotto drivers
CPU executing non-Giotto tasks (non-time-critical)
ADFilter
NavCon
wcet
wcet
Execution of ControlOn Mode(Rate Monotonic Scheduler)
EMSOFT 2002, Grenoble 32ms, 10/7/2002
Conclusions
• Giotto is applicable to real-complex and high-performance control systems
• Timing is correct-by-construction• Functionality code is domain-dependent
and platform-independent (wcet)• Tasks are composable
• Giotto introduces computational overhead(~2% /5ms in the helicopter example)
• Simple to implement (2 man/month)
top related