Modelling and Search-Based Testing of Robot Controllers Using Enzymatic Numerical P Systems
Abstract
The safety of the systems controlled by software is a very important area in a digitalized society, as the number of automated processes is increasing. In this paper, we present the results of testing the accuracy of different lane keeping controllers for an educational robot. In our approach, the robot is controlled using numerical P systems and enzymatic numerical P systems. For tests generation, we used an open-source tool implementing a search-based software testing approach.
keywords:
tests generation, numerical P systems, enzymatic numerical P systems, search-based software testing, cyber-physical systems, membrane computing1 Introduction
Due to the remarkable technological progress of late years, software applications tend to have a considerable role in solving most problems of everyday life. The medical, financial or automotive fields are just three of the main areas in which software products are intensively used. Given the importance of these areas in every individual’s life, ensuring product quality and functionality is an essential step in the development process. The safety of software systems for large-scale use is ensured by testing. Software testing aims to validate the fulfillment of the requirements defined for the developed product, as well as to identify possible unwanted behaviors triggered by simulating certain operational contexts.
In this paper, we propose an approach for testing two different lane keeping controllers designed to move an educational robot called E-puck [9]. Both controllers are based on numerical P systems, introduced by G. Păun and R. Păun in [12]. We also provide an equivalent version for the models using enzymatic numerical P systems, an extension of numerical P systems, defined by A. Pavel et al. in [10]. For this experiment we used some reliable tools which will be introduced in the following sections.
The paper is structured as described: Section 2 presents the P system variants to be used in the paper. Section 3 introduces the working environment, including the tools used. Section 4 describes the models and the main differences between them, while Section 5 illustrates the testing approach along with the results. In the end, Section 6 presents the future work and conclusions.
2 Preliminaries
Membrane computing is a field of research introduced by Gh. Păun in [11, 13]. The computational paradigm was originally inspired by the structure and functionality of the living cells. Several classes of membrane systems (P systems) have been later defined and investigated, being classified according to the structure of the membranes as cell-like, tissue-like and neural-like P systems. Membrane computing has made significant breakthroughs in the last decades in fields like computer science, economics or biology. Depending on the requirements, extensions of the main concept were introduced and our experiment involves two of these types: numerical P systems and enzymatic numerical P systems.
2.1 (Enzymatic) Numerical P System
The (enzymatic) numerical P systems [12, 10] are computational models that only inherit the membrane structure from the membrane systems, more exactly a cell-like membrane structure. The membranes contain variables and their values are processed by the programs on every time unit. The whole system is synchronized by a global clock in discrete time units.
The (enzymatic) numerical P system (EN P system) is defined by the tuple:
(1) |
where:
-
•
is degree of the system (the number of membranes);
-
•
is an alphabet of labels;
-
•
is membrane structure;
-
•
is a set of variables from membrane ;
-
•
is the initial values of the variables from region ;
-
•
is the set of programs from membrane .
The program , has one of the two following forms:-
i)
non-enzymatic
where is the production function, is the repartition protocol, and are variables from . Variables can be from the region where the programs are located, and to its upper and inner compartments, for a particular region . If a compartment contains more than one program, only one will be chosen in non-deterministically manner.
-
ii)
enzymatic
where is an enzymatic variable from , . The program can be applied at time only if . The programs that meet this condition in a region will be applied in parallel.
-
i)
When the program is applied by the system at time , the computed value
represents the unitary portion that will be distributed to the variables , proportional to coefficients , where and the received values will be .
The values of variables, from , present in the production functions are consumed, reset to zero, and their new value is the sum of the proportions distributed to variable through the repartition protocols, if they appear in them or remain at the value zero.
3 Experimental environment
In this section we will provide brief descriptions of the tools we integrated in our experiment. Firstly, we used an open-source software which allows the simulation of numerical P systems and enzymatic numerical P systems. The simulator is called PeP and will be introduced later in this section. Since we don’t have the physical education robot involved in this study, we also used a dedicated platform for robot simulations, called Webots. For tests generation, we used a tool which won the SBST Tool Competition 2022 [5]. We will discuss later in this section the arguments for using a search-based testing tool.
3.1 PeP simulator
PeP simulator [15] is an open-source product developed by A.Florea and C.Buiu, used for simulations based on numerical P systems and enzymatic numerical P systems. The program is written in Python and receives numerical P systems as an input file. The input file includes the membrane structure and the contents of each membrane, being stored in memory and executed.
PeP can be used as a stand-alone tool for simple simulations and run from the command line with some options, like the number of simulations steps or a csv document generation containing the values at each step of the simulation. As observed in [15], the tool comes with a set of basic input files examples, both numerical P systems and enzymatic numerical P systems.
Besides the simplicity of running this tool, another advantage which can be taken into account when using PeP is that it can be used as an integrated module in complex projects. We used this approach in our experiment in order to make a controller accepted by the robot simulation platform and able to receive information from the platform. In our lane keeping experiments, the simulation ends when the robot drives off the generated lane or when the lane is kept until the end.
3.2 Webots and E-puck
Webots is a robotics simulation software which allows the user to construct a complex environment for programming, modelling and simulating mobile robots. The environment can include multiple scene objects with different properties which can be set from the graphic interface or from the generation files [8]. In addition, the robots can be equiped with a large number of objects called nodes, like sensors, camera, GPS, LED, light sensor etc.
In our approach, additionally to the original equipments of E-puck, we used a GPS attached to the turret slot in order to examine the coordinates at each step of the simulation. The scenes, called ”worlds” in Webots, are containing the road that the robot will try to follow. The roads are generated with Ambiegen, a tool that will be described later in this section. Each world is defined by a .wbt file. The objects can be edited in this file and we used this option in order to place the road object in the scene with coordinates exported from Ambiegen. Additional functionalities, like sensors or GPS can also be added to the robot by editing the world file which will be imported in Webots, obtaining the visual representation of the scene.
As mentioned before, for this experiment we used a robot widely known from educational and research purposes, called E-puck. At the moment, the robot has some capabilities that are not implemented in Webots, but considering the fact that both hardware and software components of E-puck are open source, this remains a challenging opportunity [2].
E-puck has eight infrared proximity sensors placed around the body [9]. For lane keeping simulation, we used just six of them: the two sensors placed in front and the four placed two on each side. This aspect can be easily adapted by changing the membrane structure and creating new membranes if more sensors are needed or deleting a few of them if required. Each sensor has a corresponding membrane in the numerical P system model and the association was made in the controller. The robot has two motors attached to the body along with two wheels, and the speed value is also changeable from the controller.
3.3 Ambiegen
Ambiegen is an open-source tool that utilizes evolutionary search for the generation of test scenarios for autonomous systems. It can be used in experiments involving lane keeping assist systems and robots navigating a room with obstacles [7]. The software is developed in Python and uses evolutionary search [17] for tests generation. The main goal of Ambiegen in this approach is to generate roads as test cases in order to challenge E-puck to keep the lane. The tool exports the roads in separate text files as a sequence of points, representing the road spine. From this points, we can build the road with a proportional size to E-puck.
Challenging different LKAS (Lane Keeping Assist Systems) involves a large diversity of road topologies in order to detect the behavior in limit situations, such as narrow curves. Ambiegen figures out the solution for diversity by using a multi-objective genetic algorithm for search-based test generation, called Non-dominated Sorting Genetic Algorithm-II (NSGA-II) [3]. In Ambiegen implementation, NSGA-II has two-objectives: to increase the fault revealing power of test cases and to preserve their diversity [6]. This multi-objective approach, which combines roads generation with a high attention to diversity along with remarkable results at the competition mentioned above, attracted our curiosity to integrate Ambiegen with Webots and testing E-puck on the roads resulted.
3.4 Experimental Procedure
Considering the above information, we will detail the way we worked with the presented tools. PeP and Ambiegen are developed in Python and so is the robot controller.
First of all, we could easily integrate PeP with E-puck controller using the PeP module
which allowed us to parse the numerical P system model as an input file for controller. Achieving this, the model membranes were associated with controller variables. Names and constant values (e.g., robot cruise speed) were taken using a text file containing membrane’s values of the variables. The values were chosen empirically.
Next is a pseudocode version of the main loop in our controller, which performs the simulation steps.
Another challenge for us was to move the robot on the roads exported from Ambiegen with the above presented approach. Ambiegen exports the roads as .json files along with informations like test outcome, maximum curvature coefficient etc. We took the road points from the file and wrote them in the world file.
Webots provides the possibility to extend the set of scene nodes by adding custom nodes created by users. The mechanism is called PROTO and is described in [14]. After a node is extending with the PROTO interface, it can be instantiated from the Webots graphic interface.
We used this technique to retrieve the points forming the spines of the roads generated by Ambiegen and putting them into the wayPoints of the Road node. Using javascript, used as scripting language by the PROTO, we constructed new nodes illustrating the roads from Ambiegen. Then, in the graphic interface of Webots, the road is represented in accordance with the road from Ambiegen. With minimal Python code additions we plotted each generated road with the corresponding spine to confirm that the shape illustrated in Webots respects the original one.
4 Models
In this section we will present two models used to control the robot, the core of the controller. The controller receives data from proximity sensors, that measure distances to obstacles from the environment, to determine the direction of movement of a differential two wheeled robot, E-puck, in our case.
The proximity sensor has a range of 4 cm; if the obstacles are further than this limit the sensor returns the value of 0. The proximity sensors are placed on the left and right side of the robot in the direction of its movement at different angles.
The first model was taken from [4] and adapted. The equations that calculate the linear and angular velocity are shown below:
The and are the speeds of the two wheels of the robot. The enzymatic numerical P system described below encapsulates this behavior.
The first model is defined as follows:
where:
-
•
, where is the number of proximity sensors;
-
•
;
-
•
-
•
; -
•
;
-
•
;
;
;
;
;
The meaning of the variables from the model is the following:
-
and from the region represent and , the sum of the products are accumulated in ;
-
from the compartment is ;
-
each pair of weights, and , resides in the regions , ;
-
for each proximity sensor, , a compartment is defined, namely , containing a single variable, , ;
-
the products are calculated by two distinct programs, , and , , in the compartments .
The second model is an improvement on the first one. First we define the function
This function will be used in the equations describing the behavior of the model and in the production functions from the programs.
The equations describing the behavior are:
The model is defined as follows:
where:
-
•
-
•
;
-
•
-
•
; -
•
;
-
•
;
;
;
;
;
;
As we see from the definition of the and its equations, in the proximity of an obstacle, roadside, the speed of the wheel on the side with the obstacle increases according to the weights. In certain circumstances, particularly related to the geometry of a tight road curve, the sum between travel speed and the weights results in a rotation in the opposite direction of the obstacle, but a slight forward motion still continues, causing the robot to leave the road.
The second model, , overcomes this problem by calculating the product of the travel speed and the sum of the weights. In a similar situation, the second model performs an angular rotation, in the opposite direction to the obstacle, and when the proximity sensors no longer detect obstacles, it continues moving forward with a constant velocity. This behavior is modeled by compartment .
In the next section, it can be seen that the model has better behavior in similar situations compared to the first model.
5 Simulation Results
Having presented the way we integrate the tools along with the models we will detail in this section the testing stage. Ambiegen offers the possibility to configure the setup for its genetic algorithms, choosing the values for parameters like population size, number of generations, mutation rate or crossover rate. Also, aspects like the amount of time allocated for tests generation, map size, out of bound percent from which the test is considered as failed can be set easily from the command line, when executing the main Python file used in [5].




