DeepAI
Log In Sign Up

Exploratory Experiments on Programming Autonomous Robots in Jadescript

07/23/2020
by   Eleonora Iotti, et al.
0

This paper describes exploratory experiments to validate the possibility of programming autonomous robots using an agent-oriented programming language. Proper perception of the environment, by means of various types of sensors, and timely reaction to external events, by means of effective actuators, are essential to provide robots with a sufficient level of autonomy. The agent-oriented programming paradigm is relevant with this respect because it offers language-level abstractions to process events and to command actuators. A recent agent-oriented programming language called Jadescript is presented in this paper together with its new features specifically designed to handle events. Exploratory experiments on a simple case-study application are presented to show the validity of the proposed approach and to exemplify the use of the language to program autonomous robots.

READ FULL TEXT VIEW PDF
03/25/2021

The Resh Programming Language for Multirobot Orchestration

This paper describes Resh, a new, statically typed, interpreted programm...
03/21/2014

Towards Active Logic Programming

In this paper we present the new logic programming language DALI, aimed ...
04/05/2000

Programming in Alma-0, or Imperative and Declarative Programming Reconciled

In (Apt et al, TOPLAS 1998) we introduced the imperative programming lan...
10/13/2020

Scenic: A Language for Scenario Specification and Data Generation

We propose a new probabilistic programming language for the design and a...
02/12/2003

Cg in Two Pages

Cg is a language for programming GPUs. This paper describes Cg briefly....
08/14/2011

Conscious Machines and Consciousness Oriented Programming

In this paper, we investigate the following question: how could you writ...

1 Introduction

