SlideShare a Scribd company logo
High PerformanceRelayingof
C++11Objects
acrossProcesses
and
Logic-Labeled
Finite-StateMachines
V. ESTIVILL-CASTRO*
*Griffith University, Nathan Campus,
Brisbane, Australia.
v.estivill-castrol@griffith.edu.au,
In collaboration with Rene Hexel, Carl Lusty and many other members of MiPal
(c)VladEstivill-Castro
1
Outline
• Two tools
• clfsm
• mipal gusimplewhiteboard
• What do they do?
• Finite-State Machines (FSM)
• Logic-labeled FSMs
• Examples
• What have they enabled
• software architectures /middleware
• Model-driven development
• Formal verification
• Conclusions
• What can I do so you would use them?
(c)VladEstivill-Castro
2
Outline
• Two tools
• clfsm
• mipal gusimplewhiteboard
• What do they do?
• Finite-State Machines (FSM)
• Logic-labeled FSMs
• Examples
• What have they enabled
• software architectures /middleware
• Model-driven development
• Formal verification
• Conclusions
• What can I do so you would use them?
(c)VladEstivill-Castro
3
clfsm : compiled logic-labeled
finite-state machines
• Complete POSIX and C++11 compliance.
• Open source catkin ROS package release (mipal.net.au/downloads.php).
• Transitions are labeled by Boolean expressions (not events), facilitating formal verification
and eliminating all need for concerns about event queues.
• Transition labels are arbitrary C++11 Boolean expressions, enabling reasoning into what
may otherwise seem a purely reactive architecture.
• Handling of machines constructed with states that have UML 2.0 (or SCXML) OnEntry,
OnExit, and Internal sections with clear semantics.
• Guaranteed sequential ringlet schedule for the concurrent execution of FSMs (removing
the need for critical sections and synchronization points).
• Efficient execution as the entire arrangement runs as compiled code without thread
switching.
• Being agnostic to communication mechanisms between machines, allowing, for example
use with ROS:services and ROS:messages – however, we recommend the use of our
class-oriented gusimplewhiteboard.
• Mechanisms for sub-machine hierarchies and introspection to implement complex
behaviors. FSMs can be suspended, resumed, or restarted, as well as queried as to whether
they are running or not.
• Formal semantics that enables simulation, validation, and formal verification.
• Associated tools such as (MiEditLLFSM and MiCASE) that enable rapid development of
FSM arrangements.
• Tested in 64-bit, 32-bit CPUs and even 8-bit controllers like the Atmel AVR.
(c)VladEstivill-Castro
4
Outline
• Two tools
• clfsm
• mipal gusimplewhiteboard
• What do they do?
• Finite-State Machines (FSM)
• Logic-labeled FSMs
• Examples
• What have they enabled
• software architectures /middleware
• Model-driven development
• Formal verification
• Conclusions
• What can I do so you would use them?
(c)VladEstivill-Castro
5
• Widely used model of behavior in embedded systems
• QP (Samek, 2008), Bot- Studio (Michel, 2004) StateWORKS (Wagner et al.,
2006) and MathWorks⃝R StateFlow. The UML form of FSMs derives from
OMT (Rumbaugh et al., 1991, Chapter 5), and the MDD initiatives of
Executable UML (Mellor and Balcer, 2002).
• The original Subsumption Architecture was implemented using the
Subsumption Language
• It was based on finite state machines (FSMs) augmented with
timers (AFSMs)
• AFSMs were implemented in Lisp
Finite-State Machines (FSM)
(c)VladEstivill-Castro
6
©V.Estivill-Castro
7
State Diagram /
Finite State Automaton
Motors forward Motors halted
For 0.1 sec
Light visible
Light
visible
Light NOT visible
Light NOT
visible
In UML,
events label
transitions
©V.Estivill-Castro
8
LabVIEW (short for Laboratory Virtual Instrument Engineering Workbench)
LEGO RoboLab
Robot control (philosophies)
• Open Loop Control
• Just carry on, don’t look at the environment
• Feedback control
• Minimize the error to the desired state
• Reactive Control
• Don’t think, (re)act.
• Deliberative (Planner-based/Logic -based) Control
• Think hard, act later.
• Hybrid Control
• Think and act separately & concurrently.
• Behavior-Based Control (BBC)
• Think the way you act.
(c)VladEstivill-Castro
9
No use of logic
no use of common sense
no intelligence?
How is a robot architecture
organized
(c)VladEstivill-Castro
10
From “Behavior-Based Robotics” by R. Arkin, MIT Press, 1998
Logic-labeled FSMs
• A second view of time (since Harel’s seminal paper)
• Machines are not waiting in the state for events
• The machines drive, execute
• The transitions are expressions in a logic
• or queries to an expert system
(c)VladEstivill-Castro
11
attack for a
bit
is the game over?
I am injured?
did the team lost possession?
are the fans misbehaving?
% BallConditions.d
name{BALLCONDITIONS}.
input{badProportionXY}.
input{badProportionYX}.
input{badDensityVsDensityTolerance}.
BC0: {} => is_it_a_ball.
BC1: badProportionXY => ~is_it_a_ball. BC1 > BC0.
BC2: badProportionYX => ~is_it_a_ball. BC2 > BC0.
BC3: badDensityVsDensityTolerance => ~is_it_a_ball. BC3 > BC0.
output{b is_it_a_ball, "is_it_a_ball"}.
Example from robotic soccer
(c)VladEstivill-Castro
12
Logic labeled FSMs provide deliverative control
Any C++11
code
Any C++11
Boolean
expression
(code)
Outline
• Two tools
• clfsm
• mipal gusimplewhiteboard
• What do they do?
• Finite-State Machines (FSM)
• Logic-labeled FSMs
• Examples
• What have they enabled
• software architectures /middleware
• Model-driven development
• Formal verification
• Conclusions
• What can I do so you would use them?
(c)VladEstivill-Castro
13
Example 1: Pure reactive control
• https://www.youtube.com/watch?v=F8K4V78vUbk&feature=youtu.be
(c)VladEstivill-Castro
14
Example 2: BatMan moves
(reactive control on a Nao)
• https://www.youtube.com/watch?v=gN6rIveCWNk&feature=youtu.be
(c)VladEstivill-Castro
15
Example 2: BatMan moves
(reactive control on a Nao)
• https://www.youtube.com/watch?v=gN6rIveCWNk&feature=youtu.be
(c)VladEstivill-Castro
16
Example 3: Reactive control on ROS
• https://www.youtube.com/watch?v=AJYA2hB4i9U&feature=youtu.be
(c)VladEstivill-Castro
17
A turtle afraid of the walls
(c)VladEstivill-Castro
18
A turtle afraid of the walls
(c)VladEstivill-Castro
19
Example 4: Behavior Based
Control / Subsumption
Architecture
Mechanisms for sub-machine hierarchies and introspection to implement
complex behaviors. FSMs can be suspended, resumed, or restarted, as
well as queried as to whether they are running or not.
(c)VladEstivill-Castro
20
Example 5: RoboCup Game
Controller
(c)VladEstivill-Castro
21
Mechanisms for sub-machine hierarchies and introspection to implement
complex behaviors. FSMs can be suspended, resumed, or restarted, as
well as queried as to whether they are running or not.
clfsm : compiled logic-labeled
finite-state machines
• Complete POSIX and C++11 compliance.
• Open source catkin ROS package release (mipal.net.au/downloads.php).
• Transitions are labeled by Boolean expressions (not events), facilitating formal verification
and eliminating all need for concerns about event queues.
• Transition labels are arbitrary C++11 Boolean expressions, enabling reasoning into what
may otherwise seem a purely reactive architecture.
• Handling of machines constructed with states that have UML 2.0 (or SCXML) OnEntry,
OnExit, and Internal sections with clear semantics.
• Guaranteed sequential ringlet schedule for the concurrent execution of FSMs (removing
the need for critical sections and synchronization points).
• Efficient execution as the entire arrangement runs as compiled code without thread
switching.
• Being agnostic to communication mechanisms between machines, allowing, for example
use with ROS:services and ROS:messages – however, we recommend the use of our
class-oriented gusimplewhiteboard.
• Mechanisms for sub-machine hierarchies and introspection to implement complex
behaviors. FSMs can be suspended, resumed, or restarted, as well as queried as to whether
they are running or not.
• Formal semantics that enables simulation, validation, and formal verification.
• Associated tools such as (MiEditLLFSM and MiCASE) that enable rapid development of
FSM arrangements.
• Tested in 64-bit, 32-bit CPUs, and even 8-bit controllers like the Atmel AVR.
(c)VladEstivill-Castro
22
SUMMARY
Outline
• Two tools
• clfsm
• mipal gusimplewhiteboard
• What do they do?
• Finite-State Machines (FSM)
• Logic-labeled FSMs
• Examples
• What have they enabled
• software architectures /middleware
• Model-driven development
• Formal verification
• Conclusions
• What can I do so you would use them?
(c)VladEstivill-Castro
23
gusimplewhiteboard :In
memory OO-messages/classes
• Completely C++11 and POSIX compliant; thus, platform
independent: used on Mac OS X (Mountain Lion), LINUX
13.10, Aldebaran Nao 1.14.3, Webots 7.1, the Raspberry Pi
(www.raspberrypi.org), and Lego NXT.
• Released as a ROS:catkin package
(mipal.net.au/downloads.php).
• Extremely fast performance for add_Message and
get_Message, intra-process as well as inter-process.
• Completely OO-compliant. The classes that can be used are
not restricted, the full data-structure mechanisms of C++11
are available.
• Very clear semantics that removes lots of issues of
concurrency control.
(c)VladEstivill-Castro
24
Middleware - Architecture
• In robotics we need to integrate many pieces of software in
charge of different things
• Sensors
• Actuators
• Filtering the sensors
• Fusing the sensors
• Coordinating the actuators
• making the motors in an arm control the arm
• Perform tasks, make decision, plan, learn
• Communicate with others
©V.Estivill-Castro
25
Software Engineering concerns
• Modularity
• Integration
• Reliability/ Testing
• Development cycle
• Simulations
• Monitoring
©V.Estivill-Castro
26
Whiteboard/Blackboard
architecture
©V.Estivill-Castro
27
Reduce the number of APIs
Conceptual cycle
• Similar to a ‘reactive-architecture’
• Similar to a whiteboard architecture
(c)VladEstivill-Castro
28
w
h
i
h
e
b
o
a
r
d
sensor 1
sensor space of the robot
sensor 2
sensor 3
sensor 4
sensor n
CONTROL AT ITS OWN TIME
Do the right thing by the state
of the world
t
h
e
i
r
o
w
n
t
i
m
e
• Deliberative control
architecture by symbolic-
modeling systems (logics)
• Behavior-base control by
arrangements of FSMs
Modes of communication
• PULL (closer to time-triggered)
• receivers query the whiteboard for the latest from the sender
• own thread for the receiver
• sender just does and add message
• PUSH (closer to event-driven)
• the receivers subscribe a call-back in the whiteboard
• add message by sender spans new threads in the receivers
©V.Estivill-Castro
29
Whiteboard
Sender Receiver
Receiver
Receiver
Receiver
add_Message
• Includes
#include "gugenericwhiteboardobject.h"
#include "guwhiteboardtypelist_generated.h”
• Declare a handler
Ball_Belief_t wb_ball;
• Construct you objects (with the constructor of the OO-class)
Ball_Belief a_ball(50,30);
• Use the setter to actually post to the whiteboard
wb_ball.set(a_ball);
(c)VladEstivill-Castro
30
get_Message
• Includes
#include "gugenericwhiteboardobject.h"
#include "guwhiteboardtypelist_generated.h”
• Declare a handler
Ball_Belief_t wb_ball;
• Retrieve your object
Ball_Belief ball = wb_ball.get();
// or alternatively: ball = wb_ball();
(c)VladEstivill-Castro
31
Illustration of OO facility
• Declare a handler
(c)VladEstivill-Castro
32
• Retrieve an object and
its property
• Properties are objects
Speed
• Of the order of 50 times faster than ROS
• 2013 Mac Pro, 3 GHz 8-Core Intel Xeon E5, 32 GB memory
1867 MHz DDR3 ECC RAM
• Identical compiler flags (compiled with catkin_make)
(c)VladEstivill-Castro
33
One Minute Microwave
• Widely discussed in the literature
of software engineering
• Analogous to the X-Ray machine
• Therac-25 radiation machine that
caused harm to patients
• Important SAFETY feature
• OPENING THE DOOR SHALL STOP
THE COOKING
(c)VladEstivill-Castro
34
Requirements
(c)VladEstivill-Castro
35
Requirements Description
R1 There is a single control button available for the use of the oven. If the
oven is closed and you push the button, the oven will start cooking (that
is, energize the power-tube) for one minute
R2 If the button is pushed while the oven is cooking, it will cause the oven
to cook for an extra minute.
R3 Pushing the button when the door is open has no effect.
R4 Whenever the oven is cooking or the door is open, the light in the oven
will be on.
R5 Opening the door stops the cooking.
R6 Closing the door turns off the light. This is the normal idle state, prior to
cooking when the user has placed food in the oven.
R7 If the oven times out, the light and the power-tube are turned off and
then a beeper emits a warning beep to indicate that the cooking has
finished.
and does not clear the timer
and stops the timer
One of the FSMs
(c)VladEstivill-Castro
36
% MicrowaveCook.d
name{MicrowaveCook}.
input{timeLeft}.
input{doorOpen}.
C0: {} => ~cook.
C1: timeLeft => cook. C1 > C0.
C2: doorOpen => ~cook. C2 > C1.
output{b cook, "cook"}.
Embedded systems are
performing several things
• The models is made of several finite state-machines
• Behavior-based control
• With a rich language of logic, the modeling aspect is
decomposed
• the action /reaction part of the system
• the states and transitions of the finite-state machine
• the declarative knowledge of the world
• the logic system
(c)VladEstivill-Castro
37
The complete arrangement
(c)VladEstivill-Castro
38
2 OFF
OnEntry {int sound; sound=0;}
OnExit {}
{}
1 ARMED
OnEntry {}
OnExit {}
{}
timeLeft
timeout(2000000)
1 RINGING
OnEntry {sound=1;}
OnExit {}
{}
!timeLeft
2 NOT_COOKING
OnEntry {int motor; motor=0;}
OnExit {}
{}
1 COOKING
OnEntry {motor=1;}
OnExit {}
{}
!doorOpen && timeleft
doorOpen || ! timeLeft
2 NOT_SHINE_LIGHT
OnEntry {int light; light=0;}
OnExit {}
{}
1 SHINE_LIGHT
OnEntry {light=1;}
OnExit {}
{}
doorOpen || timeLeft
!doorOpen && ! timeLeft
1 INIT
OnEntry {int currentTime; extern buttonPushed;
extern doorOpen; currentTime=0;}
OnExit {}
{}
2 TEST
OnEntry
{timeLeft=0<currentTime;}
OnExit {}
{}
true
true
4 DECREMENT
OnEntry {currentTime=currentTime-1;}
OnExit {}
{}
buttonPushed && !doorOpen && (currentTime<4035)
3 ADD_60
OnEntry {currentTime=60+currentTime;}
OnExit {timeLeft=1;}
{}
!buttonPushed
!doorOpen && timeLeft && timeout(1000000)
Light
Motor
Bell
Timer
Execute in predefined
schedule ti ringlets
of FSM Mi
DPL
LOGIC IS COMPILED
That is all folks!
©VladEstivill-Castro
39
Demo video
http://www.youtube.com/watch?v=t4ueI1o67Xk&feature=relmfu
(c)VladEstivill-Castro
40
Simulator (embedded system:
Industrial press)
(c)VladEstivill-Castro
41
http://www.youtube.com/watch?v=FpVUSrvLI0c&feature=relmfu
On-line debugging and
simulation
(c)VladEstivill-Castro
42
Outline
• Two tools
• clfsm
• mipal gusimplewhiteboard
• What do they do?
• Finite-State Machines (FSM)
• Logic-labeled FSMs
• Examples
• What have they enabled
• software architectures /middleware
• Model-driven development
• Formal verification
• Conclusions
• What can I do so you would use them?
(c)VladEstivill-Castro
43
Regulate the number of
threads
clfsm SMGameController Safety_BatteryMonitor
SMFallManager SMButtonChest SMButtonLeftFoot
SMButtonRightFoot SMRobotPosition SMSayIP SMShutdown
clfsm SMSoundStartStop SMSoundWhistle SMSoundDemo
SMGetUp SMPlayer SMBallFollower SMKicker SMHeadScanner
SMBallSeeker SMReadyFromInitial SMReadyFromAnywhere
SMHeadBallTracker SMWalkScanner SMSeeker Color_Learner
SMHeadScannerGoal SMHeadGoalTracker SMGetCloseToGoal
SMSet SMFindGoalOnSpot SMGoalieSaver SMFindGoalOnSpot
SMLeapController SMTeleoperationController
SMTeleoperation SMTeleoperationHeadControl BatNaoMoves
StopMotionRecorder SMYouCannotCatchMe
clfsm gukalmanfilter
clfsm guUDPreceiver
(c)VladEstivill-Castro
44
One thread
Second thread
Third thread
Fourth thread
Very quick development of
behaviors
• Very rapidly produces
results
• Very rapidly we can trace
the observed behavior to
the code
• Very rapidly we have
building blocks that add
sophistication
• All the behaviors in one go
(c)VladEstivill-Castro
45
The two paradigms
• Event-triggered
• optimistic
• best-case, response
time
• can’t handle event-
showers
• not predictable
• not scalable
• repeat the verification
• Time-triggered
• pessimistic
• regular response time
• predictable
• scalable
(c)VladEstivill-Castro
46Kopetz, H.: “Should Responsive Systems be Event-Triggered or
Time- Triggered?”
IEICE Transactions on Information and Systems 76(11), 1325
(November 1993)
Check out
clfsm
(c)VladEstivill-Castro
47
Let us know what you think
©V.Estivill-Castro
48
Conceptual cycle
• Similar to a ‘reactive-architecture’
• Similar to a whiteboard architecture
(c)VladEstivill-Castro
49
w
h
i
h
e
b
o
a
r
d
sensor 1
sensory space of the robot
sensor 2
sensor 3
sensor 4
sensor n
CONTROL AT ITS OWN TIME
Do the right thing by the state
of the world
t
h
e
i
r
o
w
n
t
i
m
e
• Deliberative control
architecture by logics
• Behavior-base control
by vectors of FSMs
under one CPU
rate for the sensors
Conceptual cycle
• Similar to a ‘reactive-architecture’
• Similar to a whiteboard architecture
(c)VladEstivill-Castro
50
w
h
i
h
e
b
o
a
r
d
sensor 1
sensory space of the robot
sensor 2
sensor 3
sensor 4
sensor n
CONTROL AT ITS OWN TIME
Do the right thing by the state
of the world
t
h
e
i
r
o
w
n
t
i
m
e
• Deliberative control
architecture by logics
• Behavior-base control
by vectors of FSMs
under one CPU
rate for the sensors
time t2
Conceptual cycle
• Similar to a ‘reactive-architecture’
• Similar to a whiteboard architecture
(c)VladEstivill-Castro
51
w
h
i
h
e
b
o
a
r
d
sensor 1
sensor space of the robot
and memory is FINITE
sensor 2
sensor 3
sensor 4
sensor n
CONTROL AT ITS OWN TIME
Do the right thing by the state
of the world
t
h
e
i
r
o
w
n
t
i
m
e
• Deliberative control
architecture by logics
• Behavior-base control
by vectors of FSMs
under one CPU
rate for the sensors
time t3
Conceptual cycle
• Similar to a ‘reactive-architecture’
• Similar to a whiteboard architecture
(c)VladEstivill-Castro
52
w
h
i
h
e
b
o
a
r
d
sensor 1
sensory space of the robot
and memory is FINITE
sensor 2
sensor 3
sensor 4
sensor n
CONTROL AT ITS OWN TIME
Do the right thing by the state
of the world
t
h
e
i
r
o
w
n
t
i
m
e
• Deliberative control
architecture by logics
• Behavior-base control
by vectors of FSMs
under one CPU
rate for the sensors
time t3
FULL REACTIVE
DO THE RIGHT THING
FOR MEMORY AND
SENSOR SPACE
Conceptual cycle
• Similar to a ‘reactive-architecture’
• Similar to a whiteboard architecture
(c)VladEstivill-Castro
53
under several CPU
rate for the sensors
w
h
i
h
e
b
o
a
r
d
sensor 1
sensor 2
sensor 3
sensor 4
sensor n
CONTROL AT ITS OWN TIME
Do the right thing by the state of
the world
FULL REACTIVE
DO THE RIGHT THING
FOR MEMORY AND
SENSOR SPACE
w
h
i
h
e
b
o
a
r
d
sensor 1
sensor 2
sensor 3
sensor 4
sensor n
CONTROL AT ITS OWN TIME
Do the right thing by the state of
the world
FULL REACTIVE
DO THE RIGHT THING
FOR MEMORY AND
SENSOR SPACE
sensor C1
sensor C2