After series of trials we kept the default values, so we used the population size 100 with 75 generations. Mutation rate is 0.4 and crossover rate is 1. These values can be changed from the internal configuration file of Ambiegen. From the command line we chose the time budget allocated to generation and execution to be 1800 seconds and the map size to 200x200 meters which is the default value. For the out of bound percentage we also kept the default value (95%). After each simulation, Ambiegen exported roads spines coordinates as text files and we also plotted each generated road, as mentioned before. Then we could easily chose different roads based on the number of curves and their angle as the main criteria to diversify the tests that were supposed to be given to E-puck controller in Webots.
Next we report some roads along with the simulation results. The road is marked with grey, whilst the trajectory using the first model is represented with red. The trajectory of the second model (the improved one) is colored with green.
In Figure 1 we can see the results of different roads tests. We observe that Test 1, being the simplest test of the above presented, is passed by both models. In the next scenarios, the complexity of the road increases and only the improved model can pass.
From all the experiments, we noticed that the first model (the one marked with red in results) cannot pass a huge majority of tests with curves, whilst the improved model performs a rotation movement when the road is curved and for this reason it manages to advance until the end of the road. Additional tests were added to [16].
6 Conclusions and Future Work
In this paper we presented an approach to test different enzymatic numerical P systems models using modern tools and search-based generated tests. We evaluated our approach on a research and educational robot called E-puck, virtually represented in Webots simulator. We set up our working environment incorporating the tools with different scripts created to ensure a smooth integration between them and also a better data processing. We formally described each model involved and then showed the differences between the lane-keeping controllers resulted when using each of them. As future work, we will investigate the possibility to dynamically calculate the values for weights, which are at the moment empirically assigned. Based on the controller behavior during the previous tests, the weights values will be automatically adapted. Also, we will try to develop a method to generate more complex roads in order to better challenge the controllers.
References
- [1]
- [2] Micael S Couceiro, Patricia A Vargas & Rui P Rocha (2014): Bridging the reality gap between the Webots simulator and e-puck robots. Robotics and Autonomous Systems 62(10), pp. 1549–1567, 10.1016/j.robot.2014.05.007.
- [3] Kalyanmoy Deb, Amrit Pratap, Sameer Agarwal & TAMT Meyarivan (2002): A fast and elitist multiobjective genetic algorithm: NSGA-II. IEEE transactions on evolutionary computation 6(2), pp. 182–197, 10.1109/4235.996017.
- [4] Andrei George Florea & Cătălin Buiu (2017): Modelling multi-robot interactions using a generic controller based on numerical P systems and ROS. In: 2017 9th International Conference on Electronics, Computers and Artificial Intelligence (ECAI), pp. 1–6, 10.1109/ECAI.2017.8166411.
- [5] Alessio Gambi, Gunel Jahangirova, Vincenzo Riccio & Fiorella Zampetti (2022): SBST tool competition 2022. In: Proceedings of the 15th Workshop on Search-Based Software Testing, pp. 25–32, 10.1145/3526072.3527538.
- [6] Dmytro Humeniuk, Giuliano Antoniol & Foutse Khomh (2022): AmbieGen tool at the SBST 2022 Tool Competition. In: Proceedings of the 15th Workshop on Search-Based Software Testing, pp. 43–46, 10.1145/3526072.3527531.
- [7] Dmytro Humeniuk, Foutse Khomh & Giuliano Antoniol (2023): AmbieGen: A Search-based Framework for Autonomous Systems Testing. arXiv preprint arXiv:2301.01234, 10.48550/arXiv.2301.01234.
- [8] Olivier Michel (2004): Cyberbotics ltd. webots™: professional mobile robot simulation. International Journal of Advanced Robotic Systems 1(1), p. 5, 10.5772/5618.
- [9] Francesco Mondada, Michael Bonani, Xavier Raemy, James Pugh, Christopher Cianci, Adam Klaptocz, Stephane Magnenat, Jean-Christophe Zufferey, Dario Floreano & Alcherio Martinoli (2009): The e-puck, a robot designed for education in engineering. In: Proceedings of the 9th conference on autonomous robot systems and competitions, IPCB: Instituto Politécnico de Castelo Branco, pp. 59–65.
- [10] Ana Pavel, Octavian Arsene & Catalin Buiu (2010): Enzymatic numerical P systems-a new class of membrane computing systems. In: 2010 IEEE Fifth International Conference on Bio-Inspired Computing: Theories and Applications (BIC-TA), IEEE, pp. 1331–1336, 10.1109/BICTA.2010.5645071.
- [11] Gheorghe Păun (2002): Membrane computing: an introduction. Springer Science & Business Media, 10.1007/978-3-642-56196-2.
- [12] Gheorghe Păun & Radu Păun (2006): Membrane computing and economics: Numerical P systems. Fundamenta Informaticae 73(1-2), pp. 213–227. Available at http://content.iospress.com/articles/fundamenta-informaticae/fi73-1-2-20.
- [13] Gheorghe Păun, Grzegorz Rozenberg & Arto Salomaa, editors (2010): The Oxford Handbook of Membrane Computing. Oxford University Press.
- [14] Webots reference manual https://cyberbotics.com/doc/reference/proto.
- [15] A. G. Florea and C. Buiu, “PeP - an open-source software simulator of Numerical P systems and Numerical P systems with Enzymes,” 2017. [Online]. Available: https://github.com/andrei91ro/pep.
- [16] Github simulation results folder https://github.com/radubobe/Research/tree/main/Modelling%20and%20testing%20robot%20controllers%20using%20ENPS/Simulation%20results.
- [17] Darrell Whitley, Soraya Rana, John Dzubera & Keith E Mathias (1996): Evaluating evolutionary algorithms. Artificial intelligence 85(1-2), pp. 245–276, 10.1016/0004-3702(95)00124-7.