Introduction to ArtificiaI Intelligence in Higher Education
Integrating Cloud Services in Behaviour Programming for Autonomous Robots
1. Integrating Cloud Services in Behaviour Programming for Autonomous Robots
Integrating Cloud Services in Behaviour
Programming for Autonomous Robots
Fabrizio Messina, Giuseppe Pappalardo, Corrado Santoro
ARSLAB - Autonomous and Robotic Systems Laboratory
Dipartimento di Matematica e Informatica
Universit` di Catania, Italy
a
{messina, pappalardo, santoro}@dmi.unict.it
C-SmartCPS @ ICA3PP 2013 - Vietri sul Mare, 20 Dicembre 2013
2. Integrating Cloud Services in Behaviour Programming for Autonomous Robots
Outline
1 Motivation
2 PROFETA
Basic Entities
Sensors and Actions
Execution Semantics
3 CLEPTA
Architecture
ASync Sensors and
Actions
A Simple Case-Study
4 Conclusions
3. Integrating Cloud Services in Behaviour Programming for Autonomous Robots
Motivation
Motivation (I)
Robots are autonomous systems living in a pysical
environment.
We expect to have home robots in the next few years.
Computing platforms for home robots could not possess the
adequate amount of computing power — i.e. CPU Power
and/or Storage capacity — to perform certain
computation-intensive tasks, e.g.:
Speech to text, text to speech
Speaker recognition
NLP processing
Image processing
Pattern recognition (in general)
...
4. Integrating Cloud Services in Behaviour Programming for Autonomous Robots
Motivation
Motivation (II)
But nowadays home environments are “on the net”
And “computation intensive” tasks could be performed
“in the cloud”
Hence the necessity to include, in robot programming
environment/platforms, a proper support for
Cloud Computing
5. Integrating Cloud Services in Behaviour Programming for Autonomous Robots
PROFETA
Basic Entities
PROFETA Basics
PROFETA (Python RObotic Framework for dEsigning
sTrAtegies) is Python tool for programming autonomous
systems (agents or robots) using the Belief-Desire-Intention
(BDI) model.
Designed at ARSLAB @ UNICT in 2010 and available at
http://github.com/corradosantoro/profeta
PROFETA provides a declarative language as a dialect of
AgentSpeak(L).
PROFETA is an “all-in-one” environment supporting both
imperative (algorithmical part) and declarative (behavioural
part) programming models.
6. Integrating Cloud Services in Behaviour Programming for Autonomous Robots
PROFETA
Basic Entities
PROFETA Basics
PROFETA provides
A set of classes to represent basic BDI entities, i.e.
Beliefs ⇒ Knowledge
Goals ⇒ States to be achieved
Actions ⇒ Things to do to reach the Goals
A declarative language—dialect of AgentSpeak(L)—to express
agent’s behaviour
An engine executing that behaviour
A Knowledge base storing the beliefs
7. Integrating Cloud Services in Behaviour Programming for Autonomous Robots
PROFETA
Basic Entities
PROFETA Declarative Syntax
A PROFETA behaviour is a set of rules in the form
Event / Condition >> set of Action
where:
Event can be: belief assert or retract, goal achievement
request, goal failure.
Condition refers to a certain state of the knowledge base.
Action can be: belief assert or retract, goal achievement
request, Python expressions, user defined atomic action.
Example:
+object_at("X","Y") / object_got("no") >>
[ move_to("X", "Y"), pick_object() ]
Such expressions are managed thanks to operator
overloading
8. Integrating Cloud Services in Behaviour Programming for Autonomous Robots
PROFETA
Sensors and Actions
Interface with environment: Actions
In order to interact with the environment, two abstractions
are provided:
Actions
Sensors
An action is defined as a subclass of Action.
The execute() method has to implement the computation
which concretely performs the action.
The associated computation is executed atomically.
9. Integrating Cloud Services in Behaviour Programming for Autonomous Robots
PROFETA
Sensors and Actions
Sensors
A Sensor class is provided with the objective of allowing the
programmer to write the proper code to “sense” the
environment and generate the proper beliefs.
The programmer has to:
subclass Sensor
override the sense() method
inform the Engine that a new sensor has been added in the
program.
Method sense() may return
None, nothing has been sensed
+bel(...), something has been sensed, a belief is added to
the KB and the “add event” is generated.
bel(...), something has been sensed, a belief is added to
the KB but the “add event” is NOT generated.
10. Integrating Cloud Services in Behaviour Programming for Autonomous Robots
PROFETA
Execution Semantics
PROFETA (Informal) Execution Semantics
PROFETA Main Loop Execution:
1
Scan sensors and, for each of them, call the sense() method
and analyse the return value.
2
If the return value is an event, e.g.+bel(...), find the
relevant rule, verify the condition part and then put the rule in
execution.
3
Executes all the actions of the selected rule and then go to 1.
4
Go to 1.
Execution is strictly synchronous!
11. Integrating Cloud Services in Behaviour Programming for Autonomous Robots
PROFETA
Execution Semantics
PROFETA and the Cloud
A simple robot which responds to voice commands by using TTS
and STT Cloud services (e.g. Google API).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
...
class utterance ( Belief ): pass
class move_to ( Action ):
def execute ( self ):
x = self [0]
y = self [1]
# ... perform movement to x , y
class hear ( Sensor ):
def sense ( self ):
command = # sample audio data and invoke STT clould service
return + utterance ( command )
class say ( Action ):
def execute ( self ):
phrase = self [0]
# invoke the TTS could service with " phrase "
+ utterance ( " go " )
>> [ say ( " ok , i ’m going " ) , move_to ( " X " , " Y " ) ]
12. Integrating Cloud Services in Behaviour Programming for Autonomous Robots
PROFETA
Execution Semantics
Synchronous Execution
The synchronous execution is a desired PROFETA feature,
but it could cause some problems.
Sensors are polled in sequence only if there are no actions to
be executed
If actions/sensors are “slow” an agent/robot is blind, w.r.t.
events which could happen in the environment
Action/Sensor dynamics/duration matters!!
Action/Sensor for cloud services are potentially “slow”.
13. Integrating Cloud Services in Behaviour Programming for Autonomous Robots
CLEPTA
Architecture
Introducing CLEPTA
To solve the problem a decoupling layer is needed.
The layer has to introduce the needed asynchrony in cloud
service invocation.
CLEPTA (CLoud Extension for ProfeTA) provides a
different domain for the asynchronous execution of Sensors
and Actions.
14. Integrating Cloud Services in Behaviour Programming for Autonomous Robots
CLEPTA
Architecture
Introducing CLEPTA
ServiceInvokers: Entities—subclass of Service—performing
the concrete invocation of cloud services.
PROFETA/CLEPTA Interface: Layer which, using special
kind of Actions and Sensors, connects the ServiceInvokers
with the PROFETA domain.
15. Integrating Cloud Services in Behaviour Programming for Autonomous Robots
CLEPTA
ASync Sensors and Actions
Sensors in CLEPTA
A PROFETA Sensor is decoupled by wrapping it with a
AsyncSensorProxy provided by CLEPTA.
The AsyncSensorProxy:
Creates a new thread in which the real Sensor executes.
Manages a queue to store the beliefs generated by the
Sensors (w/ configurable length).
It is seens by PROFETA as a classical Sensor.
16. Integrating Cloud Services in Behaviour Programming for Autonomous Robots
CLEPTA
ASync Sensors and Actions
Actions in CLEPTA
A PROFETA Action is decoupled by creating it as a subclass of
AsyncAction (provided by CLEPTA).
Asynchronous execution of the cloud service invocation is handled
by an AsyncActionExecutor, it:
Creates a new thread in which the Invoker executes.
Manages a method queue to store the IDs of methods to be
called asynchronously.
17. Integrating Cloud Services in Behaviour Programming for Autonomous Robots
CLEPTA
A Simple Case-Study
PROFETA + CLEPTA and the Cloud
A simple robot which responds to voice commands by using TTS and
STT Cloud services (e.g. Google API).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
...
class utterance ( Belief ): pass
class say ( AsyncAction ):
def create_service ( self , lang = ’ en ’ ):
return G o og l eT ex t To S pe ec h ( lang ) # provided by CLEPTA
def execute ( self ):
utterance = self [0]
self . async_invoke ( self . get_service (). say , [ utterance ])
class hear ( Sensor ):
def sense ( self ):
command = # sample audio data and invoke STT clould service
return + utterance ( command )
...
PROFETA . add_sensor ( AsyncSensorProxy ( hear ()))
+ utterance ( " go " ) >> [ say ( " ok , i ’m going " ) , .... ]
+ utterance ( " _ " ) >> [ say ( " could you repeat please ? " ) ]
18. Integrating Cloud Services in Behaviour Programming for Autonomous Robots
Conclusions
Conclusions
PROFETA allows to define robot strategies in a flexible and
intuitive way, by using the principles of the BDI model.
PROFETA combines the advantages of both imperative and
declarative approach, while offering an all-in-one environment.
CLEPTA adds the ability to exploit, in robot’s behaviour,
external services provided “in the cloud”.
PROFETA+CLEPA have been successfully applied in various
robots built at ARSLab, thus proving the effectiveness of the
tool:
Voice-driven robots
Complex image analysis (e.g. target recognition)
19. Integrating Cloud Services in Behaviour Programming for Autonomous Robots
Conclusions
References
http://github.com/corradosantoro/profeta
L. Fichera, D. Marletta, V. Nicosia, C. Santoro. Flexible Robot Strategy
Design using Belief-Desire-Intention Model. In Proc. of International
Conference on Research and Education in Robotics (EUROBOT 2010),
Spriger CCIS Series, Rappreswille, Swizerland), May 27-30, 2010.
L. Fichera, D. Marletta, V. Nicosia, C. Santoro. A Methodology to
Extend Imperative Languages with AgentSpeak Declarative Constructs.
In Proc. of Workshop on Objects and Agents (WOA2010), CEUR-WS
Publisher, ISSN 1613-0073, Rimini, Italy, Sept. 5-7, 2010.
G. Fortino, W. Russo, C. Santoro. Translating Statecharts-based into BDI
Agents: The DSC/PROFETA case. MAS&S Workshop @ MATES 2013.
F. Messina, G. Pappalardo, C. Santoro. Integrating Cloud Services in
Behaviour Programming for Autonomous Robots. CSmart-CPS
Workshop, LNCS, 2013.
20. Integrating Cloud Services in Behaviour Programming for Autonomous Robots
Conclusions
Integrating Cloud Services in Behaviour
Programming for Autonomous Robots
Fabrizio Messina, Giuseppe Pappalardo, Corrado Santoro
ARSLAB - Autonomous and Robotic Systems Laboratory
Dipartimento di Matematica e Informatica
Universit` di Catania, Italy
a
{messina, pappalardo, santoro}@dmi.unict.it
C-SmartCPS @ ICA3PP 2013 - Vietri sul Mare, 20 Dicembre 2013