Software for Complex Robotics Systems — The Composition Pattern

Software for Complex Robotics Systems
—
The Composition Pattern
Herman Bruyninckx
Eindhoven University of Technology
KU Leuven
http://people.mech.kuleuven.be/~bruyninc/
April 29, 2015
The Composition Pattern for complex robotics systems
Herman Bruyninckx
April 29, 2015
1
Overview of this lecture
I
design = first modelling, then implementation.
This lecture is about modelling of system of systems.
I
systems have “Structure”, “Behaviour” & “Activity”
I
model for Structure = Composition Pattern
model for Behaviour = Task-Skill-Motion
model for Activity = Port-based containers
I
to develop functionality = to decouple according to “5Cs”:
Computation, Communication, Coordination, Configuration,
Composition
I
to develop systems = to couple functionalities:
I
I
map Task-Skill-Motion on Composition Pattern (architecture)
map Composition Pattern on operating system (deployment)
The Composition Pattern for complex robotics systems
Herman Bruyninckx
April 29, 2015
2
Structure, Behaviour & Activity
Behaviour: “reacting to stimuli”
I as seen from the “outside”
I software systems: interact via events and data
I hardware systems: interact mechanically, electrically,. . .
Activity: “executing the code”
I how behaviour is realised “internally”
I software: CPU + RAM + bus
I hardware: mechanical, electrical,. . . , impedance
Structure:
I interconnection of Behaviours and Activities
= system architecture
The Composition Pattern for complex robotics systems
Herman Bruyninckx
April 29, 2015
3
Behavioural model: Task-Skill-Motion
GUI context
developers
Task context
Task
control
feedback
users
operators
Skill context
(RSAL)
Skill_1
Task
control
feedforward
Motion
App
Skill_2
Task
Monitor
...
Environment
context
Semantic world
model
Skill_k
Robot context
...
Robot_1
Robot HW
Abstraction
(RHAL)
Robot_n
The Composition Pattern for complex robotics systems
Herman Bruyninckx
April 29, 2015
4
Connection
"contains", "connects"
Composition
Where is something computed,
and communicated to/from?
Decouple behaviour: the 5Cs
Coordination
When must components change
their behaviour?
Configuration
What parameters define the
behaviour of all components?
Computation
What functionality is computed?
Communication
How are results of computations
being communicated?
Coordination
event handling,
decision making
Configuration
parameter setting,
behaviour monitoring
Computation
data + algorithms
+ scheduling
Communication
data + patterns
+ protocols
The Composition Pattern for complex robotics systems
Herman Bruyninckx
April 29, 2015
5
Compute behaviour: the 5COPs
Constrained
Optimization
Problem
FSM, configuration,
monitoring, events
(“COP” = constrained optimization problem)
objective
functions
∑i wi fi(X,y)
optimization
variables
minX
constraints
g(X,y) ⩽ 0
tolerances
dist(X,Xmin) ⩽ δ
Advantages of a constrained-based design:
I
I
composable!
monitorable!
I
I
tolerant!
configurable!
The Composition Pattern for complex robotics systems
Herman Bruyninckx
April 29, 2015
6
Structural model: Composition Pattern
(focus on “roles”, not on “functionalities”!)
Configurator
connection
functional
Computation
message
Composer
objective function, QoS,...)
transaction
container
broadcast
connection (data, constraint,
container
Composer
connection
Configurator
connection
connection
functional
Computation
monitor
monitor
Scheduler
Coordinator
Scheduler
Coordinator
events
events
Composer
monitor
Coordinator
Logger
Configurator
Logger
Scheduler
events
container (context, event, policy, knowledge, deployment,...)
The Composition Pattern for complex robotics systems
Herman Bruyninckx
April 29, 2015
7
Structural model: Composition Pattern (2)
—Where does “knowledge” fit in?—
Context_A: device capabilities
and constraints
Context_B: quality inspection
capabilities and constraints
motion control subsystem
Composer
quality classification subsystem
Composer
Configurator
connection
functional
Computation
connection
connection
monitor
Configurator
functional
Computation
connection
monitor
Scheduler
Coordinator
Coordinator
events
Composer
Scheduler
events
monitor
Logger
Configurator
Context_C: system capabilities
and constraints
Logger
The Composition Pattern for complex robotics systems
Herman Bruyninckx
April 29, 2015
8
Integration of TSM and CP
I
every Task, every RHAL, every World Model is a separate CP.
every Skill too, but it couples the CPs above, at various levels
of hierarchy:
Skill
composition,
exploiting domain knowledge
I
I
Mission
gives context to Tasks
selects trade-offs &
tolerances in the
production
Task
coordinates & configures
capabilities by adding
artificial constraints &
artificial optimums
Capability
uses resources to
realise a process
via control
Resource
physical capabilities
physical constraints
physical optimums
⇒ a Skill adds a knowledge context to a composition.
several Skills can be active at the same time.
The Composition Pattern for complex robotics systems
Herman Bruyninckx
April 29, 2015
9
Application
Your composition; possibly
a framework for others...
Activity model: port-based interaction
Domain framework
MoveIt, HDF5, Simulink,...
to hide domain complexity
SW framework
Containers, OSGi, 0MQ,...
middleware components to
hide OS variability
Operating System
process, virtual memory,
IPC,... for behaviour
containers for deployment
on hardware resources
HW framework
CPU, bus, storage
HW resource components
Dangers of ROS:
I Domain = SW = OS ⇒ component = process = activity!
I Communication = only publish-subscribe via TCP/IP!
I Too “fat” components/nodes ⇒ too heavily coupled 5Cs!
I No dynamics or control ⇒ mechatronics “abstracted away”!
The Composition Pattern for complex robotics systems
Herman Bruyninckx
April 29, 2015
10
Single-threaded execution of
Composition Pattern in an Activity
Common (but not absolute!) policy to serialize the execution of
Behaviour in an Activity as follows:
when triggered
do {
communicate()
coordinate()
configure()
schedule()
coordinate()
communicate()
log()
}
% by OS, or other CP
%
%
%
%
%
%
get latest events
react to them
possibly requiring reconfiguration
now do one’s Behaviour
execution could trigger new events
that others might want to know about
The Composition Pattern for complex robotics systems
Herman Bruyninckx
April 29, 2015
11
Conclusions
I
what do all the arrows in (y)our diagrams mean. . . ?
I
I
I
I
I
I
communication via data messages?
communication via shared memory?
knowledge integration via Configuration?
communication via observation?
decision making via reasoning?
...
I
monitor everything you expect to happen. . .
. . . and be ready to react if it doesn’t!
I
skills = monitoring & coordination & configuration
The Composition Pattern for complex robotics systems
Herman Bruyninckx
April 29, 2015
12