38
toward A Specification of Components Anthony Mallet February 3, 2002, Pisa (Italy)

toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

toward A Specification of Components

Anthony Mallet

February 3, 2002, Pisa (Italy)

Page 2: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Outline

• Description of components

→ Ultimate step until we are able to disseminate code.

• Overview of a generic architecture for control, communication and execution decou-pling

→ to understand ideas that are behind the definition of components.

• Examples

→ a motion control framework,

→ an exploration task.

• Components interface specification (overview)

Outline Components Structure Architecture Examples Interface Description Discussion 1

Page 3: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Components and Modules

• Components: [...] A software component is an independent unit, should be

reusable, exceeding the concept of “small” entities such as classes, be able to in-

terrogate other components to find their interfaces (and be interrogated itself), be

able to generate and handle events [...]. A component should not only document the

interface it offers to the world, but also the interfaces it requires from other compo-

nents in order to do its job.

→ This is what GenoM produces.

→ Should implement the functionalities (path planning, motion control, modeling,

...).

• Modules: The unit of software functionality as built in the object-oriented program-

ming paradigm. Basically, this means: data encapsulation and modularization.

→ Generic, modular, reusable libraries.

Outline Components Structure Architecture Examples Interface Description Discussion 2

Page 4: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Components Structure

We not only need to develop functionalities (components), but also something that de-

scribes them (tunable parameters, inputs, outputs, time properties, ...), i.e. a description

language for robotic functionalities. (roughly the same idea as e.g. IDL and Corba).

Proposition: define components that are made of (at least)

• a set of codels,

• an execution engine,

• communication libraries.

The talk will show how this can answer our needs in terms of modularity, reusability,

(re)configurability, ...

Outline Components Structure Architecture Examples Interface Description Discussion 3

Page 5: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Components Structure Codels

• Basically, codels are functions (or methods of a class) that structure an algorithm

into different parts. They are written by the developper of a particular functionality

in order to implement the core of a component.

• Their execution is sequenced elsewhere.

• They do not handle the communication with other components.

• They are atomic. They cannot be interrupted.

• They are especially well suited for periodic execution.

Outline Components Structure Architecture Examples Interface Description Discussion 4

Page 6: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Components Structure Example of Codels

PSfrag replacements

PID Control Algorithm {try {

catch {

while(servo) {

}}

}

}

select axis

axis control

brakes(off)

brakes(on)

brakes(on)

Axis Id

Reference

Interrupt

hardware

hardware

hardware

hardware

Initialization

Main

End

Exception

Outline Components Structure Architecture Examples Interface Description Discussion 5

Page 7: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Components Structure Execution Engine

• Execution engine sequences the codels execution and handles communicationbetween components.

• It provides services which are made available to the outside of the component.Services correspond to a sequence of codels.

• It is generic, and written once by the developpers of the system (reusable betweencomponents).

• There can be different kind of engines, with different properties (real-time) or differentexecution model (FSM, Petri nets, ...).

• An execution engine properly linked with a library of codels makes an executable (anda component).

Outline Components Structure Architecture Examples Interface Description Discussion 6

Page 8: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Components Structure Execution Example

PSfrag replacements

ControlTask

ExecutionTask

ExecutionTask

ExecutionEngine

CodelsInit Main End

PID Request

PID Interrupt

Start

Stop

Exec

Periodic

Outline Components Structure Architecture Examples Interface Description Discussion 7

Page 9: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Components Structure Execution Example

PSfrag replacements

ControlTask

ExecutionTask

ExecutionTask

ExecutionEngine

CodelsInit Main End

PID Request

PID Interrupt

Start

Stop

Exec

Periodic

PSfrag replacementsControlTask

ExecutionTaskExecutionEngine

Codels

Init

Main

End

PID Request

PID Interrupt

Start

Stop

Exec

Periodic

Outline Components Structure Architecture Examples Interface Description Discussion 7

Page 10: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Components Structure Execution Example

PSfrag replacements

ControlTask

ExecutionTask

ExecutionTask

ExecutionEngine

CodelsInit Main End

PID Request

PID Interrupt

Start

Stop

Exec

Periodic

PSfrag replacementsControlTask