More Related Content

PPTX
Simple presen tense
PPTX
Kevin docs
PPTX
¿Que son las Tic's?
PPTX
Trabajo 1 programacion
PPTX
Presentación1
PPT
Web 2.0 hacia la web 3.0
PPT
The return of the come back
PPTX
Termeszeti eroforrasok
Simple presen tense
Kevin docs
¿Que son las Tic's?
Trabajo 1 programacion
Presentación1
Web 2.0 hacia la web 3.0
The return of the come back
Termeszeti eroforrasok

Viewers also liked (15)

PPSX
Are compu
PDF
Libro conclusiones matemáticas 2º trimestre i
PPTX
Sdnms protocolo
PPTX
Sdnms bienvenida
PPTX
Tecnología educativa
PPTX
Catalogo de rares habbosmurf
PDF
Facultad de filosofia ciencias y letras de la
PPTX
Las huelgas
DOC
Esp. mat
PPTX
Presentación1
PDF
Libro conclusiones matemáticas 2º trimestre i
PPTX
PDF
Cuadernillo entregado en Semana Santa: Memorización
Are compu
Libro conclusiones matemáticas 2º trimestre i
Sdnms protocolo
Sdnms bienvenida
Tecnología educativa
Catalogo de rares habbosmurf
Facultad de filosofia ciencias y letras de la
Las huelgas
Esp. mat
Presentación1
Libro conclusiones matemáticas 2º trimestre i
Cuadernillo entregado en Semana Santa: Memorización
Ad