AOP (Agent-Oriented Programming[31] is a programming paradigm that aims at providing effective languages and tools to develop agent-based software systems (e.g., [17]). The most challenging parts of the development of complex agent-based software systems are expected to be leveraged by AOP languages and tools. AOP languages and tools allow programmers to reason on high-level views of multi-agent systems instead of concentrating on fine-grained details that tend to distract attention from targeted problems. Examples of such challenging parts of the development of complex agent-based software systems are the deployment of agents to network hosts, the routing of messages across the network, and the handling of sensor information. The abstractions that AOP languages normally support and that make such languages suitable for agent-based software development are discussed, for example, in the specifications from FIPA (Foundation for Intelligent Physical Agents), now IEEE FIPA Standards Committee (http://www.fipa.org), and in the literature on AOSE (Agent-Oriented Software Engineering) (e.g., [9]). The effectiveness of such abstractions in the development of complex agent-based software systems has progressively increased the interest in AOP for industrial and academic uses.

Jadescript [12] is briefly presented in Section 3 as an AOP language based on JADE (Java Agent DEvelopment framework) (e.g., [4, 8]) whose main objectives are to ease the use of JADE and to help programmers develop complex agent-based software systems at a high level of abstraction. Besides the presentation of Jadescript, the main contribution of this paper is to show how an AOP language like Jadescript can be used to program autonomous robots. A case-study application, which calls for the management of sensors, the handling of events, and the use of actuators, is discussed in Section 5. Therefore, in Section 4

, a detailed description of a new Jadescript feature designed to process percepts and to make them available to agents is presented. Such a new feature is based on the native support for pattern matching that has been recently added to the language 

[28], as recalled in Section 4. Programmers use the pattern-matching support that the language natively provides to clearly state the characteristics of the managed percepts, their intended scope, and their priorities. Note that the recent introduction of the pattern-matching support is a substantial step forward with respect to the early versions of the language (e.g., [13, 27]) because it extends the applicability of the language to better include event-driven programming and its applications.

The remaining of this paper is organized as follows. The major progresses of AOP are summarized in Section 2 in terms of a brief description of some of the most important AOP languages. A brief overview of Jadescript and of its current features is presented in Section 3. The most recent improvements of the language, which are intended to better support robotic applications, are detailed in Section 4. The case-study application designed to validate such improvements is described and commented in Section 5. Finally, a short discussion on the proposed approach to AOP concludes the paper.

2 Related Work

Jadescript is closely related to JADE, and it provides practical support to programmers to use some of the most relevant abstractions that JADE offers, namely agents, behaviours [3], and (communication) ontologies [32]. Jadescript agents are fully interoperable with JADE agents because the ultimate goal of Jadescript is to reduce the complexity of building agent-based software systems that use JADE as their underlying infrastructure. As stated in a recent survey [23], JADE is still one of the most popular agent platforms, even if its first prototype is more than twenty years old [8]

. One of the major reasons for the longevity of JADE is probably related to its reliability and robustness, which make it suitable for industrial applications designed to take advantage of the peculiar characteristics of software agents in terms of reusability and composability (e.g., 

[5]).

JADEL (JADE Language[6, 10] is the direct predecessor of Jadescript, and it is an AOP language that was designed to ease the use of JADE. Differently from Jadescript, JADEL is based on Xtend [14], which is a dialect of Java integrated with the Xtext infrastructure [14]. The choice of grounding JADEL on Xtend has a direct impact on the language, and the major reasons for the proposal of Jadescript are to remove such a dependence and to have the freedom to experiment novel linguistic constructs.

Domain-specific languages for the development of agents and multi-agent systems are, for example, SEA_ML (Semantic web-Enabled Agent Modeling Language[18], CLAIM (A Computational Language for Autonomous Intelligent and Mobile Agents[20], and 3APL (An Abstract Agent Programming Language[22]. Programming languages with a dedicated support for the reactive processing of events in the scope of robotic applications have also been proposed when AOP was used in the research on robotics, like, for example, in the PROFETA (Python RObotic Framework for dEsigning sTrAtegies[21] project. PROFETA is a tool that was developed to program autonomous robots in a declarative way by adopting a BDI (Belief-Desire-Intention) approach (e.g., [29]). PROFETA provides each agent with a list of reactive plans, each of which consists of an event, a condition, and an action. Similarly, Jadescript provides agents with the event handlers described in Section 4. However, PROFETA is inspired by AgentSpeak(L) [29], which makes it substantially different from Jadescript.

According to recent surveys [2, 15]

, AOP languages can be classified into declarative or imperative, BDI or procedural, highly specific or general purpose. AgentSpeak(L) and its Java implementation, Jason 

[16], are examples of declarative BDI languages, while SARL [30] is an example of a procedural language that provides the abstractions needed to implement holonic agents and related multi-agent systems. Such languages have their specific ranges of applicability, and a detailed comparison with Jadescript is not among the objectives of this paper. However, both SARL and Jason deal with the sensing of external events, and they can be used to program autonomous robots, as follows.

To the best of our knowledge, SARL has not yet been tested in robotic applications, although it is clearly possible to use it to control autonomous robots. SARL provides programmers with the possibility of defining the types of application-specific events that the agents can capture. Jadescript does not explicitly provide such a possibility, but it allows programmers to define percepts as particular predicates in the scope of an ontology. Such percepts are then handled by behaviours, as described in Section 4.

Jason beliefs can be used to represent percepts, to the extent that a belief is asserted when a sensor of the agent acquires the pertinent information. Nonetheless, the approach to event handling that Jason provides is known to have relevant concurrency problems [19], which complicates the use of Jason for robotic applications. On the contrary, Jadescript event handlers completely rely on the inherent synchronization that JADE ensures, and concurrency problems are solved using a priority queue together with the well-known behaviour scheduling policy that characterizes JADE agents, as discussed in Section 4.

Besides AOP languages, agent frameworks are also very popular, and many agent-based software systems are written in general-purpose programming languages using such frameworks. JADE [3], JACK [33], and many other agent frameworks (e.g., [23]) are available to allow the effective use of general-purpose programming languages to develop and deploy agent-based software systems.

3 Overview of Jadescript

Jadescript [12] is a novel AOP language designed to allow programmers to adopt agents and multi-agent systems to simplify the development of complex distributed systems. This is achieved by some design choices that make Jadescript source codes easy to read, but at the same time concise, and similar to pseudocodes in many aspects. Among such design choices, some of the most important are the adoption of semantically-relevant indentation, and the introduction of the of notation, which resembles the common way to refer to the properties of objects in English. Such characteristics of the language, combined with other features like native collection types, make Jadescript similar to modern scripting languages like Python. Jadescript agents are nothing but JADE agents in order to take advantage of the relevant features of the popular agent framework. This is the reason why Jadescript agents are assumed to be executed by the Java virtual machine, and Jadescript source codes are intended to be directly compiled to Java.

Jadescript is a statically-typed language because the types of all the elements of a source code are known at compile time. The type system of the language is based on five categories of types, namely primitive types, collection types, ontology types, agent types, and behaviour types. Primitive types are boolean, integer, float, double, and text. Collection types are the types of lists and maps. The declaration of structured types is supported in Jadescript in terms of ontology schemas [4]. Jadescript borrows from JADE four categories of ontology schemas, namely predicates, propositions, concepts, and actions. Predicates represent facts in the form of relationships among objects of the world, while propositions represent atomic facts. Concepts represent the objects of the world and their properties, while actions are special concepts that represent the tasks that can be performed by the agents in the multi-agent system. Predicates, concepts, and actions, but not propositions, can have zero or more named properties. The subtyping relationship between ontology schemas can be established to allow derived schemas to be defined by adding and overriding properties of base schemas. Schemas are collected in (communication) ontologies, which are sets of schemas that can be shared among agents to enable communication and to allow agents to cooperate by sharing knowledge expressed in terms of data in agreed formats. Ontologies can extend other ontologies by adding schemas to base ontologies. Figure 1 shows an example of a simple Jadescript ontology that comprises two concepts, one action, and one predicate to describe a world made of shapes that agents manipulate.

1ontology Shapes
2  concept position(x as double, y as double)
3
4  concept shape(p as position, area as double)
5
6  action createShape(p as position)
7
8  predicate shapeCreated(s as shape)
Figure 1: Example of a Jadescript ontology with two concepts, one action, and one predicate to describe a world made of shapes that agents manipulate.

The agents that execute in a Jadescript multi-agent system are declared with the agent construct, in which properties, functions, procedures, and lifecycle event handlers are defined. An agent type can extend another agent type to inherit, and possibly override, internal declarations from the base agent type. The tasks that agents perform in a Jadescript multi-agent system are described using behaviours, which are abstractions that Jadescript borrows from JADE (e.g., [4]). The behaviour construct groups three kinds of declarations, namely properties, actions, and event handlers. Actions are portions of procedural code that are executed every time behaviours are scheduled. Event handlers are described in Section 4. Just like agent types, a behaviour type can be derived from another behaviour type.

Despite being a statically-typed language, some of the burdens associated with type declarations are relieved from programmers because the Jadescript compiler supports a limited form of type inference. The compiler is able to automatically and implicitly detect the types of properties and local variables by computing the types of their mandatory initialization expressions. Therefore, the assignment of initialization values is sufficient to declare properties and local variables in Jadescript without explicitly stating their types in the source code.

Jadescript agents execute in platforms that are subdivided into containers, and each container is related to a process running on a host of the network. A platform associates each agent with a unique AID (Agent IDentifiers) that can be used to support communication. In Jadescript, agents refer to other agents by means of the aid concept, which is also used to send messages with the send construct. The ACL (Agent Communication Language) specified by the IEEE FIPA Standards Committee is used in Jadescript to support the communication among agents, and therefore each message is characterized by a performative, which is the name of the communicative act that the sender intends to perform by sending the message, an envelope, and a content.

Jadescript allows describing the tasks that agents perform in terms of behaviours. A behaviour represents a fragment of the way an agent acts to bring about a goal, and it is characterized by an internal state and an action. An agent can dynamically engage multiple behaviours at the same time, and all such behaviours are kept in an internal list of active behaviours. Behaviours are executed in the single thread of the agent by means of the cooperative scheduler that characterizes JADE agents. If no behaviours are active, the agent makes a transition to the waiting state, and it quietly waits for new events to occur. Two kinds of behaviours can be defined in Jadescript, namely cyclic behaviours and one-shot behaviours. When a cyclic behaviour is active, it is rescheduled multiple times until it is explicitly deactivated. One common use of such behaviours is to implement reactions to changes in the state of the agent or in the state of the world. On the contrary, one-shot behaviours are automatically deactivated at the end of their execution, and they need to be explicitly reactivated if needed.

Behaviour types are defined by means of the behaviour construct. Behaviours can be constrained to work with a specific ontology using the uses-ontology clause. Similarly, they can be constrained to be activated only by the agents of the type declared using the for-agent clause. Note that if a behaviour is constrained to work on a specific type of agent, it can implicitly use the ontologies that the chosen type of agent references in the uses-ontology clause.

Figure 2 shows an example of a simple Jadescript agent with one property and one on-create handler that defines the procedure to be executed upon creation in terms of two behaviours. The two behaviours used by the initialization procedure are shown in Figure 3. A RequestNewShape behaviour is a one-shot behaviour that, when scheduled for execution, sends a request message to the targeted shape-provider agent. The targeted shape-provider agent, upon successful creation of the requested shape, replies with an inform message. A HandleShapeCreated behaviour is a cyclic behaviour that processes such replies. Note that a RequestNewShape behaviour uses the Shapes ontology, and it can be activated by any type of agent. On the contrary, a HandleShapeCreated behaviour can be activated by ShapeProvider agents only because it needs to refer to the myShape property of the agent. Since a HandleShapeCreated behaviour is designed to work with ShapeRequester agents, it is assumed that it can implicitly use the Shapes ontology because the declaration of ShapeRequester agents ensures that the Shapes ontology is referenced.

1agent ShapeRequester uses ontology Shapes
2  property myShape as shape
3
4  on create with providerName as text, x as double, y as double do
5    activate behaviour HandleShapeCreated
6
7    activate behaviour RequestNewShape with
8      shapeProvider = aid(providerName),
9      shapePosition = position(x, y)
Figure 2: Example of a Jadescript agent with one property and one on-create handler that defines the procedure to be executed upon creation in terms of two behaviours.
1cyclic behaviour HandleShapeCreated for agent ShapeProvider
2  on inform when content matches shapeCreated(s) do
3    myShape of agent = s
4
5one shot behaviour RequestNewShape uses ontology Shapes
6  property myProvider as aid
7  property myPosition as position
8
9  on create with shapeProvider as aid, shapePosition as position do
10    myProvider = shapeProvider
11    myPosition = shapePosition
12
13  do
14    send request createShape(myPosition) to myProvider
Figure 3: The two behaviours used in the declaration of ShapeRequester agents shown in Figure 2.

4 A Support for Percept Handlers in Jadescript

Jadescript supports event-driven programming by means of event handlers included in agent and behaviour declarations. The current version of the language provides linguistic constructs for three categories of events: the transition to a new state in the lifecycle of an agent, the reception of a message from an agent, and the perception of an interesting event that occurred in the environment and that is described in terms of a new percept. Note that the support for percept handlers has been recently added to the language to serve the needs of robotic applications.

The on-create and on-destroy handlers are used to manage the events that represent changes in the lifecycle state of an agent, and they are declared in the scope of an agent declaration. The on-create handler is activated when an agent is started, and it supports an optional list of typed parameters to allow a set of arguments to be passed to an agent for its proper activation. The on-destroy handler is activated when an agent is requested to terminate, right before its termination procedure begins.

Incoming messages directed to an agent are added to the internal message queue of the agent. They wait in the queue for on-message handlers to extract them and to perform the needed reactions. Such handlers are executed in the scope of a behaviour, and they only run when the behaviour is effectively scheduled for execution. The on-message handlers and the on-percept handlers (described below) can be provided with optional when expressions. A when expression defines a Boolean condition on the processed event and on the state of the behaviour that must be satisfied in order for the event handler to be considered applicable to the event. Any Boolean expression without side effects can be used as when expression. An important Boolean operator recently introduced in the language is the matches operator [28], which allows to declaratively express the structure of the expected events by means of a pattern. Figure 3 shows an example of the use of a when expression and of the matches operator at line . Note that the matches operator can be used to declare local variables and to assign values to them by decomposing the structure of its left operand. For example, the local variable s in Figure 3 at line  is implicitly declared and assigned by the matches operator.

The on-percept handlers are a new addition to the language, and they represent the main mechanism provided by Jadescript to receive percepts from the environment. Percepts are ontology schemas that extend the native predicate percept. Such a predicate features a single property, called priority, which is a natural number that represents the default priority assigned to a percept. Percepts with a higher property are treated with higher urgency. To achieve this, each agent maintains an internal priority queue that collects all the percepts received from the environment. Such a queue is then visited in decreasing order of priority, and appropriate on-percept handlers are possibly executed for each percept in the queue. Note that if a percept handler provides a when expression, such an expression can prevent the execution of the handler even if suitable percepts are in the priority queue.

The novel support for percept handlers is completed with a Java API to allow external event sources to decide when a percept should be provided to an agent. Such an API is based on the O2A (Object-to-Agent) interface [4] that JADE provides to pass Java objects to agents in a thread-safe way. Actually, the novel API to provide percepts to agents does not require explicit synchronization, and it assumes that it is used in a thread different from the threads of the agents that receive the percepts. The main methods offered by the API are notifyEvent(Percept) and notifyEvent(Percept, int). Such methods are declared in the JadescriptAgent class, which is the Java class used as base class of all Jadescript agents instead of the ordinary Agent class that JADE provides. Both methods, when invoked, provide their first argument to the targeted agent via the O2A interface. The second method treats its second argument as a priority that is used to override the value of the priority property of percepts, which is treated just as a default priority.

Since the handling of percepts often requires agents to promptly react to events, the internal management of percepts, and the execution of related handlers, is integrated in the main loop of each agent to ensure that percept handlers are executed before behaviours. For this reason, the agent loop was changed with respect to the ordinary loop of JADE agents, as shown in Algorithm 1.

, , ,
loop
     while not .isEmpty() do
         .peek()
         if  is percept then
              .dequeue()
              .enqueue()
         end if
     end while
     while not .isEmpty() do
         .dequeue()
         for all  in  do
              if .isApplicableTo(then
                  .execute()
              end if
         end for
     end while
     if .hasNextBehaviour() then
         .getNextBehaviour()
         .execute()
     end if
end loop
Algorithm 1 The internal loop of Jadescript agents modified to support percept handlers.

5 An Case-Study Application

Percept handlers have been recently added to Jadescript to effectively support robotic applications like the case-study application described in this section, which was used to perform simple experiments. The discussed experiments consist of making a small robot perform autonomous explorations of an indoor environment avoiding obstacles. The explored environment is a known corridor, and an UWB (Ultra-Wide Band) localization infrastructure (e.g., [25]

) is installed to allow the robot to estimate its position on the floor of the corridor. Obstacles are cubes placed randomly in the corridor, and each face of each cube has a QR code attached. The mission of the robot is to explore the corridor avoiding obstacles to trace the approximate positions of all obstacles.

Figure 4: The RoboMe used for experiments with the linked SpoonPhone installed in the head cradle and connected with an audio cable to send commands to the robot and to receive proximity alerts.

RoboMe, a toy robot produced by WowWee (http://www.wowwee.com), was chosen to perform the described experiments. RoboMe is a simple robot because it has only one sensor, which is a front proximity sensor, and its actuators are just two slow wheels, a moving head cradle, and a loudspeaker. Besides being so simple, RoboMe was chosen because it can be easily connected to a smartphone that can be set firmly on its head cradle. The attached smartphone provides the robot with much more sensors, and it can easily control the robot with a simple API. The smartphone is linked to the robot using an audio cable that connects to the headset port of the smartphone, and the exchange of information between the robot and the attached smartphone is based on sounds. The robot reacts to a fixed set of sounds, and each sound is associated with a particular action, which include stop, move forward, move backward, turn left, turn right, lower the head cradle, and raise the head cradle. Similarly, the robot signals the presence of front obstacles using a specific sound that is interpreted by the smartphone.

The smartphone used for the discussed experiment is a SpoonPhone, which is a smartphone produced by BeSpoon (http://www.bespoon.com). The main feature of SpoonPhones is that they integrate hardware and software modules needed to perform accurate positioning with respect to an UWB infrastructure. SpoonPhones have already been used to perform experiments on indoor positioning, and they ensured a position accuracy of less than  m (e.g., [26]), which is considered sufficient for targeted applications [11]. In particular, the support for the UWB sensors that SpoonPhones provide have already been integrated in the localization add-on module [24] for JADE to perform the mentioned experiments on indoor positioning. In addition, SpoonPhones are ordinary Android smartphones, and the SpoonPhone used for experiments featured an accelerometer, a gyroscope, a compass, and a front camera. Figure 4 shows a picture of the RoboMe used for experiments with the linked SpoonPhone installed in the head cradle and connected with an audio cable to send commands to the robot and to receive proximity alerts. Note that the arms and the hands of the robot are not motorized.

In order to perform the discussed experiments and make the robot autonomously explore the environment, a dedicated Android application for the SpoonPhone was developed mostly in Jadescript. WowWee provides a Java API for RoboMe (http://github.com/WowWeeLabs/RoboMe-Android-SDK) that allows Android applications to send commands to the robot and to receive proximity alerts. Therefore, the developed Android application bridges the RoboMe API with a Jadescript agent hosted on a JADE container deployed using the JADE add-on for Android [7]. The RoboMe API has nonblocking methods, and the commands to the robot can be safely sent from Jadescript behaviours because they do not block the agent loop. In addition, the Java part of the application uses the localization add-on module for JADE to estimate the position of the robot in the indoor environment and to constantly inform the agent of its position using suitable percepts. Finally, the Java part of the application uses ordinary APIs to read QR codes and to gather meaningful information from the accelerometer, the gyroscope, and the compass. The Java part of the application is executed in a different thread with respect to the thread of the agent. The Java API discussed in the previous section is used to provide the agent with the percepts gathered using the mentioned event sources in a thread-safe way.

The structure of the Jadescript agent can be briefly summarized as follows. A RoboMe agent uses a HandlePercepts behaviour to handle percepts generated by the Java part of the Android application. Such percepts are defined in the RoboMeApplication ontology, which is shared among the agent, its behaviour, and the Java part of the Android application. Figure 5 shows the Jadescript source code of the ontology. The ontology includes four types of percepts associated with different priorities. The falling percepts are generated when the sensors of the smartphone (accelerometer and gyroscope) can be used to alert the agent that the smartphone is falling. Note that such percepts have the highest priority. The obstacle percepts are generated when the proximity sensor of the robot notifies the presence of a front obstacle. Note that such percepts have a high priority, but they do not have the highest priority. The qrCodeRead percepts are generated when the images from the front camera of the smartphone can be used to detect a QR code. Finally, the position percepts are generated by the localization add-on module for JADE at constant rate using the ranging information acquired from the UWB sensor of the SpoonPhone. Note that the falling percepts and the obstacle percepts are defined as propositions because they simply notify that an event has recently occurred, but they do not carry other information. On the contrary, the qrCodeRead percepts and the position percepts carry meaningful information, and therefore they are declared as predicates.

1module it.unipr.ailab.robome
2
3ontology RoboMeApplication
4  proposition falling extends percept with priority = 10
5
6  proposition obstacle extends percept with priority = 8
7
8  predicate qrCodeRead(qrCode as string) extends percept
9    with priority = 4
10
11  predicate position(x as double, y as double) extends percept
12    with priority = 2
Figure 5: The Jadescript ontology used in the case-study application to declare the types of percepts that the Java part of the application for the SpoonPhone can generate using relevant information from sensors.
1module it.unipr.ailab.robome
2
3agent RoboMe uses ontology RoboMeApplication
4  property roboMeInterface as any
5
6  property worldMap = {}
7
8  property currentPosition = position(0, 0)
9
10  on create with interface as any do
11    roboMeInterface = interface
12
13    invoke "startListening" on roboMeInterface
14
15    activate behaviour HandlePercepts
16
17    do moveForward
18
19  procedure stop do
20    invoke "callStop" on roboMeInterface
21
22  procedure moveForward do
23    invoke "callMoveForward" on roboMeInterface
24
25  procedure turnLeft do
26    invoke "callTurnLeft" on roboMeInterface
27
28   # other procedures that use roboMeInterface were removed
29   # for the sake of brevity
Figure 6: Some of the most relevant parts of the Jadescript source code of the agent developed for the case-study application.

Some of the most relevant parts of the Jadescript source code of the agent developed for the case-study application are shown in Figure 6. The mission of the agent is to move the robot in the forward direction while trying to capture all visible QR codes, and when an obstacle is detected, to change its direction to avoid the obstacle. The HandlePercepts behaviour, which is partially shown in Figure 7, is used to process percepts and to avoid obstacles, while tracking the approximate positions of visible QR codes. Note that the Java part of the Android application is responsible for creating the JADE container, for creating a Java object to allow the agent to interface the actuators of the robot, and to create a RoboMe agent. When the RoboMe agent is created, it receives the Java object that it can use to command actuators. The Java object, which is referenced as roboMeInterface in the source code of the agent, provides a Java method for each available command to actuators, and the agent uses such methods directly with the invoke keyword. Jadescript offers the any data type for opaque Java objects, and it provides the invoke keyword to invoke methods on Java objects, so that Jadescript agents can take full benefit of libraries and frameworks available to the hosting Java virtual machine. Finally, note that the first method invoked on the roboMeInterface is startListening, which immediately activates the delivery of percepts to the agent from all supported event sources.

Some of the most relevant parts of the Jadescript source code of the HandlePercepts behaviour are shown in Figure 7. In particular, Figure 7 shows the procedures that are performed when obstacle percepts, qrCodeRead percepts, and position percepts are received. When an obstacle percept is received, the robot is immediately stopped, then it is requested to turn left, and it is finally requested to restart. When a qrCodeRead percept is received, the text of the read QR code is associated with the current position of the robot in the map of the world. Finally, when a position percept is received, the property of the agent that stores the current position of the robot is updated.

1module it.unipr.ailab.robome
2
3cyclic behaviour HandlePercepts for agent RoboMe
4  on percept when content matches obstacle do
5    do stop
6    do turnLeft
7    do moveForward
8
9  on percept when content matches qrCodeRead(qrCode) do
10    worldMap[currentPosition] = qrCode
11
12  on percept when content matches position(x, y) do
13    currentPosition = position(x, y)
14
15   # other percept handlers were removed for the sake of brevity
Figure 7: Some of the most relevant parts of the Jadescript source code of the HandlePercepts behaviour used by RoboMe agents.

6 Conclusion

This paper presented exploratory experiments on the use of an AOP language to program autonomous robots. First, the paper briefly recalled some of the major features of Jadescript. Then, it presented the novel support for percept handlers that has been recently introduced in the language to serve the needs of robotic applications. Finally, it briefly described a simple case-study application designed to validate the possibility of using Jadescript to program autonomous robots. Even for such a simple application, the support for event handling in the language was needed so urgently that the development plans for the language were changed to anticipate it. The design choices that form the basis of the language ensured that such a new feature could be incorporated easily and coherently with the rest of the language, and the experiments presented in this paper suggest that now Jadescript can be used to better support the event-driven programming of autonomous robots.

The management of the priorities of percepts, and of percepts with respect to behaviours, which is currently solved with a priority queue, calls for further investigations. The current implementation assumes that percepts are more important than messages. Hence, messages are processed only when all percepts have already been handled, which might not be sufficient in some situations. In addition, the current approach to sense the environment and to control actuators should be further questioned. A possible improvement of the current approach could be the introduction in the language of the explicit support for sensors and actuators to match the recent introduction of the support for percepts.

References

  • [1]
  • [2] Costin Bădică, Zoran Budimac, Hans-Dieter Burkhard & Mirjana Ivanovic (2011): Software agents: Languages, tools, platforms. Computer Science and Information Systems 8(2), pp. 255–298, doi:http://dx.doi.org/10.2298/CSIS110214013B.
  • [3] Fabio Bellifemine, Federico Bergenti, Giovanni Caire & Agostino Poggi (2005): JADE – A Java agent development framework. In Rafael H. Bordini, Mehdi Dastani, Jürgen Dix & Amal El Fallah Seghrouchni, editors: Multi-Agent Programming: Languages, Platforms and Applications, Springer, pp. 125–147, doi:http://dx.doi.org/10.1007/0-387-26350-0_5.
  • [4] Fabio Bellifemine, Giovanni Caire & Dominic Greenwood (2007): Developing Multi-Agent Systems with JADE. Wiley Series in Agent Technology, John Wiley & Sons, doi:http://dx.doi.org/10.1002/9780470058411.
  • [5] Federico Bergenti (2003): A discussion of two major benefits of using agents in software development. In Paolo Petta, Robert Tolksdorf & Franco Zambonelli, editors: Proceedings of the 2020 Workshop on Engineering Societies in the Agents World (ESAW 2002), Springer, pp. 1–12, doi:http://dx.doi.org/10.1007/3-540-39173-8_1.
  • [6] Federico Bergenti (2014): An introduction to the JADEL programming language. In:

    Proceedings of the 2014 IEEE International Conference on Tools with Artificial Intelligence (ICTAI 2014)

    , IEEE, pp. 974–978, doi:http://dx.doi.org/10.1109/ICTAI.2014.147.
  • [7] Federico Bergenti, Giovanni Caire & Danilo Gotta (2014): Agents on the move: JADE for Android devices. In: Proceedings of the 2014 Workshop “From Objects to Agents” (WOA 2014), CEUR Workshop Proceedings 1260, RWTH Aachen, pp. 1–4. Available at http://ceur-ws.org/Vol-1260/paper9.pdf.
  • [8] Federico Bergenti, Giovanni Caire, Stefania Monica & Agostino Poggi (2020): The first twenty years of agent-based software development with JADE. Autonomous Agents and Multi-Agent Systems 34:36, doi:http://dx.doi.org/10.1007/s10458-020-09460-z.
  • [9] Federico Bergenti, Marie-Pierre Gleizes & Franco Zambonelli, editors (2004): Methodologies and Software Engineering for Agent Systems: The Agent-Oriented Software Engineering Handbook. Springer.
  • [10] Federico Bergenti, Eleonora Iotti, Stefania Monica & Agostino Poggi (2017): Agent-oriented model-driven development for JADE with the JADEL programming language. Computer Languages, Systems & Structures 50, pp. 142–158, doi:http://dx.doi.org/10.1016/j.cl.2017.06.001.
  • [11] Federico Bergenti & Stefania Monica (2016): Location-aware social gaming with AMUSE. In: Proceedings of the 2016 International Conference on Practical Applications of Agents and Multi-Agent Systems (PAAMS 2016), Springer International Publishing, pp. 36–47, doi:http://dx.doi.org/10.1007/978-3-319-39324-7_4.
  • [12] Federico Bergenti, Stefania Monica & Giuseppe Petrosino (2018): A scripting language for practical agent-oriented programming. In: Proceedings of the 2018 ACM SIGPLAN International Workshop on Programming Based on Actors, Agents, and Decentralized Control (AGERE 2018) at ACM SIGPLAN Conference Systems, Programming, Languages and Applications: Software for Humanity (SPLASH 2018), ACM, pp. 62–71, doi:http://dx.doi.org/10.1145/3281366.3281367.
  • [13] Federico Bergenti & Giuseppe Petrosino (2018): Overview of a scripting language for JADE-based multi-agent systems. In: Proceedings of the 2018 Workshop “From Objects to Agents” (WOA 2018), CEUR Workshop Proceedings 2215, RWTH Aachen, pp. 57–62. Available at http://ceur-ws.org/Vol-2215/paper_10.pdf.
  • [14] Lorenzo Bettini (2013): Implementing Domain-Specific Languages with Xtext and Xtend. Packt Publishing.
  • [15] Rafael H. Bordini, Lars Braubach, Mehdi Dastani, Amal El Fallah Seghrouchni, Jorge J. Gomez-Sanz, Joao Leite, Gregory O’Hare, Alexander Pokahr & Alessandro Ricci (2006): A survey of programming languages and platforms for multi-agent systems. Informatica 30(1), doi:http://dx.doi.org/10.15388/informatica.2018.196.
  • [16] Rafael H Bordini, Jomi Fred Hübner & Michael Wooldridge (2007): Programming Multi-Agent Systems in AgentSpeak using Jason. John Wiley & Sons, doi:http://dx.doi.org/10.1002/9780470061848.
  • [17] Jeffrey Bradshaw, editor (1997): Software Agents. MIT Press.
  • [18] Sebla Demirkol, Moharram Challenger, Sinem Getir, Tomaz Kosar, Geylani Kardas & Marjan Mernik (2013): A DSL for the development of software agents working within a Semantic Web environment. Computer Science and Information Systems 10(4), pp. 1525–1556, doi:http://dx.doi.org/10.2298/CSIS121105044D.
  • [19] Álvaro Fernández Díaz, Clara Benac Earle & Lars-Åke Fredlund (2018): Pitfalls of Jason concurrency. In: Proceedings of the 2018 International Workshop on Engineering Multi-Agent Systems (EMAS 2018), Springer, pp. 19–33, doi:http://dx.doi.org/10.1007/978-3-030-25693-7_2.
  • [20] Amal El Fallah-Seghrouchni & Alexandru Suna (2003): Claim: A computational language for autonomous, intelligent and mobile agents. In: Proceedings of the 2003 International Workshop Programming Multi-Agent Systems (ProMAS 2003), Springer, pp. 90–110, doi:http://dx.doi.org/10.1007/978-3-540-25936-7_5.
  • [21] Loris Fichera, Fabrizio Messina, Giuseppe Pappalardo & Corrado Santoro (2017): A Python framework for programming autonomous robots using a declarative approach. Science of Computer Programming 139, pp. 36–55, doi:http://dx.doi.org/10.1016/j.scico.2017.01.003.
  • [22] Koen V. Hindriks, Frank S. De Boer, Wiebe Van der Hoek & John-Jules Ch. Meyer (1999): Agent programming in 3APL. Autonomous Agents and Multi-Agent Systems 2(4), pp. 357–401, doi:http://dx.doi.org/10.1023/A:1010084620690.
  • [23] Kalliopi Kravari & Nick Bassiliades (2015): A survey of agent platforms. Journal of Artificial Societies and Social Simulation 18(1), p. 11, doi:http://dx.doi.org/10.18564/jasss.2661.
  • [24] Stefania Monica & Federico Bergenti (2016): A comparison of accurate indoor localization of static targets via WiFi and UWB ranging. In: Proceedings of the 2016 International Conference on Practical Applications of Agents and Multi-Agent Systems (PAAMS 2016), Springer, pp. 111–123, doi:http://dx.doi.org/10.1007/978-3-319-40159-1_9.
  • [25] Stefania Monica & Federico Bergenti (2019): Hybrid indoor localization using WiFi and UWB technologies. Electronics 8(3):334, doi:http://dx.doi.org/10.3390/electronics8030334.
  • [26] Stefania Monica & Federico Bergenti (2020): An algorithm for accurate and robust indoor localization based on nonlinear programming. Electronics 9(1):65, doi:http://dx.doi.org/10.3390/electronics9010065.
  • [27] Giuseppe Petrosino & Federico Bergenti (2018): An introduction to the major features of a scripting language for JADE agents. In: Proceedings of the 2018 Conference of the Italian Association for Artificial Intelligence (AI*IA 2018), Lecture Notes in Artificial Intelligence 11298, Springer, pp. 3–14, doi:http://dx.doi.org/10.1007/978-3-030-03840-3_1.
  • [28] Giuseppe Petrosino & Federico Bergenti (2019): Extending message handlers with pattern matching in the Jadescript programming language. In: Proceedings of the 2019 Workshop “From Objects to Agents” (WOA 2019), CEUR Workshop Proceedings 2404, RWTH Aachen, pp. 113–118. Available at http://ceur-ws.org/Vol-2404/paper17.pdf.
  • [29] Anand S. Rao (1996): AgentSpeak(L): BDI agents speak out in a logical computable language. In: Proceedings of the 1996 European Workshop on Modelling Autonomous Agents in a Multi-Agent World (MAAMAW 1996), Springer, pp. 42–55, doi:http://dx.doi.org/10.1007/BFb0031845.
  • [30] Saul Rodriguez, Nicolas Gaud & Stephane Galland (2014): SARL: A general-purpose agent-oriented programming language. In: Proceedings of the 2014 IEEE/WIC/ACM International Joint Conferences of Web Intelligence (WI 2014) and Intelligent Agent Technologies (IAT 2014), 3, IEEE, pp. 103–110, doi:http://dx.doi.org/10.1109/WI-IAT.2014.156.
  • [31] Yoav Shoham (1997): An overview of agent-oriented programming. In Jeffrey Bradshaw, editor: Software Agents, MIT Press, pp. 271–290.
  • [32] Michele Tomaiuolo, Paola Turci, Federico Bergenti & Agostino Poggi (2006): An ontology support for semantic aware agents. In: Proceedings of the 2005 International Workshop on Agent-Oriented Information Systems (AOIS 2005), 3529, Springer, pp. 140–153, doi:http://dx.doi.org/10.1007/11916291_10.
  • [33] Michael Winikoff (2005): JACKTM intelligent agents: An industrial strength platform. In Rafael H. Bordini, Mehdi Dastani, Jürgen Dix & Amal El Fallah Seghrouchni, editors: Multi-Agent Programming: Languages, Platforms and Applications, Springer, pp. 175–193, doi:http://dx.doi.org/10.1007/0-387-26350-0_7.