ExecutionTaskExecutionEngine

Codels

Init

Main

End

PID Request

PID Interrupt

Start

Stop

Exec

Periodic

Outline Components Structure Architecture Examples Interface Description Discussion 7

Page 11: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Components Structure Execution Example

PSfrag replacements

ControlTask

ExecutionTask

ExecutionTask

ExecutionEngine

CodelsInit Main End

PID Request

PID Interrupt

Start

Stop

Exec

Periodic

PSfrag replacementsControlTask

ExecutionTaskExecutionEngine

Codels

Init

Main

End

PID Request

PID Interrupt

Start

Stop

Exec Periodic

Outline Components Structure Architecture Examples Interface Description Discussion 7

Page 12: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Components Structure Execution Example

PSfrag replacements

ControlTask

ExecutionTask

ExecutionTask

ExecutionEngine

CodelsInit Main End

PID Request

PID Interrupt

Start

Stop

Exec

Periodic

PSfrag replacementsControlTask

ExecutionTaskExecutionEngine

Codels

Init

Main

End

PID Request

PID Interrupt

Start

Stop

Exec

Periodic

Outline Components Structure Architecture Examples Interface Description Discussion 7

Page 13: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Components Structure Execution Example

PSfrag replacements

ControlTask

ExecutionTask

ExecutionTask

ExecutionEngine

CodelsInit Main End

PID Request

PID Interrupt

Start

Stop

Exec

Periodic

PSfrag replacementsControlTask

ExecutionTaskExecutionEngine

Codels

Init

Main

End

PID Request

PID Interrupt

Start

Stop

Exec

Periodic

Outline Components Structure Architecture Examples Interface Description Discussion 7

Page 14: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Components Structure Execution Example

PSfrag replacements

ControlTask

ExecutionTask

ExecutionTask

ExecutionEngine

CodelsInit Main End

PID Request

PID Interrupt

Start

Stop

Exec

Periodic

PSfrag replacementsControlTask

ExecutionTaskExecutionEngine

Codels

Init

Main

End

PID Request

PID Interrupt

Start

Stop

Exec

Periodic

Outline Components Structure Architecture Examples Interface Description Discussion 7

Page 15: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Components Structure Execution Example

PSfrag replacements

ControlTask

ExecutionTask

ExecutionTask

ExecutionEngine

CodelsInit Main End

PID Request

PID Interrupt

Start

Stop

Exec

Periodic

PSfrag replacementsControlTask

ExecutionTaskExecutionEngine

Codels

Init

Main

End

PID Request

PID Interrupt

Start

Stop

Exec

Periodic

→ One single task can (could) process several requests! (not shown here).

Outline Components Structure Architecture Examples Interface Description Discussion 7

Page 16: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Components Structure Exported and Imported Data

• Codels can use data coming from (and produce data for) other components.

• Codels do not take care of this and only define their interface.

• Before running a codel, the execution engine fetches what the codel need and passes

the data to it. After the codel has executed, data can also be exported by the engine

in a symetrical way.

→ Communication is typically encapsulated into a library (module?) which is used by

the execution engine (thus allowing different protocols / implementations /...).

Outline Components Structure Architecture Examples Interface Description Discussion 8

Page 17: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Components Structure Exported and Imported Data

PSfrag replacements

Comm. Comm.Cntrl Cntrl

TaskTask Task Task

Codel Codel Codel Codel Codel Codel

Export ImportSharedData

Same Library

Outline Components Structure Architecture Examples Interface Description Discussion 9

Page 18: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Components Structure Exported and Imported Data

• Also compatible with an object-oriented approach (e.g. codels in different components

can share the same libraries).

PSfrag replacements

Comm. Comm.Cntrl Cntrl

TaskTask Task Task

Codel Codel Codel Codel Codel Codel

Export ImportSharedData

Same Library

PSfrag replacements

Comm. Comm.Cntrl Cntrl

TaskTask Task Task

Codel Codel Codel Codel Codel Codel

Export ImportSharedData

Same Library

Outline Components Structure Architecture Examples Interface Description Discussion 9

Page 19: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Architecture Overview

PSfrag replacements

User

Developer

