IEEE Robotics & Automation Magazine - September 2018 - 52

Playful Scripting Language
Conditional Activation
In the previous section, we already presented a reactive programming statement: a is called a node and e an evaluation.
In Playful, evaluations are arbitrary functions programmed
using the Python scripting language.
Online Prioritization
Statements may be prioritized as follows:
a1 whenever e1
a2 whenever e2

When both e1 and e2 evaluate to true, this program commands a1 and a2 to be simultaneously activated. If a1 and a2
control the same resource (e.g., the same robotic joint), they
may conflict. The keyword priority of can be used to
specify which node has prioritized access to the resource.
a1 whenever e1, priority of f1
a2 whenever e2, priority of f2

If f1 evaluates to a number higher than f2, a1 is activated
and a2 is inactivated. In case a1 and a2 do not compete for
access to the same resource, the priority of keyword has
no effect.
State Machine
Playful supports state machines. For example,
a1 switch to a2 if e1
a2 switch to a1 if e2

Nodes a1 and a2 may never activate simultaneously, and
they will alternatively activate depending on the runtime
evaluation of e1 and e2. At startup, if e1 evaluates to true,
a 1 will activate. Using state machines in Playful scripts
allows the platform to deviate from a purely reactive programming paradigm, as the order statement of the script is
of importance.
Behavior Tree
A node can be declared as a list of nodes, themselves associated with evaluations. For example,
a1 whenever e1
a1:
a1a whenever e1a, priority of f1a
a1b whenever e1b, priority of f1b

This defines a tree in which a1 is a node, and a1a and a1b
its child nodes. Nodes a1a and a1b may be leaf nodes, or they
may be declared a list of nodes, resulting in behavior trees of
arbitrary depth. Leaf nodes are instances of user-developed
Python objects. The code they encapsulate may use the API
52

*

IEEE ROBOTICS & AUTOMATION MAGAZINE

*

september 2018

provided by the robotic middleware to receive sensor data or
send control commands.
Configuration
Some nodes and some evaluations may be configurable. Configuration values can be provided:
a whenever e | key = value

If the code encapsulated by a and/or e accepts key as an
argument, it will be configured accordingly.
Targeting
The keyword targeting is a multifaceted term that
simultaneously commands the creation of new branches at
runtime and enables continuous configuration of the created branches. Through targeting, developers can attach
branches to a type of perception. For example, setting a look
node to target objects of ball type will set the robot to look at
detected balls. A new branch will be created for each detected ball. Each new branch will continuously reconfigure itself
during runtime, according to the changing properties of the
associated ball.
The targeting system relies on Playful's shared memory.
This memory supports data exchange via the pull/push paradigm: code encapsulated by leaf nodes may push or pull
schemes to or from the memory. Schemes are instances of
arbitrary objects consisting of a set of properties. When a
scheme is pushed to the memory for the first time, the memory attributes a key to it. The Python API provides a pull
function. The code encapsulated in nodes can pass this memory key to this function to extract from the memory the information encapsulated by the scheme. The targeting
keyword is used to relate a tree branch to a specific memory
key, as in
a1 |out = s
targeting s: a2 whenever e2, priority
of f2

During runtime, node a1 pushes schemes of type s to the
memory. When a new memory key related to a scheme of
type s is created, targeting commands
● the creation of a new instance of a2 and its related evaluations; if a2 is declared as a list of child nodes, these are also
instantiated, creating a full tree branch
● that the memory key is passed as an implicit argument to
all nodes and evaluations of the newly created branch.
Schemes may also be deleted from the memory, and the
Playful Python API provides a function for doing so. In
such a case, the branches relating to the memory key of the
deleted scheme are removed from the tree. By default, the
Playful engine never deletes schemes, even when the corresponding objects are not currently perceived, as it allows
the system to act on objects that are not currently in the
field of vision.



IEEE Robotics & Automation Magazine - September 2018

Table of Contents for the Digital Edition of IEEE Robotics & Automation Magazine - September 2018