Similar to High Performance Relaying of C++11 Objects Across Processes and Logic-Labeled Finite-State Machines” Simpar2014 (20)

PDF
Nelson: Rigorous Deployment for a Functional World
PDF
Enabling Model Testing of Cyber Physical Systems
PPTX
Software Architectures, Week 2 - Decomposition techniques
PPTX
Provenance for Data Munging Environments
PDF
Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)
PPTX
Q1 Memory Fabric Forum: CXL-Related Activities within OCP
PDF
PuppetConf 2017: No Server Left Behind - Miguel Di Ciurcio Filho, Instruct
PDF
Recent software and services to support the SBML community
PPTX
Tips for Developing and Testing IBM HATS Applications
PDF
Building an Experimentation Platform in Clojure
PDF
Evaluating Model Testing and Model Checking for Finding Requirements Violatio...
PDF
Chaos Engineering - The Art of Breaking Things in Production
PDF
Verifiable Parameterised Behaviour Models For Robotic and Embedded Systems
PDF
Container Mythbusters
PDF
A summary of various COMBINE standardization activities
PDF
Chap 6 lesson5emsysnewstatemachinefsm
PPTX
Performance tuning Grails Applications GR8Conf US 2014
PDF
PDF
Parallel Vector Tile-Optimized Library (PVTOL) Architecture-v3.pdf
PDF
Welcome Our Robot Overlords
Nelson: Rigorous Deployment for a Functional World
Enabling Model Testing of Cyber Physical Systems
Software Architectures, Week 2 - Decomposition techniques
Provenance for Data Munging Environments
Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)
Q1 Memory Fabric Forum: CXL-Related Activities within OCP
PuppetConf 2017: No Server Left Behind - Miguel Di Ciurcio Filho, Instruct
Recent software and services to support the SBML community
Tips for Developing and Testing IBM HATS Applications
Building an Experimentation Platform in Clojure
Evaluating Model Testing and Model Checking for Finding Requirements Violatio...
Chaos Engineering - The Art of Breaking Things in Production
Verifiable Parameterised Behaviour Models For Robotic and Embedded Systems
Container Mythbusters
A summary of various COMBINE standardization activities
Chap 6 lesson5emsysnewstatemachinefsm
Performance tuning Grails Applications GR8Conf US 2014
Parallel Vector Tile-Optimized Library (PVTOL) Architecture-v3.pdf
Welcome Our Robot Overlords
Ad

