Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS...

36
Recent evolutions in GenoM Anthony Mallet, Matthieu Herrb LAAS - CNRS Grenoble, May 25th, 2011

Transcript of Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS...

Page 1: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Recent evolutions in GenoM

Anthony Mallet, Matthieu HerrbLAAS - CNRS

Grenoble, May 25th, 2011

Page 2: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Overview

1. History and concepts

2. GenoM3

3. Simplified example

4. Internals

History and concepts GenoM3 Example Internals 1/34

Page 3: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

History

Martha EU project – Circa 1995

History and concepts GenoM3 Example Internals 2/34

Page 4: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Salient demonstrations

Hilare2 – 2002 Rackham – 2005 Karma – 2004

Lama – 2001 Dala – 2004 HRP-2 – 2008

History and concepts GenoM3 Example Internals 3/34

Page 5: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

GenoM Authors

Sara Fleury Matthieu Herrb

• 1994 - 2000 First version. Running only on VxWorks.

• 2000 - 2004 Linux support with pocolibs.

• 2004 - 2010 Version 2 - Opensource, english documentation.Used by a few other labs/companies (JPL, EPFL, GMV).

• 2010 - Version 3 - Middleware independence.History and concepts GenoM3 Example Internals 4/34

Page 6: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Concepts

History and concepts GenoM3 Example Internals 5/34

Page 7: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

LAAS layered architecture: Functions, Supervision

supervisor

effortswrist

recognition

speech

sentences

trajectorygeometric

speedreferences

sensor position

proxi segs

points referencesspeed

position

human position (3D)human position (2D)

head position

map

localmap

manipulationhuman perception recognitionobject

base motion

3D image

referencefingers efforts

positionreferences

(jerk cntrl)

laser data

images

human posture

handposition

proximetric

jloco

segloc

sick laser

human

camera2(videre)

qarm

sranger graspCntrlNDD cameras

aspect

humPos

ViewPoint Obj 3D

graspPlan

speak

clone

fingersforcePTURECO

voodooGEST ICUFUSION

hardware sensors and actuators

xarm

collision

HueBlobMHPNHP

HATP CRSSHARY

(from the COGNIRON EU project, circa 2007)

History and concepts GenoM3 Example Internals 6/34

Page 8: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

GenoM: component-based model

Components

• are entities relevant to the supervision,

• coarse grained,

• provide high-level services (e.g. not a matrix product).

History and concepts GenoM3 Example Internals 7/34

Page 9: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Components formal description

Components are defined by a text file:

• Interface: ports, services.

• Properties.

• Internals:· codels (elementary code).· executions contexts (tasks, threads).

History and concepts GenoM3 Example Internals 8/34

Page 10: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

GenoM: a unique component model

All components share the same component model:

• Robustness

• Ease of development

• Generic supervision architecture

• Software validation

• Decoupling architecture / algorithmic core

History and concepts GenoM3 Example Internals 9/34

Page 11: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Formal component description

• A component defines several services.• Each running service corresponds to an activity.• GenoM activities execute according to a state machine.

Example: GenoM2 activity FSM.

ETHER

INIT

ZOMBIE

exec/−init/−

abort/−

abort/−

EXEC

INTER−/ended

−/failed

−/failed

abort/−

−/ended

− / execution

control / −events

History and concepts GenoM3 Example Internals 10/34

Page 12: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Control & data flows

• Control flow· Service requests, may have parameters and output data.

· Provides building blocks for application development (supervision).

· Low bandwidth.

• Data flow· Input and output ports: “posters”.

· Long-lived inter-components connections, configured dynamically viaservices. Meant for high bandwidth data transmission.

History and concepts GenoM3 Example Internals 11/34

Page 13: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Decoupled components

• No control flow between components· Prevents conflicting requests.

· Supervision layer can rely on a known state.

· Increases modularity.

History and concepts GenoM3 Example Internals 12/34

Page 14: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

GenoM3

Can we make components truly middleware-independent?

History and concepts GenoM3 Example Internals 13/34

Page 15: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Middleware issues

There are a lot of different middlewares / frameworks.

• Player (2001)

• Orocos (2002)

• OpenRTM (2002)

• Urbi (2003)

• Orca (2004)

• YARP (2006)

• ROS (2007)

• ... ETC ...

History and concepts GenoM3 Example Internals 14/34

Page 16: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Middleware issues

• The choice of a middleware is crucial:revoking that choice is costly.

• Different contexts require different solutions.

• There is no unique solution.

• Modularity is good.

History and concepts GenoM3 Example Internals 15/34

Page 17: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Middleware issues

A generic component will usually look like this:

Middleware

Component

Library

OS

History and concepts GenoM3 Example Internals 16/34

Page 18: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Goals

Components:

• Be able to use any middleware.

• Make the underlying libraries highly reusable.