Contents
IEEE Robotics & Automation Magazine - September 2018 - Cover1
IEEE Robotics & Automation Magazine - September 2018 - Cover2
IEEE Robotics & Automation Magazine - September 2018 - Contents
IEEE Robotics & Automation Magazine - September 2018 - 2
IEEE Robotics & Automation Magazine - September 2018 - 3
IEEE Robotics & Automation Magazine - September 2018 - 4
IEEE Robotics & Automation Magazine - September 2018 - 5
IEEE Robotics & Automation Magazine - September 2018 - 6
IEEE Robotics & Automation Magazine - September 2018 - 7
IEEE Robotics & Automation Magazine - September 2018 - 8
IEEE Robotics & Automation Magazine - September 2018 - 9
IEEE Robotics & Automation Magazine - September 2018 - 10
IEEE Robotics & Automation Magazine - September 2018 - 11
IEEE Robotics & Automation Magazine - September 2018 - 12
IEEE Robotics & Automation Magazine - September 2018 - 13
IEEE Robotics & Automation Magazine - September 2018 - 14
IEEE Robotics & Automation Magazine - September 2018 - 15
IEEE Robotics & Automation Magazine - September 2018 - 16
IEEE Robotics & Automation Magazine - September 2018 - 17
IEEE Robotics & Automation Magazine - September 2018 - 18
IEEE Robotics & Automation Magazine - September 2018 - 19
IEEE Robotics & Automation Magazine - September 2018 - 20
IEEE Robotics & Automation Magazine - September 2018 - 21
IEEE Robotics & Automation Magazine - September 2018 - 22
IEEE Robotics & Automation Magazine - September 2018 - 23
IEEE Robotics & Automation Magazine - September 2018 - 24
IEEE Robotics & Automation Magazine - September 2018 - 25
IEEE Robotics & Automation Magazine - September 2018 - 26
IEEE Robotics & Automation Magazine - September 2018 - 27
IEEE Robotics & Automation Magazine - September 2018 - 28
IEEE Robotics & Automation Magazine - September 2018 - 29
IEEE Robotics & Automation Magazine - September 2018 - 30
IEEE Robotics & Automation Magazine - September 2018 - 31
IEEE Robotics & Automation Magazine - September 2018 - 32
IEEE Robotics & Automation Magazine - September 2018 - 33
IEEE Robotics & Automation Magazine - September 2018 - 34
IEEE Robotics & Automation Magazine - September 2018 - 35
IEEE Robotics & Automation Magazine - September 2018 - 36
IEEE Robotics & Automation Magazine - September 2018 - 37
IEEE Robotics & Automation Magazine - September 2018 - 38
IEEE Robotics & Automation Magazine - September 2018 - 39
IEEE Robotics & Automation Magazine - September 2018 - 40
IEEE Robotics & Automation Magazine - September 2018 - 41
IEEE Robotics & Automation Magazine - September 2018 - 42
IEEE Robotics & Automation Magazine - September 2018 - 43
IEEE Robotics & Automation Magazine - September 2018 - 44
IEEE Robotics & Automation Magazine - September 2018 - 45
IEEE Robotics & Automation Magazine - September 2018 - 46
IEEE Robotics & Automation Magazine - September 2018 - 47
IEEE Robotics & Automation Magazine - September 2018 - 48
IEEE Robotics & Automation Magazine - September 2018 - 49
IEEE Robotics & Automation Magazine - September 2018 - 50
IEEE Robotics & Automation Magazine - September 2018 - 51
IEEE Robotics & Automation Magazine - September 2018 - 52
IEEE Robotics & Automation Magazine - September 2018 - 53
IEEE Robotics & Automation Magazine - September 2018 - 54
IEEE Robotics & Automation Magazine - September 2018 - 55
IEEE Robotics & Automation Magazine - September 2018 - 56
IEEE Robotics & Automation Magazine - September 2018 - 57
IEEE Robotics & Automation Magazine - September 2018 - 58
IEEE Robotics & Automation Magazine - September 2018 - 59
IEEE Robotics & Automation Magazine - September 2018 - 60
IEEE Robotics & Automation Magazine - September 2018 - 61
IEEE Robotics & Automation Magazine - September 2018 - 62
IEEE Robotics & Automation Magazine - September 2018 - 63
IEEE Robotics & Automation Magazine - September 2018 - 64
IEEE Robotics & Automation Magazine - September 2018 - 65
IEEE Robotics & Automation Magazine - September 2018 - 66
IEEE Robotics & Automation Magazine - September 2018 - 67
IEEE Robotics & Automation Magazine - September 2018 - 68
IEEE Robotics & Automation Magazine - September 2018 - 69
IEEE Robotics & Automation Magazine - September 2018 - 70
IEEE Robotics & Automation Magazine - September 2018 - 71
IEEE Robotics & Automation Magazine - September 2018 - 72
IEEE Robotics & Automation Magazine - September 2018 - 73
IEEE Robotics & Automation Magazine - September 2018 - 74
IEEE Robotics & Automation Magazine - September 2018 - 75
IEEE Robotics & Automation Magazine - September 2018 - 76
IEEE Robotics & Automation Magazine - September 2018 - 77
IEEE Robotics & Automation Magazine - September 2018 - 78
IEEE Robotics & Automation Magazine - September 2018 - 79
IEEE Robotics & Automation Magazine - September 2018 - 80
IEEE Robotics & Automation Magazine - September 2018 - 81
IEEE Robotics & Automation Magazine - September 2018 - 82
IEEE Robotics & Automation Magazine - September 2018 - 83
IEEE Robotics & Automation Magazine - September 2018 - 84
IEEE Robotics & Automation Magazine - September 2018 - 85
IEEE Robotics & Automation Magazine - September 2018 - 86
IEEE Robotics & Automation Magazine - September 2018 - 87
IEEE Robotics & Automation Magazine - September 2018 - 88
IEEE Robotics & Automation Magazine - September 2018 - 89
IEEE Robotics & Automation Magazine - September 2018 - 90
IEEE Robotics & Automation Magazine - September 2018 - 91
IEEE Robotics & Automation Magazine - September 2018 - 92
IEEE Robotics & Automation Magazine - September 2018 - 93
IEEE Robotics & Automation Magazine - September 2018 - 94
IEEE Robotics & Automation Magazine - September 2018 - 95
IEEE Robotics & Automation Magazine - September 2018 - 96
IEEE Robotics & Automation Magazine - September 2018 - 97
IEEE Robotics & Automation Magazine - September 2018 - 98
IEEE Robotics & Automation Magazine - September 2018 - 99
IEEE Robotics & Automation Magazine - September 2018 - 100
IEEE Robotics & Automation Magazine - September 2018 - 101
IEEE Robotics & Automation Magazine - September 2018 - 102
IEEE Robotics & Automation Magazine - September 2018 - 103
IEEE Robotics & Automation Magazine - September 2018 - 104
IEEE Robotics & Automation Magazine - September 2018 - 105
IEEE Robotics & Automation Magazine - September 2018 - 106
IEEE Robotics & Automation Magazine - September 2018 - 107
IEEE Robotics & Automation Magazine - September 2018 - 108
IEEE Robotics & Automation Magazine - September 2018 - 109
IEEE Robotics & Automation Magazine - September 2018 - 110
IEEE Robotics & Automation Magazine - September 2018 - 111
IEEE Robotics & Automation Magazine - September 2018 - 112
IEEE Robotics & Automation Magazine - September 2018 - 113
IEEE Robotics & Automation Magazine - September 2018 - 114
IEEE Robotics & Automation Magazine - September 2018 - 115
IEEE Robotics & Automation Magazine - September 2018 - 116
IEEE Robotics & Automation Magazine - September 2018 - Cover3
IEEE Robotics & Automation Magazine - September 2018 - Cover4
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2023
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2023
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2023
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2023
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2022
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2022
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2022
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2022
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2021
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2021
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2021
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2021
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2020
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2020
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2020
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2020
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2019
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2019
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2019
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2019
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2018
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2018
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2018
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2018
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2017
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2017
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2017
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2017
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2016
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2016
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2016
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2016
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2015
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2015
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2015
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2015
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2014
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2014
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2014
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2014
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2013
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2013
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2013
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2013
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2012
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2012
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2012
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2012
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2011
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2011
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2011
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2011
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2010
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2010
https://www.nxtbookmedia.com