System

Builder

Codel

Codel

Codel

Interface

Cntrl Task Task

ExecutionControl

Other application, ...

Execution Engine Component

Outline Components Structure Architecture Examples Interface Description Discussion 10

Page 20: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Architecture Hardware Abstraction

• Some components will act as devices abstractions (e.g. cameras, sonars, motors, ...)

→ Abstraction is done by codels through the H.A.L.

E

N

S

W

PSfrag replacements

Component H.A.L. Robot Devices

Codel

Codel

Codel

ExecutionEngine

Data

Outline Components Structure Architecture Examples Interface Description Discussion 11

Page 21: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Architecture Control and Data Flows

• Control Flow

→ Setting parameters, starting or ending executions, ...

• Data Flow

→ Data transfers (between components) during execution. (images, sonar echoes,

positions, ...).

Control flow and Data flow must be decoupled.

Outline Components Structure Architecture Examples Interface Description Discussion 12

Page 22: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Architecture Control Flow

• The control flow has to be defined outside components, because a component does

not have the necessary knowledge to do this.

PSfrag replacements

Component Component

Codel CodelCodelCodel CodelCodel

TaskTaskTask Task

CntrlCntrl CommComm

Execution Control

Control Flow

Reflex ActionsSuper vised Actions

Outline Components Structure Architecture Examples Interface Description Discussion 13

Page 23: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Architecture Control Flow

• The control flow has to be defined outside components, because a component does

not have the necessary knowledge to do this.

PSfrag replacements

Component Component

Codel CodelCodelCodel CodelCodel

TaskTaskTask Task

CntrlCntrl CommComm

Execution Control

Control Flow

Reflex ActionsSuper vised Actions

PSfrag replacements

Component

Codel

Task

Cntrl

Comm

Execution Control

Control Flow

Reflex ActionsSuper vised Actions

Outline Components Structure Architecture Examples Interface Description Discussion 13

Page 24: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Architecture Control Flow

• The control flow has to be defined outside components, because a component does

not have the necessary knowledge to do this.

PSfrag replacements

Component Component

Codel CodelCodelCodel CodelCodel

TaskTaskTask Task

CntrlCntrl CommComm

Execution Control

Control Flow

Reflex ActionsSuper vised Actions

PSfrag replacements

Component

Codel

Task

Cntrl

Comm

Execution Control

Control Flow

Reflex Actions

Super vised Actions

Outline Components Structure Architecture Examples Interface Description Discussion 13

Page 25: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Architecture Control Flow

• The control flow has to be defined outside components, because a component does

not have the necessary knowledge to do this.

PSfrag replacements

Component Component

Codel CodelCodelCodel CodelCodel

TaskTaskTask Task

CntrlCntrl CommComm

Execution Control

Control Flow

Reflex ActionsSuper vised Actions

PSfrag replacements

Component

Codel

Task

Cntrl

Comm

Execution Control

Control Flow

Reflex Actions

Super vised Actions

Outline Components Structure Architecture Examples Interface Description Discussion 13

Page 26: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Architecture Data Flow

PSfrag replacements

ComponentComponent

CodelCodelCodel CodelCodelCodel

TaskTask Task Task

Cntrl CntrlComm Comm

Data Flow Management

Data Flow

• The data flow should also be defined outside components and should be decoupledof the control flow. It should also be controlable.

Outline Components Structure Architecture Examples Interface Description Discussion 14

Page 27: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Architecture Data Flow

PSfrag replacements

ComponentComponent

CodelCodelCodel CodelCodelCodel

TaskTask Task Task

Cntrl CntrlComm Comm

Data Flow Management

Data Flow

PSfrag replacements

Component

Codel

Task

Cntrl

Comm

Data Flow Management

Data Flow

• The data flow should also be defined outside components and should be decoupledof the control flow. It should also be controlable.

Outline Components Structure Architecture Examples Interface Description Discussion 14

Page 28: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Architecture Data Flow

PSfrag replacements

ComponentComponent

CodelCodelCodel CodelCodelCodel

TaskTask Task Task

Cntrl CntrlComm Comm

Data Flow Management

Data Flow

PSfrag replacements

Component