• Define a common component model, allowing generic su-pervision or validation. e.g. BIP from VERIMAG.

Architectures:

• Can be compared (e.g. middleware or architecture benchmarks) in thecontext of real and complex applications.

History and concepts GenoM3 Example Internals 17/34

Page 19: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

GenoM3

Avoid those approaches:

Middleware

Component

OS

Library

Abstraction

Component

OS

Library

Middleware

Normalized

• → No component model• An extra layer generates extra code and less performance.

• “Least common denominator” of all the middlewares.

• Helps a lot for communication, but not for the rest.(component interface definition, internal component behaviour, control architecturedefinition, ...)

History and concepts GenoM3 Example Internals 18/34

Page 20: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

GenoM3 component architecture

• No dependency between “library” and “middleware”.

• Middleware-dependent part generated.

• Use of a formal description file.

Generated code

OS

Middleware Library

Component

DescriptionFormal

History and concepts GenoM3 Example Internals 19/34

Page 21: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

GenoM3 tool

Template

Codels

.gen

GeneratedSource

Generic template

2

Middleware

GenoM3

1Parser

Component source

Interpreter

Build3

ComponentExt. Libraries

AST

History and concepts GenoM3 Example Internals 20/34

Page 22: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Formal component description

• Components templates implement the formal description.

• Templates are tied to the middleware.

• Only one template for a given middleware.

History and concepts GenoM3 Example Internals 21/34

Page 23: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Simplified example: servo control

History and concepts GenoM3 Example Internals 22/34

Page 24: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

The codels library

intvalidate_k(double *k) {

if (*k<0.) return ERROR;return OK;

}

intservo_control(double target, double k) {

double velocity;

velocity = motor_get_velocity();motor_set_velocity(k * (target - velocity));

return EXEC;};

History and concepts GenoM3 Example Internals 23/34

Page 25: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

The component formal description

component servo;

ids { double target; double k; };

task main { period: 1ms; }

service set_k(in k) {validate: validate_k(inout k);

}

service servo(in target) {task: main;codel main: servo_control(in target, in k)

yield main, ether;};

History and concepts GenoM3 Example Internals 24/34

Page 26: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Run genom3

% genom3 <template1> <component.gen>generating ...

% ./configure && make && make install

% genom3 <template2> <component.gen>generating ...

% ./configure && make && make install

History and concepts GenoM3 Example Internals 25/34

Page 27: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Internals

• Formal component description: meta-model

• Templates: component model

History and concepts GenoM3 Example Internals 26/34

Page 28: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Formal component description

• Component interface: IDL data structures

struct sample_data {long l;double d;string s;...

};

History and concepts GenoM3 Example Internals 27/34

Page 29: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Formal component description

• General component description.

component name {lang: "c, c++, ...";

...};

• Internal Data Structure (IDS)ids { ... };

· groups all services parameters.

· state of the component.History and concepts GenoM3 Example Internals 28/34

Page 30: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Formal component description

• Input/output data ports.

inport type name;

outport type name;

History and concepts GenoM3 Example Internals 29/34

Page 31: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Formal component description

• Executions contexts.

task name {period: 100ms;priority: 200;stack: 20k;

codel start: tstart(in ::ids) yield main;codel main: tmain(in d, out s)

yield main, stop;codel stop: tstop() yield ether;

};

History and concepts GenoM3 Example Internals 30/34

Page 32: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Formal component description

• Services.

service name(inout s) {doc: "Service description";task: name;

validate: svalidate();throws: ERROR_1, ERROR_2, ...;interrupts: name;

codel start: sstart() yield step1;codel step1: sstep1() yield step1, step2;codel step2: sstep2() yield ether;codel stop: sstop() yield ether;

};History and concepts GenoM3 Example Internals 31/34

Page 33: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Component templates

Key feature of GenoM3: components templates

• Implements the internal machinery of a component.

• Works with an embbeded scripting language (TCL)Similar to PHP + HTML web pages

• Can be complex to develop.But just one template is needed for a given middleware.

History and concepts GenoM3 Example Internals 32/34

Page 34: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Simple template example

• Regular source code with embedded TCL expressions.

#include <stdio.h><’ set component [dotgen component] ’>

int main(){

const char cname[] = "<"$component name">";<’ foreach s [$components services] { ’>printf("%s: <"[$s name]">\n", cname);<’ } ’>return 0;

}

History and concepts GenoM3 Example Internals 33/34

Page 35: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011

Work in progress

In development:

• pocolibs: legacy GenoM middleware. 95% ready.

• bip: with VERIMAG lab?

• orocos: with ONERA lab?

• ros-comm: ROS middleware?

History and concepts GenoM3 Example Internals 34/34

Page 36: Recent evolutions in GenoM · Recent evolutions in GenoM Anthony Mallet,Matthieu Herrb LAAS-CNRS Grenoble, May 25th, 2011