선정목록으로
Intelligent Agent-Based Stimulation for Testing Robotic Software in Human-Robot Interactions
수소연료전지 · (5) 연료전지용 수분제어장치(가습기)
기본 정보
- 저자
- DOI
- 10.48550/arxiv.1604.05508
- 저널
- arXiv (Cornell University)
- 발행년도
- 2022
- 발행기관
- Cornell University
- 피인용수
- 0
- 라이선스
- 0
- 논문 유형
- –
- 언어
- –
- 원문 페이지
- https://doi.org/10.48550/arxiv.1604.05508
- 토픽
- Analytical Chemistry and Sensors
- OpenAlex ID
- W6929339294
평가 내용
- 관련도
- 사업분야
- 수소연료전지 · (5) 연료전지용 수분제어장치(가습기)
- 부 분야
- –
- R&D 측면
- –
- 확신도
- –
- 근거 용어
- –
- 판단 근거
- 임베딩 유사도 기반 평가로 '수소연료전지 > 연료전지용 수분제어장치(가습기)' 분야에 선정된 논문입니다.
- R&D 활용 포인트
- –
- 평가 입력
- –
초록
The challenges of robotic software testing extend beyond conventional software testing. Valid, realistic and interesting tests need to be generated for multiple programs and hardware running concurrently, deployed into dynamic environments with people. We investigate the use of Belief-Desire-Intention (BDI) agents as models for test generation, in the domain of human-robot interaction (HRI) in simulations. These models provide rational agency, causality, and a reasoning mechanism for planning, which emulate both intelligent and adaptive robots, as well as smart testing environments directed by humans. We introduce reinforcement learning (RL) to automate the exploration of the BDI models using a reward function based on coverage feedback. Our approach is evaluated using a collaborative manufacture example, where the robotic software under test is stimulated indirectly via a simulated human co-worker. We conclude that BDI agents provide intuitive models for test generation in the HRI domain. Our results demonstrate that RL can fully automate BDI model exploration, leading to very effective coverage-directed test generation.
본문 46,067자
본문 펼치기
## Intelligent Agent-Based Stimulation for Testing Robotic Software in Human-Robot Interactions
Dejanira Araiza-Illan <sup>_∗_</sup>, Anthony G. Pipe <sup>_†_</sup> and Kerstin Eder <sup>_‡_</sup>
Abstract
The challenges of robotic software testing extend beyond conventional
software testing. Valid, realistic and interesting tests need to be generated for multiple programs and hardware running concurrently, deployed
into dynamic environments with people. We investigate the use of BeliefDesire-Intention (BDI) agents as models for test generation, in the domain
of human-robot interaction (HRI) in simulations. These models provide
rational agency, causality, and a reasoning mechanism for planning, which
emulate both intelligent and adaptive robots, as well as smart testing environments directed by humans. We introduce reinforcement learning (RL)
to automate the exploration of the BDI models using a reward function
based on coverage feedback. Our approach is evaluated using a collaborative manufacture example, where the robotic software under test is
stimulated indirectly via a simulated human co-worker. We conclude that
BDI agents provide intuitive models for test generation in the HRI domain. Our results demonstrate that RL can fully automate BDI model
exploration, leading to very effective coverage-directed test generation.
### 1 Introduction
Software for autonomous robotic assistants interacts concurrently with physical
devices (sensors and actuators) and environments comprising people, different
types of terrain, and other robots. Demonstrating that autonomous robotic
assistants are ultimately fit for purpose in the real world will open the doors for
their acceptance in our society [10].
Testing robotic software in simulation offers the possibility of reducing costly
and time consuming lab experiments, to make sure that the code meets safety
and functional requirements. In addition, testing in simulation provides a degree
of realism and detail that is difficult to retain when abstracting models for formal
verification.
The fundamental challenge of testing robotic software is in producing realistic and interesting tests, considering that the software interacts with a complex,
changing, and hard to predict environment, through sensors and actuators, that
_∗_ Department of Computer Science and Bristol Robotics Laboratory, University of Bristol,
Bristol, UK. Email: [dejanira.araizaillan@bristol.ac.uk.](mailto:dejanira.araizaillan@bristol.ac.uk)
_†_ Faculty of Engineering Technology and Bristol Robotics Laboratory, University of the
West of England, Bristol, UK. Email: [tony.pipe@brl.ac.uk.](mailto:tony.pipe@brl.ac.uk)
_‡_ Department of Computer Science and Bristol Robotics Laboratory, University of Bristol,
Bristol, UK. Email: [kerstin.eder@bristol.ac.uk.](mailto:kerstin.eder)
1
influence its execution. Realistic and meaningful testing of robotic software
means producing data inputs that are valid, whilst also emulating the interactions with the real life system, e.g. in terms of timing, order, and causality.
These tests would also need to explore (cover) the software as much as possible,
along with scenarios from combinations of the software and its environment [1].
A simple method to generate tests is by randomly (pseudorandomly in practice to ensure repeatability) exploring the state space of inputs or event sequences for abstract tests. Intelligent sampling via carefully chosen probability
distributions can be implemented to maximize coverage and fault detection [12].
Constraints are introduced to bias test generation towards reaching more coverage faster [16, 19]. Model-based approaches explore requirement or test models
to achieve biasing automatically and systematically, e.g. with model checking
guided by temporal logic properties representing realistic use cases [2, 3]. Constructing models and exploring them automatically reduces the need to write
constraints by hand.
In previous work [2], we proposed the use of coverage-driven verification
testbenches for real robotic software in the context of human-robot interaction (HRI). Integrating comprehensive testing capabilities into popular robotics
software development frameworks increases quality and compliance assurance
at design time, and thus brings developers closer to achieve demonstrably safe
robots. We implemented these testbenches in the Robot Operating System <sup>1</sup>
(ROS) framework, and the Gazebo <sup>2</sup> 3-D physics simulator, via the following
components: a driver, self-checkers (assertion monitors executed in parallel
with the robot’s code), a coverage collector (based on code, assertion and crossproduct coverage models), and a test generator [2, 3]. The test generation
process makes use of pseudorandom, constrained, and model-based methods to
produce abstract tests (sequences or programs), subsequently “concretized” by
valid parameter instantiation. Examples of the testbenches in ROS-Gazebo are
available online. <sup>3</sup>
Our previous model-based test generation techniques were based on model
checking probabilistic timed automata (PTA) with respect to reachability temporal logic properties [2, 3]. Although these have been very effective in guiding
test generation to achieve high levels of coverage, both, the PTA models, often
at very high abstraction levels, as well as suitable properties are required, which
limits the approach in practice. This motivated us to search for different models; models that more closely match the behaviour of the actual code, models
that are intuitive and that reflect the autonomy and agency present in the HRI
domain.
The BDI agent architecture, proposed by the philosopher Michael Bratman
to model human reasoning, offers exactly that. Using BDI, an agent’s view
of the world, including its environment, other agents and itself, is captured in
‘beliefs’. BDI agents can activate plans (‘intentions’), guarded by their beliefs
to achieve goals (‘desires’) [6]. BDI multi agent systems can be implemented
through different frameworks, including Jason <sup>4</sup> in the AgentSpeak language. For
each agent and in a continuous loop, plans are selected (added to the intentions)
and executed in response to ‘events’ such as the creation of beliefs or goals, by
1http://www.ros.org/
2http://gazebosim.org/
3https://github.com/robosafe
4http://jason.sourceforge.net/wp/
2
other agents or internally. BDI agents provide a reasoning mechanism, agency,
rationality and causality. We stipulate that they can be used to model the
interactions between robots and humans in a realistic manner, and that these
models can be exploited for test generation. Our BDI agents become active
components in the verification process; _verification_ _agents_ that are controlled
through their beliefs, desires and intentions.
The overall hypothesis of this paper is centred on the usefulness of BDI
agents for model-based test generation for the purpose of testing code of robotic
assistants in HRI, giving rise to the following research questions:
Q1 . Are Belief-Desire-Intention agents suitable to model the interactions be
tween robots and other entities in HRI scenarios?
Q2 . How can we generate effective tests from BDI models, i.e. how can we
control BDI models to ensure they are being fully explored?
Q3 . Machine learning techniques, e.g. reinforcement learning (RL) [25, 15],
have been shown to increase the optimality of test suites automatically.
Can we automate BDI model-based test generation through machine learning using coverage feedback?
In this paper we use a human-robot cooperative table assembly task as a
case study. We demonstrate how BDI models can be developed for the code
under test, relevant sensors and the human co-worker, all represented as BDI
agents. We then generate interactive tests from the resulting multi agent system. These tests naturally incorporate the agency present in the environment of
the robotic code under test, in particular the rationality and decision making of
the simulated human. To explore the BDI model, we propose to manipulate the
beliefs of the verification agents. This provides an intuitive method to direct test
generation, and we compared different belief manipulation techniques, including manual and coverage-directed, to determine their feasibility, benefits and
drawbacks. We implemented an RL algorithm, Q-learning, with a reward function on agent coverage (covered plans). This allowed us to generate tests that
reach high percentages of code coverage fully automatically, much like existing
machine-learning based coverage-directed test generation techniques [14].
Our results demonstrate that BDI agents are effective models for test generation, delivering realistic stimulation of robotic code in simulation. We also
show that adding machine learning with coverage feedback produces an effective
and varied test suite in a fully automated manner, with tests that show greater
diversity compared to tests obtained using manual or pseudorandom exploration
of the BDI model.
### 2 Related Work
Both runtime errors and functional temporal logic properties of code have been
verified through model checking and automatic theorem proving. Nonetheless,
tools are available only for (subsets of) languages such as C (e.g., CBMC <sup>5</sup> ),
or Ada SPARK (e.g., GNATprove <sup>6</sup> ), which do not suit Python code or other
popular robotic frameworks such as ROS.
5http://www.cprover.org/cbmc/
6http://www.open-do.org/projects/hi-lite/gnatprove/
3
Different kinds of models have been employed to represent robotic software in model-based test generation, including Markov chains [20], UML class
diagrams [26, 22], finite-state machines [4], model programs [11], hybrid automata [24], and coloured Petri Nets [18]. None of these models represent causal
reasoning and planning, as BDI agents do.
As far as we can tell, this is the first work proposing the use of BDI agents
for model-based test generation. Other types of verification agents (programs
that plan what to do next) have been used for test generation before, e.g., in [13]
to traverse UML scenario models and branch models of the code; in [21] to test
other agents traversing models of data and an UML testing goal model.
Machine learning methods, such as RL, have been employed to aid modelbased test generation. For example, a model program (rules) was explored with
RL to compute optimal test-trace graphs in [25], which helped to gain more code
coverage compared to random exploration by pruning the search space. Ant
colonies and RL have been combined to find and learn good event sequences to
test graphical user interfaces (GUIs) [8]. In this paper, we explored the use of
RL to increase the level of automation in the test generation process. By using
RL to learn which (abstract) tests increase the coverage of a BDI model, we can
identify the tests most likely to increase code coverage when executed on the
code under test. This is a new variant of learning-based coverage-directed test
generation [14].
### 3 Case Study
3.1 Cooperative Table Manufacture
To assemble a table in a cooperative manner, a person requests legs through
voice commands, and a humanoid torso with arms (BERT2 [17]) hands them
over if it has decided the person is ready to receive them. Four legs must be
handed over to complete one table.
The robot decides if a human is ready to take a leg through the combination
of three sensors ( _g, p, l_ ) _∈_ _G × P_ _× L_ : a “gaze” sensor that tracks whether the
human head is looking at the leg; a “pressure” sensor that detects a change in
the position of the robot’s hand fingers indicating that the human is pulling
on the leg; and a “location” sensor that tracks whether the human hand is on
the leg. Each sensor reading is classified into _G_ = _P_ = _L_ = _{_ <sup>¯</sup> 1 _,_ 1 _}_, where 1
indicates the human is ready, and <sup>¯</sup> 1 represents any other sensor reading. If the
human is deemed ready, _GPL_ = (1 _,_ 1 _,_ 1), the robot should decide to release
the leg. Otherwise, the robot should not release the leg and discard it (send
back to a re-supply cycle). The sensor readings can be erroneous when the legs
wobble in the robot’s hand (pressure error), or when occlusions occur (location
and gaze errors). Only if the robot decides the human is ready to hold the leg,
_GPL_ = (1 _,_ 1 _,_ 1), the robot should release the leg. The robot is programmed
to time out while waiting for either a voice command from the human, or the
sensor readings, according to specified time thresholds, to avoid livelocks. This
workflow is illustrated in Fig. 1.
The robotic software for the assembly task consists of a ROS ‘node’ in Python
with 264 statements. This code reads the output from the sensors, calls a third
4
Figure 1: Cooperative table manufacture task workflow
party kinematic trajectory planner (MoveIt! <sup>7</sup> ) to get a leg from a fixed location
and then hold it in front of the human also in a fixed location, and finally decides
whether to release the leg or not. The code was structured into a finite-state
machine (FSM), via SMACH modules [7], to facilitate its modelling into BDI
agents.
We chose to verify a representative set of requirements for this collaborative
task, adapted from [2], as follows:
R1. If the gaze, pressure and location sense the human is ready, then a leg
shall be released.
R2. If the gaze, pressure or location sense the human is not ready, then a leg
shall not be released.
R3. The robot shall not close its hand when the human hand is too close,
according to the safety standard ISO 13482:2014 (robotic assistants).
R4. The robot shall start and work in restricted joint speed (less than 0.25
rad/s, ISO 10218-1:2011 for collaborative industrial robots, Section 3.23),
to prevent dangerous unintended contacts (ISO 13482:2014, Section 3.19.4).
7http://moveit.ros.org/
5
Figure 2: Testbench in ROS-Gazebo comprising: two-tiered test generator (yellow), driver (blue), self-checker (green), coverage collector (orange), code under
test (white), other software and the simulator (gray). Semi-automated feedback
loop to increase coverage in dashed lines.
3.2 Simulator Components
The ROS-Gazebo simulator, available online <sup>8</sup>, comprises:
_•_ The robot’s control code, instrumented with code coverage metrics, via
the ‘coverage’ module <sup>9</sup>, which produce detailed reports in html format.
_•_ A Python module (also a ROS ‘node’ structured as an FSM) enacting the
human in the simulator, according to the tests, to stimulate the robotic
software.
_•_ Gazebo physical models of the robot, human head and hand, and table
legs, to simulate motion actions in “real-time” according to the robot’s
control code, and the actions of the simulated human.
_•_ Sensor models for “gaze”, “pressure”, “location”, and voice recognition,
implemented as Python ROS ‘nodes’.
_•_ A driver to distribute test sequences to the corresponding simulation components, i.e. routing the sensor inputs and inputs for the human simulation
component.
_•_ Assertion monitors for requirements R1 to R4. These were formalized
as temporal logic properties, translated into FSMs [2] and implemented
as Python modules (using individual ROS ‘nodes’) that run parallel to
the robotic software. The monitors produce reports of their coverage (assertion coverage), i.e. the number of times they have been triggered per
simulation run.
_•_ Coverage collection for the code and assertion results on each simulation
run, through automated scripts.
_•_ A two-tiered test generator; the first stage employs model-based techniques to produce abstract tests and the second stage concretizes these,
e.g. by assigning actual values to parameters, including timing.
Figure 2 shows the testbench components in ROS-Gazebo.
8https://github.com/robosafe/table
9http://coverage.readthedocs.org/en/coverage-4.1b2/
6
`tell` `leg` Human voice A1 for 5s
`receivesignal` Human waits for max. 60s
`tell` `humanReady` Human voice A2 for 2s
`set_param` `gaze=1` Move head from: offset [0 _._ 1 _,_ 0 _._ 2],
distance [0 _._ 5 _,_ 0 _._ 6], angle [15 _,_ 40)
Figure 3: An abstract test sequence for the human to stimulate the robot’s code
(LHS), and its concretization: sampling from defined ranges (RHS).
### 4 Model-Based Test Generation with BDI Agents
4.1 Foundations
Robotic software is expected to process data inputs of different types at the same
time or asynchronously, coming from sensors, actuator feedback, and different
pieces of code running concurrently. In response, data output is produced,
e.g. to control actuators and communication interfaces. The test environment
must react to this output in an appropriate manner in order to stimulate the
robotic software it interacts with. The orchestration of such complex, reactive
data generation and timely driving of stimulus is significantly more demanding
than generating timings for a single stream of data [19], or simple controller
inputs [16].
To simplify test generation, we proposed a two-tiered approach [2, 3]. First,
sequences of ‘actions’ are generated from traversing high-level models, producing
abstract tests that define order and causality, thus indicating which input channels need to be stimulated with which data when. Typically, these models are
highly abstract to manage model complexity and the computational complexity
involved in model traversal. Then, concrete data, i.e. parameter instantiation,
and timing are chosen for each element in the sequence, using search-based or
random approaches as in [12]. These are constrained to remain within valid
data and timing ranges. The resulting tests aim to stimulate simulated entities such as humans. Their actions stimulate sensors and actuators within the
simulation, which in turn will stimulate the robotic code under test.
An example of an abstract-concrete test for the table assembly task is shown
in Fig. 3, adapted from [2, 3]. Figure 2 shows the two-tiered test generation process. The test generator is connected via a driver to the simulated entities that
act within the robot’s environment. These stimulate the software under test,
e.g. the control code in the table assembly task, and other testbench components
in ROS-Gazebo. Further details on this setup are contained in [3].
Our research seeks to establish whether BDI agents are suitable abstract
models for the first stage of model-based test generation in Fig. 2.
4.2 BDI-based Test Generation
BDI models need to be constructed for the software under test and all other components of the simulation that interact with the real robot in a task. The code
is modelled as a BDI agent, capturing the high-level decision making present
in software for autonomous robots; see [9] for a recent example. To facilitate
modelling, it is useful that the robotic software under test is encoded as an
7
1 `//Initial` `beliefs`
2 `//Initial` `goals`
3 `!reset.`
4 `//Plans`
5 `+!reset` `:` `true` `<-` `add_time(20);.print("Robot` `is` `resetting");`
6 `!waiting.`
7 `+!waiting` `:` `not` `leg` `<-` `.print("Waiting");` `!waiting.`
8 `+!waiting` `:` `leg` `<-` `add_time(40);.print("You` `asked` `for` `leg");`
9 `-leg[source(human)];` `!grabLeg.`
10 `...`
Figure 4: Extract of the BDI agent modelling the robotic software under test
in the AgentSpeak language for the Jason framework
FSM, e.g. using the SMACH module for Python, or an equivalent library in
C++. The FSM structure provides an abstraction for the code, grouping it into
identifiable blocks, i.e ‘states’.
A variety of interpreters and implementations are available for BDI agents.
In Jason, a framework implemented in Java, multi agent systems are constructed
in AgentSpeak, an agent language with a syntax similar to Prolog [6]. A BDI
agent comprises a set of initial beliefs, a set of initial goals, and a set of plans
guarded by a combination of goals, beliefs, and first-order statements about
these. Consequently, the robot’s code is translated into a set of plans _PR_ . The
plans’ ‘actions’ represent the functionality of the code’s FSM ‘states’, triggered
by a combination of beliefs and goals. Beliefs represent sensor inputs (subscribing to topics or requesting services in ROS) and internal state variables; these
lead to different plans in the BDI agents which cover different paths in the code
under test. After executing a plan, a new goal is created to control which plans
can be activated next, following the same control flow as the code.
An example of a BDI agent modelling the robot’s code for our case study
is shown in Fig. 4. BDI models represent agency through the triggering of sequences of plans that follow an interaction protocol as a consequence of changes
in the beliefs (e.g., from reading sensor outputs) and the introduction of goals.
The sequences of plans are fully traceable by following the goals and beliefs that
activated them. If an agent intends to execute a plan, different events, internal
or external, might cause it to change its intentions.
The human and other components in the simulated HRI environment are
also encoded as BDI agents, with plans _PS_ and a set of beliefs _B_ (of size _|B|_,
the number of beliefs) about the HRI protocol. We will use these to control
the verification agents, to indirectly control the robot’s code agent. To achieve
the overall control of the multi agent system, we introduce a ‘meta’ verification
agent. This agent selects a set of beliefs from _B_ and communicates these to the
human and other simulated agents, to trigger a specific set of plans _p_ _∈_ _PS_ .
Enacting these plans will trigger changes that can be observed by the robot’s
code agent (new beliefs), which will trigger plans and create new goals, leading
the robot towards a path of actions indirectly, _p_ _∈_ _PR_ . Consequently, the
execution of the multi agent system with an initial set of beliefs introduced by
the ‘meta’ agent produces a ‘trace’ in the model, which is formatted into an
abstract test, as shown in the left-hand side of Fig. 3. The total BDI multi
8
Figure 5: BDI multi agent system model for test generation. The ‘meta’ verification agent controls the human and other agents, which control the robot’s code
agent. The belief subsets for each system run are chosen by hand, randomly, or
learned from model coverage feedback.
agent system <sup>10</sup> is depicted in Fig. 5.
An interesting question for the implementation of ‘meta’ verification agents
is, how to choose which beliefs to use from the set _B_, for each run of the multi
agent system. The number of all the different _N_ belief subsets _Bn_ _⊂B_, _n_ =
1 _, . . ., N_, can be quite large even for small sets _B_ . Moreover, not many of
these subsets will produce different and interesting tests. We considered and
compared selecting _N_ <sup>_′_</sup> subsets, so that _N_ <sup>_′_</sup> _≪_ _N_, by _(a)_ choosing subsets that
are likely to produce abstract tests that will cover most of the plans in the
agents by hand based on domain knowledge; _(b)_ selecting subsets randomly
(using a pseudorandom number generator); and _(c)_ using RL with feedback from
measuring coverage of the agent plans to compute coverage-optimal subsets.
These options are illustrated in Fig. 5. Coupling the BDI exploration with
coverage feedback gives rise to coverage-directed test generation [14].
4.3 Reinforcement Learning
RL is an unsupervised machine learning approach; i.e. no training is needed. A
Markov decision process (MDP) is an RL task that satisfies the Markov property,
defined by a probability of reaching each next possible state _s_ <sup>_′_</sup> from any given
state _s_ by taking action _a_,
_Pss_ <sup>_a_</sup> <sup>_′_</sup> <sup>=</sup> <sup>_Pr{st_</sup> <sup>+1</sup> <sup>=</sup> <sup>_s′|st_</sup> <sup>=</sup> <sup>_s, at_</sup> <sup>=</sup> <sup>_a},_</sup> (1)
and an expected value of the next reward,
_R_ <sup>_a_</sup> _ss_ <sup>_′_</sup> <sup>=</sup> <sup>_E{rt_</sup> <sup>+1</sup> <sup>_|st_</sup> <sup>=</sup> <sup>_s, at_</sup> <sup>=</sup> <sup>_a, st_</sup> <sup>+1</sup> <sup>=</sup> <sup>_s′},_</sup> (2)
for a time step _t_ [23].
10Available online: https://github.com/robosafe/bdi-models
9
The value of taking action _a_ in state _s_ is defined as the expected reward
starting from _s_ and taking action _a_, and then following a policy _π_, i.e. a sequence
of actions according to the state of the world, _s_
_−→a_ _s′_ _−→a_ <sup>_′_</sup> _s_ <sup>_′′_</sup> _. . ._,
_Q_ <sup>_π_</sup> ( _s, a_ ) = _Eπ_
- _∞_
_k_ =0
_γ_ <sup>_k_</sup> _rt_ + _k_ +1 _|st_ = _s, at_ = _a_
_,_ (3)
where 0 _< γ_ _≤_ 1 is a discount factor that weights the impact of future rewards.
Over time, the agent learns which actions maximize its discounted future rewards (i.e. an optimal policy _π_ <sup>_∗_</sup> ) [23].
In Q-learning, an RL variant, the values of state-action pairs (the actionvalue function _Q_ ( _s, a_ )) are computed iteratively through the exploration of the
MDP model, until they converge. The ‘best’ state-action pairs (from max _a∈A Q_ ( _s, a_ ))
become a deterministic optimal policy.
In our setup, the actions, _a_, are the selected beliefs, _b_ _∈B_, to be added to
subsets _Bn_, _n_ = 1 _, . . ., N_ <sup>_′_</sup>, and the states, _s_, are the triggered plans, _p ∈_ _PR∪PS_ .
A belief is selected with a probability _Ppp_ <sup>_b_</sup> <sup>_′_</sup> <sup>(from</sup> <sup>Eqn.</sup> <sup>1),</sup> <sup>and</sup> <sup>a</sup> <sup>reward</sup> <sup>_rt_</sup> <sup>+1</sup>
(from Eqn. 2) is obtained according to the level of coverage of agent plans. From
the Q-learning Q-value formulation [23], the action-state value is defined as
_Q_ ( _p, b_ ) = (1 _−_ _α_ ) _Q_ ( _p, b_ ) + _α_ [ _rt_ +1
+ _γ_ max _b′∈B Q_ ( _p_ <sup>_′_</sup> _, b_ <sup>_′_</sup> )] _,_ (4)
with _α_ a learning rate that decreases over time. These Q-values are stored and
updated in a table of size _|B| × |B|_ .
The probability distributions of the next belief choices start as uniform in
the learning process, but get updated as the Q-values change according to a
Boltzmann or soft max distribution,
_<u>e</u>_
_pp_ <sup>_b_</sup> <sup>_′_</sup> <sup>=</sup>
_<u>Q</u>_ <u>(</u> _<u>p,b</u>_ <u>)</u>
_<u>Q</u>_ <u>(</u> _<u>p,b</u>_ <sup>_′_</sup> <u>)</u>
_kT_
_P_ <sup>_b_</sup>
_<u>e</u>_ _kT_
<u>�</u>
_,_ (5)
_b_ <sup>_′_</sup> _∈B_ <sup>_e_</sup>
where _T_ is the ‘temperature’. After several cycles of exploration and learning, the Q-values will converge, i.e. the maximal difference, for any table cell,
between the previous ( _j_ _−_ 1) and current iterations ( _j_ ) will be almost zero.
Consequently, the learning can be stopped and an optimal policy _π_ <sup>_∗_</sup> is computed from the Q-values table. This policy defines the _N_ <sup>_′_</sup> optimal subsets of
beliefs _Bn_, _n_ = 1 _, . . ., N_ <sup>_′_</sup>, in terms of coverage of the agents. Fig. 6 shows the
Q-learning algorithm adapted for BDI-based test generation.
Achieving full automation with RL requires coverage feedback loops. Directed methods, such as specifying belief subsets by hand, or randomly sampling,
might appear simpler to implement. However, achieving meaningful, diverse,
and coverage effective tests calls for considerable manual input to constrain and
guide the exploration. For example, in our case study we have _|B|_ = 38, i.e. 2 <sup>38</sup>
possible belief subsets, where _|B|_ includes requesting 1 to 4 legs from the robot
(4 beliefs); becoming bored or not (2 beliefs); and setting up combinations of
gaze, pressure and location parameters for the 1 to 4 legs (8 _×_ 4 = 32 beliefs).
Most of these belief sets are not effective in exploring the leg handover code,
as the interaction protocol requires particular sequences of actions to be completed within time bounds. In more complex scenarios, manually discovering
10
1: Initialize the _Q_ ( _p, b_ ) table arbitrarily
2: while max _{|Q_ ( _p, b_ ) _j_ _−_ _Q_ ( _p, b_ ) _j−_ 1 _|} <_ 0 _._ 0001 do
3: Choose a belief _b_ according to _P_ <sup>_b_</sup> _pp_ <sup>_′_</sup>
4: Run BDI model and collect coverage
5: Get reward/punishment _rt_ +1 from _R_ <sup>_b_</sup> _pp_ <sup>_′_</sup>
6: Update _Q_ ( _p, b_ ) in table
7: Update probabilities of belief selection _P_ <sup>_b_</sup> _pp_ <sup>_′_</sup>
8: end while
9: Get optimal policy _π_ <sup>_∗_</sup> = _{B_ 1 _⊂B, . . ., BN_ _′_ _⊂B}_ to form the test suite after running the
multi agent system with each subset
Figure 6: Q-learning algorithm adapted for BDI-based test generation
which belief sets are effective may no longer be feasible and a fully automated
systematic process becomes a necessity.
### 5 Experiments and Results
We applied the proposed BDI-based test generation approach to the table assembly simulator in ROS-Gazebo to verify the control code of the robot introduced
in Section 3. Three BDI model exploration methods were evaluated: _(a)_ manual selection of belief subsets, _(b)_ random selection; and _(c)_ RL with coverage
feedback. We used coverage data from the coverage collector (code statements
and assertions) in the testbench in ROS-Gazebo to evaluate the exploration
methods, and we compared these results against pseudorandomly assembling
abstract tests [5].
5.1 Setup
Firstly, we produced 130 abstract tests from specifying _N_ <sup>_′_</sup> = 130 subsets of
beliefs by hand. We expected these belief sets to cover: _(i)_ the request of
4, 3, 2, 1 or no legs per test; _(ii)_ the human getting bored or not; and _(iii)_
_GPL_ = (1 _,_ 1 _,_ 1) or _GPL̸_ = (1 _,_ 1 _,_ 1), all reflected in the produced abstract tests.
We concretized 128 abstract tests into one test each. The remaining two abstract
tests were concretized into five tests each.
Secondly, we produced _N_ <sup>_′_</sup> = 100 subsets of beliefs, from dividing the possible
38 beliefs into six groups to target _(i–iii)_, and then sampling beliefs through
a pseudorandom number generator. This process produced 100 abstract tests,
concretized into one test each.
Thirdly, we used RL, which, in approximately 300 iterations (3 hours),
reached convergence of the Q-values. We then allowed it to run for a further
700 iterations (a total of 9 hours) to demonstrate the convergence, as shown in
Fig. 7. The RL-based exploration of belief sets was constrained to start with
the selection of 1 to 4 legs. Coverage was collected for the rewards, considering
48 plans in the ‘human’ agent, and 12 in the ‘robot-code’ agent. A fixed rate
_γ_ = 0 _._ 1 was employed, along with a decreasing rate _α_ = 0 _._ 1(0 _._ 9) <sup>_j_</sup>, on each
iteration _j_ . The rewards consisted of +100 for maximum measured coverage,
and +5 or +1 for nearly maximum measured coverage, for each agent (‘human’
and ‘robot-code’, respectively). Punishments of -100 were applied when good
coverage was not achieved. A _kT_ = 10 was applied to the Boltzmann probability distributions. We extracted the best and second best belief subsets as
11
40
30
20
10
0
0 200 400 600 800 1000
Iterations (j)
Figure 7: Computed max _{|Q_ ( _p, b_ ) _j_ _−_ _Q_ ( _p, b_ ) _j−_ 1 _|}_ for 1000 iterations in the RL
algorithm
the optimal policy _π_ <sup>_∗_</sup>, from which 134 abstract tests were produced by running
the multi agent system with each. We concretized each abstract test once and
expected to cover _(i–iii)_ as a result of the learning.
Finally, as a baseline for comparison, we assembled 100 abstract tests pseudorandomly, sampling from the 10 possible commands in the human’s code.
These were concretized into 100 tests. Considering that the protocol for a successful table assembly requires a very specific sequence of actions, we expected
these tests to reach very low coverage.
We used ROS Indigo and Gazebo 2.2.5 for the simulator and testbench
implementation. Tests ran on a PC with Intel i5-3230M 2.60 GHz CPU, 8 GB
of RAM, and Ubuntu 14.04. The BDI-based test generation was implemented
in Jason 1.4.2. Each test ran for a maximum of 300 seconds. Each BDI multi
agent run lasted less than 5 seconds to produce each abstract test. All the
abstract test sequences, coverage reports and simulation log files are available
online. <sup>11</sup>
5.2 Code Coverage Results
Fig. 8 shows the code coverage reached by each test, in an ascending order.
Code coverage indicates the depth to which the HRI protocol was explored. High
coverage corresponds to scenarios in the table assembly protocol that are hard to
reach, without any bias, as they depend on complex sequences of interactions.
All three BDI exploration methods produced tests that reached the highest
coverage possible. RL reached high coverage automatically, without having
to provide additional constraints or knowledge on which tests might be more
effective, although the learning process took 3 hours to complete. To speed
up this process, RL could be used to optimize pre-computed test sets instead
of learning from zero, or more knowledge could be added to help the learning
through the reward function or by providing additional constraints for belief
selection.
The number of steps in the graph indicates the coverage of different decision
points, which reflects test diversity. Pseudorandom exploration produced tests
with less diversity compared to the other two; i.e. some code branches were not
reached. Constraints would be needed to achieve greater diversity, at the cost of
11https://github.com/robosafe/bdi ~~t~~ ests ~~r~~ esults
12
100
80
60
40
20
0
BDI by hand
BDI pseudornd.
BDI RL
Pseudorandom
<u>0</u> <u>20</u> <u>40</u> <u>60</u> <u>80</u> <u>100</u> <u>120</u>
Tests
Figure 8: Code coverage percentages per test, ordered increasingly, obtained
from different BDI exploration methods in model-based test generation, and
pseudorandom test generation
Table 1: Assertion coverage with different BDI exploration methods and pseu<u>dorandom</u> <u>tests</u>
Req. BDI by hand BDI pseudorandom BDI RL Pseurorandom
<u>Passed</u> <u>Failed</u> <u>NC</u> <u>Passed</u> <u>Failed</u> <u>NC</u> <u>Passed</u> <u>Failed</u> <u>NC</u> <u>Passed</u> <u>Failed</u> <u>NC</u>
R1 90/138 1/138 47/138 7/100 0/100 93/100 24/134 0/134 110/134 1/100 0/100 99/100
R2 100/138 0/138 38/138 73/100 0/100 27/100 94/134 0/134 40/134 18/100 0/100 82/100
R3 138/138 12/138 0/138 89/100 10/100 1/100 121/134 11/134 2/134 16/100 20/100 64/100
<u>R4</u> <u>138/138</u> <u>0/138</u> <u>0/138</u> <u>100/100</u> <u>0/100</u> <u>0/100</u> <u>134/134</u> <u>0/134</u> <u>0/134</u> <u>100/100</u> <u>0/100</u> <u>0/100</u>
more manual effort. The tests generated from manually specifying belief subsets
are similar to directed tests, with associated high levels of manual effort, low
levels of test variety, and hence poor software and state exploration as well as
limited capacity to detect requirement violations.
As expected, we obtained low coverage and diversity results for the pseudorandom generated tests, as, without any constraints, the HRI protocol is difficult
to complete.
5.3 Assertion Coverage Results
Table 1 shows the assertion coverage results, containing the number of tests
where the requirement was satisfied (Passed), not satisfied (Failed), or not
checked (NC)–i.e. the code did not trigger the monitor.
Reqs. R2 and R4 were satisfied in all the tests. The assertion results for Req.
R4 demonstrated that the code does not interfere with the kinematic planner’s
13
configuration, and thus dangerous unavoidable collisions between the person and
the robot’s hand are being prevented. In contrast, Req. R1 was not satisfied
due to a slow leg release (i.e. it took longer than the specified time threshold).
Req. R3 was not satisfied. This identified a need for further crush prevention
mechanisms to be added into the code to improve safety.
While the BDI methods triggered the assertion monitors of all the requirements, the pseudorandom generated tests were less effective, causing fewer
checks.
5.4 Discussion
We answered Q1 through the description of our BDI models in Section 4.2.
The agency of the interacting entities is represented through the reasoning and
planning cycles of the multi agent system, following their beliefs and goals. BDI
models can be constructed for autonomous robots with sophisticated artificial
intelligence, and our approach shows how such models can be exploited for
intelligent testing.
We answered Q2 through examining three BDI model exploration methods,
each with a different strategy for belief selection, including manual, pseudorandom and coverage-directed using RL. These produced a variety of tests able
to find previously unknown issues in the code, whilst exploring and covering
different decision points effectively.
Clear differences exist between the BDI exploration methods in terms of
manual effort. RL automatically produced effective tests in terms of diverse
coverage criteria, code exploration, and detection of requirement violations
(through assertion coverage). Moreover, RL was able to generate tests that
achieved exploration goals _(i–iii)_ automatically, which answers Q3 . The level
of automation achieved by integrating machine learning into the test generation
process is expected to save considerable engineering effort in practice.
_Scalability._ Our two-tiered approach tackles the complexity of the test generation problem in the HRI domain by decomposing the tests into an abstract
sequence and a parameter instantiation phase. The main disadvantage of modelbased approaches is the manual effort required in the modelling. In principle,
the BDI models could be built first, and then the robot’s code could be generated
from them. Alternatively, code modularity (e.g., using SMACH) facilitates the
modelling by providing abstractions. In our example, the code was structured
as an FSM, which led to 12 plans in the corresponding BDI agent, a reduction
of 20 times the size of the code when counting statements. The size of the BDI
agents can be further reduced using abstractions, where, for example, plans can
be simplified by composing simple actions into abstract ones.
_Performance._ The performance of the RL algorithm can be influenced
through the rates _α_ and _γ_, and by defining different reward functions. Furthermore, learning performance can be improved by providing pre-computed belief
sets as a warm start for the learning process. This is at the cost of trading the
exploration of the model for exploitation of (potentially few) belief subsets that
achieve high coverage [23]. In addition to improving scalability, increasing the
level of abstraction in the BDI model also improves the performance of the test
generation.
14
### 6 Conclusions
We presented an agent-based testing approach for robotic software that is used
in HRI. Our approach stimulates the robotic code in simulation using a model of
the entities the robot interacts with in its environment, including humans. We
proposed the use of BDI agents to model the protocol between the interacting
entities, including the robot’s code, using a two-tiered model-based test generation process from abstract action sequences to concrete parameter instantiation.
BDI agents allow modelling agency and reasoning, thus providing an intelligent mechanism to generate realistic tests with timing and individual complex
data generation engines for stimulating robotic software that has high levels of
concurrency and complex internal and external interactions. We have demonstrated that BDI meta agents can manipulate the interacting agents’ beliefs
explicitly, affording control over the exploration of a multi agent model. We
expect that the concept of BDI verification agents can be extended to other
domains, such as microelectronics design verification.
To increase the effectiveness of the BDI verification agents in terms of coverage closure and test diversity, we have proposed the use of RL, exploiting a
coverage feedback loop that systematically explores the BDI agents to construct
the most effective test suite. This method overcomes the need for manually controlling test generation, which is necessary in other test generation methods, e.g.
writing properties is required for model-based test generation approaches that
exploit model checking, and writing constraints is required to control conventional pseudorandom test generation, whether model-based or not [2, 3].
We demonstrated the effectiveness and benefits of our BDI-based test generation approach on a cooperative table manufacture scenario, using a ROS-Gazebo
simulator and an automated testbench, as described in Section 3. All underlying
data on the simulator, test generation methods and results are openly available
from the links to Github, provided as footnotes, in this paper.
In summary, the RL-based BDI approach clearly outperforms existing approaches in terms of coverage, test diversity and the level of automation that
can be achieved.
### 7 Future Work
We are now investigating different strategies to control the BDI agents, such as
combinations of beliefs and goals, in order to gain a deeper understanding of how
to design an optimal verification agent. We are also investigating what impact
the addition of previous coverage knowledge to the RL process has, expecting a
significant speed-up.
Ultimately, we aim to move our BDI-based test generation approach online,
directly integrating the verification agents into the environment the robotic code
interacts with during simulation. This should allow us to obtain feedback at
runtime, such as code and assertion coverage of the robotic code, and to react
to the observable behaviour of the robotic code in direct interaction at runtime
with the aim to automate coverage closure.
15
Acknowledgments
This work was supported by the EPSRC grants EP/K006320/1 and EP/K006223/1,
as part of the project “Trustworthy Robotic Assistants”.
### References
[1] R. Alexander, H. Hawkins, and D. Rae. Situation Coverage - A Coverage
Criterion for Testing Autonomous Robots. Technical report, Department
of Computer Science, University of York, 2015.
[2] D. Araiza-Illan, D. Western, K. Eder, and A. Pipe. Coverage-driven verifi
cation - an approach to verify code for robots that directly interact with
humans. In _Proc._ _HVC_, pages 1–16, 2015.
[3] D. Araiza-Illan, D. Western, K. Eder, and A. Pipe. Systematic and realistic
testing in simulation of control code for robots in collaborative human-robot
interactions. In _Proc._ _TAROS_, 2016.
[4] D. Arney, S. Fischmeister, I. Lee, Y. Takashima, and M. Yim. Model-based
programming of modular robots. In _Proc._ _ISORC_, pages 66–74, 2010.
[5] D. Bird and C. Munoz. Automatic generation of random self-checking test
cases. _IBM_ _Systems_ _Journal_, 22(3):229–245, 1983.
[6] R. Bordini, J. H¨ubner, and M. Wooldridge. _Programming_ _Multi-Agent_
_Systems_ _in_ _AgentSpeak_ _using_ _Jason_ . Wiley, 2007.
[7] J. Boren and S. Cousins. The SMACH High-Level Executive. _IEEE_
_Robotics_ _&_ _Automation_ _Magazine_, 17(4):18–20, 2010.
[8] S. Carino and J. Andrews. Dynamically testing GUIs using ant colony
optimization. In _Proc._ _ASE_, pages 138–148, 2015.
[9] L. A. Dennis, M. Fisher, N. K. Lincoln, A. Lisitsa, and S. M. Veres. Prac
tical verification of decision-making in agent-based autonomous systems.
_Automated_ _Software_ _Engineering_, 23(3):305–359, 2016.
[10] K. Eder, C. Harper, and U. Leonards. Towards the safety of human-in-the
loop robotics: Challenges and opportunities for safety assurance of robotic
co-workers. In _Proc._ _IEEE_ _ROMAN_, pages 660–665, 2014.
[11] J. Ernits, M. Veanes, and J. Helander. Model-based testing of robots with
NModel. In _Proc._ _TestCom/FATES_, 2008.
[12] M. Gaudel. Counting for random testing. In _Proc._ _ICTSS_, pages 1–8, 2011.
[13] M. Geetha Devasena and M. Valarmathi. Multi agent based framework
for structural and model based test case generation. _Procedia_ _Engineering_,
38:3840–3845, 2012.
[14] C. Ioannides and K. I. Eder. Coverage-directed test generation automated
by machine learning - a review. _ACM_ _Trans._ _Des._ _Autom._ _Electron._ _Syst._,
17(1):7:1–7:21, Jan. 2012.
16
[15] Y. Jia, M. Cohen, M. Harman, and J. Petke. Learning combinatorial in
teraction test generation strategies using hyperheuristic search. In _Proc._
_ICSE_, pages 540–550, 2015.
[16] J. Kim, J. M. Esposito, and R. Kumar. Sampling-based algorithm for
testing and validating robot controllers. _International_ _Journal_ _of_ _Robotics_
_Research_, 25(12):1257–1272, 2006.
[17] A. Lenz, S. Skachek, K. Hamann, J. Steinwender, A. Pipe, and C. Melhuish.
The BERT2 infrastructure: An integrated system for the study of humanrobot interaction. In _Proc._ _IEEE-RAS_ _Humanoids_, pages 346–351, 2010.
[18] R. Lill and F. Saglietti. Model-based testing of cooperating robotic systems
using Coloured Petri Nets. In _Proc._ _SAFECOMP/_ _DECS_, 2013.
[19] M. Mossige, A. Gotlieb, and H. Meling. Testing robot controllers using con
straint programming and continuous integration. _Information and Software_
_Technology_, 57:169–185, 2014.
[20] A. Namin, B. Millet, and M. Sridharan. Stochastic model-based testing for
human-robot interaction. In _Proc._ _ISSRE_, 2010.
[21] C. Nguyen. _Testing Techniques for Software Agents_ . PhD thesis, University
of Trento, 2008.
[22] N. Pare and P. Soni. Improving model based testing using event consider
ation for various designs concepts. _IJCSIT_, 6(5):4718–4723, 2015.
[23] R. Sutton and A. Barto. _Reinforcement_ _Learning:_ _An_ _Introduction_ . The
MIT Press, 1998.
[24] L. Tan, J. Kim, O. Sokolsky, and I. Lee. Model-based testing and monitor
ing for hybrid embedded systems. In _Proc._ _IRI_, pages 487–492, 2004.
[25] M. Veanes, P. Roy, and C. Campbell. Online testing with reinforcement
learning. In _Proc._ _FATES_, pages 240–253, 2006.
[26] W. Zheng and G. Bundell. Model-based software component testing: A
UML-based approach. In _Proc._ _ICIS_, pages 891–899, 2007.
17
섹션 본문
섹션 본문이 없습니다.
참고문헌
참고문헌 정보가 없습니다.