Codel

Task

Cntrl

Comm

Data Flow Management

Data Flow

• The data flow should also be defined outside components and should be decoupledof the control flow. It should also be controlable.

Outline Components Structure Architecture Examples Interface Description Discussion 14

Page 29: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Architecture Data Flow

PSfrag replacements

ComponentComponent

CodelCodelCodel CodelCodelCodel

TaskTask Task Task

Cntrl CntrlComm Comm

Data Flow Management

Data Flow

PSfrag replacements

Component

Codel

Task

Cntrl

Comm

Data Flow Management

Data Flow

• The data flow should also be defined outside components and should be decoupledof the control flow. It should also be controlable.

Outline Components Structure Architecture Examples Interface Description Discussion 14

Page 30: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Examples Motion control

• Motion control framework. All the yellow boxes could be implemented as components.

PSfrag replacements Planning Control

Modeling

Sensing

Data flow

Services

Outline Components Structure Architecture Examples Interface Description Discussion 15

Page 31: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Examples Motion control

• Motion control framework. All the yellow boxes could be implemented as components.

PSfrag replacements Planning Control

Modeling

Sensing

Data flow

Services

PSfrag replacements

Planning

Control

Modeling

Sensing

Data flow

Services

Outline Components Structure Architecture Examples Interface Description Discussion 15

Page 32: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Examples Motion control

• Motion control framework. All the yellow boxes could be implemented as components.

PSfrag replacements Planning Control

Modeling

Sensing

Data flow

Services

PSfrag replacements

Planning

Control

Modeling

Sensing

Data flow

Services

Outline Components Structure Architecture Examples Interface Description Discussion 15

Page 33: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Examples Exploration Task

→ implemented on an outdoor Marsokhod rover.

PSfrag replacements

Agate

Camera

Stereo

Steo

Classif

DEM

PTU 1PTU 2

GPS PoM

P3D ND Arc

Loco

Modeling

Localisation

Geometric Model

Motion Planners

Motion control + Sensing

Outline Components Structure Architecture Examples Interface Description Discussion 16

Page 34: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Interface Description Purpose

• A formal description of a component will describe (and group together):

→ the list of services,

→ the services interface (input / ouput parameters),

→ the set of codels for each services,

→ the codels interface (imported / exported data, parameters, ...),

→ as well as other information (not detailed here).

• The formal description is a text-based file (see the “tentative specification of compo-nents interface” document).

• The file is not used dynamically (at least not in its textual form). It is used during(at least) the link edition of the component, to select the set of modules (executionengine, codels).

Outline Components Structure Architecture Examples Interface Description Discussion 17

Page 35: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Interface Description Tasks

• Tasks definition (time properties, ...).

thread <name> {priority: <number>;period: <seconds>;stack: <size>;

start: <function>;stop: <function>;

}

Outline Components Structure Architecture Examples Interface Description Discussion 18

Page 36: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Interface Description Services

• Services definition (inputs, outputs, exports, imports, codels, ...).

service <name> {doc: "short description of the service";

thread: <name>;

/* input/output parameters */input|output: ...;

/* imported/exported data */import|export: ...;

codel <name> {exec: <function>( [const] <variable>, ...);max-time: <seconds>;next: <codel> [, <codel>, ...];

}

...}

Outline Components Structure Architecture Examples Interface Description Discussion 19

Page 37: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Discussion

→ Such a definition of components fills all requirements regarding decoupling, modularity,

reusability, configurability, ...

→ The implementation is free (consequence of the aforementioned properties): CORBA,

Sockets, C++, C, ...

Outline Components Structure Architecture Examples Interface Description Discussion 20

Page 38: toward A Speci cation of Components Anthony Mallethomepages.laas.fr/mallet/orocos/2nd-meeting.pdf · 2002. 2. 4. · Components interface speci cation (overview) Outline Components

Discussion

Discussion: Are you ok for...

• ... a formal description of components interface?

• ... codels?

• ... a decoupling between data and control flows?

• ... components that do not make decisions (control flow)?

• ... codels(?) that do not attempt to fetch data by themselves?

• ...

Outline Components Structure Architecture Examples Interface Description Discussion 21