Recently uploaded (20)

PDF
Encapsulation theory and applications.pdf
PPT
Teaching material agriculture food technology
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
KodekX | Application Modernization Development
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Big Data Technologies - Introduction.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
Encapsulation theory and applications.pdf
Teaching material agriculture food technology
Building Integrated photovoltaic BIPV_UPV.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Unlocking AI with Model Context Protocol (MCP)
20250228 LYD VKU AI Blended-Learning.pptx
KodekX | Application Modernization Development
Encapsulation_ Review paper, used for researhc scholars
Digital-Transformation-Roadmap-for-Companies.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
MIND Revenue Release Quarter 2 2025 Press Release
Big Data Technologies - Introduction.pptx
MYSQL Presentation for SQL database connectivity
Advanced methodologies resolving dimensionality complications for autism neur...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Reach Out and Touch Someone: Haptics and Empathic Computing

High Performance Relaying of C++11 Objects Across Processes and Logic-Labeled Finite-State Machines” Simpar2014

  • 1. High PerformanceRelayingof C++11Objects acrossProcesses and Logic-Labeled Finite-StateMachines V. ESTIVILL-CASTRO* *Griffith University, Nathan Campus, Brisbane, Australia. v.estivill-castrol@griffith.edu.au, In collaboration with Rene Hexel, Carl Lusty and many other members of MiPal (c)VladEstivill-Castro 1
  • 2. Outline • Two tools • clfsm • mipal gusimplewhiteboard • What do they do? • Finite-State Machines (FSM) • Logic-labeled FSMs • Examples • What have they enabled • software architectures /middleware • Model-driven development • Formal verification • Conclusions • What can I do so you would use them? (c)VladEstivill-Castro 2
  • 3. Outline • Two tools • clfsm • mipal gusimplewhiteboard • What do they do? • Finite-State Machines (FSM) • Logic-labeled FSMs • Examples • What have they enabled • software architectures /middleware • Model-driven development • Formal verification • Conclusions • What can I do so you would use them? (c)VladEstivill-Castro 3
  • 4. clfsm : compiled logic-labeled finite-state machines • Complete POSIX and C++11 compliance. • Open source catkin ROS package release (mipal.net.au/downloads.php). • Transitions are labeled by Boolean expressions (not events), facilitating formal verification and eliminating all need for concerns about event queues. • Transition labels are arbitrary C++11 Boolean expressions, enabling reasoning into what may otherwise seem a purely reactive architecture. • Handling of machines constructed with states that have UML 2.0 (or SCXML) OnEntry, OnExit, and Internal sections with clear semantics. • Guaranteed sequential ringlet schedule for the concurrent execution of FSMs (removing the need for critical sections and synchronization points). • Efficient execution as the entire arrangement runs as compiled code without thread switching. • Being agnostic to communication mechanisms between machines, allowing, for example use with ROS:services and ROS:messages – however, we recommend the use of our class-oriented gusimplewhiteboard. • Mechanisms for sub-machine hierarchies and introspection to implement complex behaviors. FSMs can be suspended, resumed, or restarted, as well as queried as to whether they are running or not. • Formal semantics that enables simulation, validation, and formal verification. • Associated tools such as (MiEditLLFSM and MiCASE) that enable rapid development of FSM arrangements. • Tested in 64-bit, 32-bit CPUs and even 8-bit controllers like the Atmel AVR. (c)VladEstivill-Castro 4
  • 5. Outline • Two tools • clfsm • mipal gusimplewhiteboard • What do they do? • Finite-State Machines (FSM) • Logic-labeled FSMs • Examples • What have they enabled • software architectures /middleware • Model-driven development • Formal verification • Conclusions • What can I do so you would use them? (c)VladEstivill-Castro 5
  • 6. • Widely used model of behavior in embedded systems • QP (Samek, 2008), Bot- Studio (Michel, 2004) StateWORKS (Wagner et al., 2006) and MathWorks⃝R StateFlow. The UML form of FSMs derives from OMT (Rumbaugh et al., 1991, Chapter 5), and the MDD initiatives of Executable UML (Mellor and Balcer, 2002). • The original Subsumption Architecture was implemented using the Subsumption Language • It was based on finite state machines (FSMs) augmented with timers (AFSMs) • AFSMs were implemented in Lisp Finite-State Machines (FSM) (c)VladEstivill-Castro 6
  • 7. ©V.Estivill-Castro 7 State Diagram / Finite State Automaton Motors forward Motors halted For 0.1 sec Light visible Light visible Light NOT visible Light NOT visible In UML, events label transitions
  • 8. ©V.Estivill-Castro 8 LabVIEW (short for Laboratory Virtual Instrument Engineering Workbench) LEGO RoboLab
  • 9. Robot control (philosophies) • Open Loop Control • Just carry on, don’t look at the environment • Feedback control • Minimize the error to the desired state • Reactive Control • Don’t think, (re)act. • Deliberative (Planner-based/Logic -based) Control • Think hard, act later. • Hybrid Control • Think and act separately & concurrently. • Behavior-Based Control (BBC) • Think the way you act. (c)VladEstivill-Castro 9 No use of logic no use of common sense no intelligence?
  • 10. How is a robot architecture organized (c)VladEstivill-Castro 10 From “Behavior-Based Robotics” by R. Arkin, MIT Press, 1998
  • 11. Logic-labeled FSMs • A second view of time (since Harel’s seminal paper) • Machines are not waiting in the state for events • The machines drive, execute • The transitions are expressions in a logic • or queries to an expert system (c)VladEstivill-Castro 11 attack for a bit is the game over? I am injured? did the team lost possession? are the fans misbehaving?
  • 12. % BallConditions.d name{BALLCONDITIONS}. input{badProportionXY}. input{badProportionYX}. input{badDensityVsDensityTolerance}. BC0: {} => is_it_a_ball. BC1: badProportionXY => ~is_it_a_ball. BC1 > BC0. BC2: badProportionYX => ~is_it_a_ball. BC2 > BC0. BC3: badDensityVsDensityTolerance => ~is_it_a_ball. BC3 > BC0. output{b is_it_a_ball, "is_it_a_ball"}. Example from robotic soccer (c)VladEstivill-Castro 12 Logic labeled FSMs provide deliverative control Any C++11 code Any C++11 Boolean expression (code)
  • 13. Outline • Two tools • clfsm • mipal gusimplewhiteboard • What do they do? • Finite-State Machines (FSM) • Logic-labeled FSMs • Examples • What have they enabled • software architectures /middleware • Model-driven development • Formal verification • Conclusions • What can I do so you would use them? (c)VladEstivill-Castro 13
  • 14. Example 1: Pure reactive control • https://www.youtube.com/watch?v=F8K4V78vUbk&feature=youtu.be (c)VladEstivill-Castro 14
  • 15. Example 2: BatMan moves (reactive control on a Nao) • https://www.youtube.com/watch?v=gN6rIveCWNk&feature=youtu.be (c)VladEstivill-Castro 15
  • 16. Example 2: BatMan moves (reactive control on a Nao) • https://www.youtube.com/watch?v=gN6rIveCWNk&feature=youtu.be (c)VladEstivill-Castro 16
  • 17. Example 3: Reactive control on ROS • https://www.youtube.com/watch?v=AJYA2hB4i9U&feature=youtu.be (c)VladEstivill-Castro 17
  • 18. A turtle afraid of the walls (c)VladEstivill-Castro 18
  • 19. A turtle afraid of the walls (c)VladEstivill-Castro 19
  • 20. Example 4: Behavior Based Control / Subsumption Architecture Mechanisms for sub-machine hierarchies and introspection to implement complex behaviors. FSMs can be suspended, resumed, or restarted, as well as queried as to whether they are running or not. (c)VladEstivill-Castro 20
  • 21. Example 5: RoboCup Game Controller (c)VladEstivill-Castro 21 Mechanisms for sub-machine hierarchies and introspection to implement complex behaviors. FSMs can be suspended, resumed, or restarted, as well as queried as to whether they are running or not.
  • 22. clfsm : compiled logic-labeled finite-state machines • Complete POSIX and C++11 compliance. • Open source catkin ROS package release (mipal.net.au/downloads.php). • Transitions are labeled by Boolean expressions (not events), facilitating formal verification and eliminating all need for concerns about event queues. • Transition labels are arbitrary C++11 Boolean expressions, enabling reasoning into what may otherwise seem a purely reactive architecture. • Handling of machines constructed with states that have UML 2.0 (or SCXML) OnEntry, OnExit, and Internal sections with clear semantics. • Guaranteed sequential ringlet schedule for the concurrent execution of FSMs (removing the need for critical sections and synchronization points). • Efficient execution as the entire arrangement runs as compiled code without thread switching. • Being agnostic to communication mechanisms between machines, allowing, for example use with ROS:services and ROS:messages – however, we recommend the use of our class-oriented gusimplewhiteboard. • Mechanisms for sub-machine hierarchies and introspection to implement complex behaviors. FSMs can be suspended, resumed, or restarted, as well as queried as to whether they are running or not. • Formal semantics that enables simulation, validation, and formal verification. • Associated tools such as (MiEditLLFSM and MiCASE) that enable rapid development of FSM arrangements. • Tested in 64-bit, 32-bit CPUs, and even 8-bit controllers like the Atmel AVR. (c)VladEstivill-Castro 22 SUMMARY
  • 23. Outline • Two tools • clfsm • mipal gusimplewhiteboard • What do they do? • Finite-State Machines (FSM) • Logic-labeled FSMs • Examples • What have they enabled • software architectures /middleware • Model-driven development • Formal verification • Conclusions • What can I do so you would use them? (c)VladEstivill-Castro 23
  • 24. gusimplewhiteboard :In memory OO-messages/classes • Completely C++11 and POSIX compliant; thus, platform independent: used on Mac OS X (Mountain Lion), LINUX 13.10, Aldebaran Nao 1.14.3, Webots 7.1, the Raspberry Pi (www.raspberrypi.org), and Lego NXT. • Released as a ROS:catkin package (mipal.net.au/downloads.php). • Extremely fast performance for add_Message and get_Message, intra-process as well as inter-process. • Completely OO-compliant. The classes that can be used are not restricted, the full data-structure mechanisms of C++11 are available. • Very clear semantics that removes lots of issues of concurrency control. (c)VladEstivill-Castro 24
  • 25. Middleware - Architecture • In robotics we need to integrate many pieces of software in charge of different things • Sensors • Actuators • Filtering the sensors • Fusing the sensors • Coordinating the actuators • making the motors in an arm control the arm • Perform tasks, make decision, plan, learn • Communicate with others ©V.Estivill-Castro 25
  • 26. Software Engineering concerns • Modularity • Integration • Reliability/ Testing • Development cycle • Simulations • Monitoring ©V.Estivill-Castro 26
  • 28. Conceptual cycle • Similar to a ‘reactive-architecture’ • Similar to a whiteboard architecture (c)VladEstivill-Castro 28 w h i h e b o a r d sensor 1 sensor space of the robot sensor 2 sensor 3 sensor 4 sensor n CONTROL AT ITS OWN TIME Do the right thing by the state of the world t h e i r o w n t i m e • Deliberative control architecture by symbolic- modeling systems (logics) • Behavior-base control by arrangements of FSMs
  • 29. Modes of communication • PULL (closer to time-triggered) • receivers query the whiteboard for the latest from the sender • own thread for the receiver • sender just does and add message • PUSH (closer to event-driven) • the receivers subscribe a call-back in the whiteboard • add message by sender spans new threads in the receivers ©V.Estivill-Castro 29 Whiteboard Sender Receiver Receiver Receiver Receiver
  • 30. add_Message • Includes #include "gugenericwhiteboardobject.h" #include "guwhiteboardtypelist_generated.h” • Declare a handler Ball_Belief_t wb_ball; • Construct you objects (with the constructor of the OO-class) Ball_Belief a_ball(50,30); • Use the setter to actually post to the whiteboard wb_ball.set(a_ball); (c)VladEstivill-Castro 30
  • 31. get_Message • Includes #include "gugenericwhiteboardobject.h" #include "guwhiteboardtypelist_generated.h” • Declare a handler Ball_Belief_t wb_ball; • Retrieve your object Ball_Belief ball = wb_ball.get(); // or alternatively: ball = wb_ball(); (c)VladEstivill-Castro 31
  • 32. Illustration of OO facility • Declare a handler (c)VladEstivill-Castro 32 • Retrieve an object and its property • Properties are objects
  • 33. Speed • Of the order of 50 times faster than ROS • 2013 Mac Pro, 3 GHz 8-Core Intel Xeon E5, 32 GB memory 1867 MHz DDR3 ECC RAM • Identical compiler flags (compiled with catkin_make) (c)VladEstivill-Castro 33
  • 34. One Minute Microwave • Widely discussed in the literature of software engineering • Analogous to the X-Ray machine • Therac-25 radiation machine that caused harm to patients • Important SAFETY feature • OPENING THE DOOR SHALL STOP THE COOKING (c)VladEstivill-Castro 34
  • 35. Requirements (c)VladEstivill-Castro 35 Requirements Description R1 There is a single control button available for the use of the oven. If the oven is closed and you push the button, the oven will start cooking (that is, energize the power-tube) for one minute R2 If the button is pushed while the oven is cooking, it will cause the oven to cook for an extra minute. R3 Pushing the button when the door is open has no effect. R4 Whenever the oven is cooking or the door is open, the light in the oven will be on. R5 Opening the door stops the cooking. R6 Closing the door turns off the light. This is the normal idle state, prior to cooking when the user has placed food in the oven. R7 If the oven times out, the light and the power-tube are turned off and then a beeper emits a warning beep to indicate that the cooking has finished. and does not clear the timer and stops the timer
  • 36. One of the FSMs (c)VladEstivill-Castro 36 % MicrowaveCook.d name{MicrowaveCook}. input{timeLeft}. input{doorOpen}. C0: {} => ~cook. C1: timeLeft => cook. C1 > C0. C2: doorOpen => ~cook. C2 > C1. output{b cook, "cook"}.
  • 37. Embedded systems are performing several things • The models is made of several finite state-machines • Behavior-based control • With a rich language of logic, the modeling aspect is decomposed • the action /reaction part of the system • the states and transitions of the finite-state machine • the declarative knowledge of the world • the logic system (c)VladEstivill-Castro 37
  • 38. The complete arrangement (c)VladEstivill-Castro 38 2 OFF OnEntry {int sound; sound=0;} OnExit {} {} 1 ARMED OnEntry {} OnExit {} {} timeLeft timeout(2000000) 1 RINGING OnEntry {sound=1;} OnExit {} {} !timeLeft 2 NOT_COOKING OnEntry {int motor; motor=0;} OnExit {} {} 1 COOKING OnEntry {motor=1;} OnExit {} {} !doorOpen && timeleft doorOpen || ! timeLeft 2 NOT_SHINE_LIGHT OnEntry {int light; light=0;} OnExit {} {} 1 SHINE_LIGHT OnEntry {light=1;} OnExit {} {} doorOpen || timeLeft !doorOpen && ! timeLeft 1 INIT OnEntry {int currentTime; extern buttonPushed; extern doorOpen; currentTime=0;} OnExit {} {} 2 TEST OnEntry {timeLeft=0<currentTime;} OnExit {} {} true true 4 DECREMENT OnEntry {currentTime=currentTime-1;} OnExit {} {} buttonPushed && !doorOpen && (currentTime<4035) 3 ADD_60 OnEntry {currentTime=60+currentTime;} OnExit {timeLeft=1;} {} !buttonPushed !doorOpen && timeLeft && timeout(1000000) Light Motor Bell Timer Execute in predefined schedule ti ringlets of FSM Mi DPL LOGIC IS COMPILED
  • 39. That is all folks! ©VladEstivill-Castro 39
  • 41. Simulator (embedded system: Industrial press) (c)VladEstivill-Castro 41 http://www.youtube.com/watch?v=FpVUSrvLI0c&feature=relmfu
  • 43. Outline • Two tools • clfsm • mipal gusimplewhiteboard • What do they do? • Finite-State Machines (FSM) • Logic-labeled FSMs • Examples • What have they enabled • software architectures /middleware • Model-driven development • Formal verification • Conclusions • What can I do so you would use them? (c)VladEstivill-Castro 43
  • 44. Regulate the number of threads clfsm SMGameController Safety_BatteryMonitor SMFallManager SMButtonChest SMButtonLeftFoot SMButtonRightFoot SMRobotPosition SMSayIP SMShutdown clfsm SMSoundStartStop SMSoundWhistle SMSoundDemo SMGetUp SMPlayer SMBallFollower SMKicker SMHeadScanner SMBallSeeker SMReadyFromInitial SMReadyFromAnywhere SMHeadBallTracker SMWalkScanner SMSeeker Color_Learner SMHeadScannerGoal SMHeadGoalTracker SMGetCloseToGoal SMSet SMFindGoalOnSpot SMGoalieSaver SMFindGoalOnSpot SMLeapController SMTeleoperationController SMTeleoperation SMTeleoperationHeadControl BatNaoMoves StopMotionRecorder SMYouCannotCatchMe clfsm gukalmanfilter clfsm guUDPreceiver (c)VladEstivill-Castro 44 One thread Second thread Third thread Fourth thread
  • 45. Very quick development of behaviors • Very rapidly produces results • Very rapidly we can trace the observed behavior to the code • Very rapidly we have building blocks that add sophistication • All the behaviors in one go (c)VladEstivill-Castro 45
  • 46. The two paradigms • Event-triggered • optimistic • best-case, response time • can’t handle event- showers • not predictable • not scalable • repeat the verification • Time-triggered • pessimistic • regular response time • predictable • scalable (c)VladEstivill-Castro 46Kopetz, H.: “Should Responsive Systems be Event-Triggered or Time- Triggered?” IEICE Transactions on Information and Systems 76(11), 1325 (November 1993)
  • 49. Conceptual cycle • Similar to a ‘reactive-architecture’ • Similar to a whiteboard architecture (c)VladEstivill-Castro 49 w h i h e b o a r d sensor 1 sensory space of the robot sensor 2 sensor 3 sensor 4 sensor n CONTROL AT ITS OWN TIME Do the right thing by the state of the world t h e i r o w n t i m e • Deliberative control architecture by logics • Behavior-base control by vectors of FSMs under one CPU rate for the sensors
  • 50. Conceptual cycle • Similar to a ‘reactive-architecture’ • Similar to a whiteboard architecture (c)VladEstivill-Castro 50 w h i h e b o a r d sensor 1 sensory space of the robot sensor 2 sensor 3 sensor 4 sensor n CONTROL AT ITS OWN TIME Do the right thing by the state of the world t h e i r o w n t i m e • Deliberative control architecture by logics • Behavior-base control by vectors of FSMs under one CPU rate for the sensors time t2
  • 51. Conceptual cycle • Similar to a ‘reactive-architecture’ • Similar to a whiteboard architecture (c)VladEstivill-Castro 51 w h i h e b o a r d sensor 1 sensor space of the robot and memory is FINITE sensor 2 sensor 3 sensor 4 sensor n CONTROL AT ITS OWN TIME Do the right thing by the state of the world t h e i r o w n t i m e • Deliberative control architecture by logics • Behavior-base control by vectors of FSMs under one CPU rate for the sensors time t3
  • 52. Conceptual cycle • Similar to a ‘reactive-architecture’ • Similar to a whiteboard architecture (c)VladEstivill-Castro 52 w h i h e b o a r d sensor 1 sensory space of the robot and memory is FINITE sensor 2 sensor 3 sensor 4 sensor n CONTROL AT ITS OWN TIME Do the right thing by the state of the world t h e i r o w n t i m e • Deliberative control architecture by logics • Behavior-base control by vectors of FSMs under one CPU rate for the sensors time t3 FULL REACTIVE DO THE RIGHT THING FOR MEMORY AND SENSOR SPACE
  • 53. Conceptual cycle • Similar to a ‘reactive-architecture’ • Similar to a whiteboard architecture (c)VladEstivill-Castro 53 under several CPU rate for the sensors w h i h e b o a r d sensor 1 sensor 2 sensor 3 sensor 4 sensor n CONTROL AT ITS OWN TIME Do the right thing by the state of the world FULL REACTIVE DO THE RIGHT THING FOR MEMORY AND SENSOR SPACE w h i h e b o a r d sensor 1 sensor 2 sensor 3 sensor 4 sensor n CONTROL AT ITS OWN TIME Do the right thing by the state of the world FULL REACTIVE DO THE RIGHT THING FOR MEMORY AND SENSOR SPACE sensor C1 sensor C2