An ROS-based Shared Communication Middleware for
Plug & Play Modular Intelligent Design of Smart Systems
Centralized architectures for systems such as smart offices and homes are rapidly becoming obsolete due to inherent inflexibility in their design and management. This is because such systems should not only be easily re-configurable with the addition of newer capabilities over time, but should also have the ability to adapt to multiple points of failure. Fully harnessing the capabilities of these massively integrated systems requires higher level reasoning engines that allow them to plan for and achieve diverse long-term goals, rather than being limited to a few predefined tasks. In this paper, we propose a set of properties that will accommodate such capabilities, and develop a general architecture for integrating automated planning components into smart systems. We show how the reasoning capabilities are embedded in the design and operation of the system, and demonstrate the same on a real-world implementation of a smart office.
The last decade has seen increasing interest in massively integrated systems that incorporate capabilities of sensing and actuation in order to adapt and respond to its environment dynamically. Popular examples of such systems include smart offices and smart homes and the closely related notion of Internet of Things. As these systems, collectively referred to as “smart systems”, become more and more advanced in their capabilities, and are able to assimilate increasingly complex components into their ecosystem, the major technological challenges faced are mainly in issues involving the integration of the diverse elements and functionalities, and providing them autonomy.
Figure 1 depicts an illustrative smart office environment. When the TV screen in the conference room is plugged in for the first time, the office should detect the addition of this new component, and complete the setup (resource allocation and integration) automatically, and understand that the conference room now has screen-casting abilities. This is referred to as plug & play design. Suppose now that the setup malfunctions and the screen is incapable of displaying anymore. The smart office may now deploy a video collaboration robot to the conference room in order to resume the interrupted meeting. To do this the smart system must be equipped with the ability to sense the change in environment and reason at a high level about the proper response to this change. We postulate that the building blocks of such systems should be in the form of modular, self-aware micro-agents that can reason about their capabilities and the state of the environment, and achieve tasks independently or as a group. Further their design should be modular so as to be able to efficiently deal with the dynamic nature of the environment, as well as be abstracted to high level functionalities so as to handle the diversity of their internal implementations.
The integration of AI in smart rooms was first conceptualized in the MIT Intelligent Room Project [\citeauthoryearBrooks1997]. Since then, the question of intelligent architecture design of ubiquitous systems has been explored extensively, most notably in Anand Ranganathan’s seminal work [\citeauthoryearRanganathan and Campbell2003] on context-aware middleware design of pervasive systems. The adoption of automated planning technology in Gaia [\citeauthoryearRanganathan and Campbell2004] was certainly a first step towards augmenting high level reasoning capabilities in such environments. However, a recent study from \citeauthorieee on the state-of-the-art in design of IoT environments identifies still persisting deficiencies in smart architectures, especially in terms of semantics of abstract APIs of system components and their generic high level reasoning capabilities. Indeed, while there has been significant interest in design of architectures for integrating task planning capabilities, especially in robotics applications, in recent times [\citeauthoryearCashmore et al.2015, \citeauthoryearMERS and RoboCup Logistics League2016], there is still a large void to be filled when it comes to general purpose multi-agent embedded systems.
The main aim of this work is to outline a framework for integration of high level reasoning engines in a smart system in order to facilitate general distributed long-term decision making. To this end, we -
outline three principles - plug & play, modular and intelligence - for the design of smart systems.
show how agents may follow protocols using abstract message classes to reason and communicate with each other, without accessing their internal implementations.
create a prototype smart office model based on the discussed principles, and provide use cases and video demonstrations to illustrate these properties.
While some of these ideas have been investigated before, especially in the context of hardware, we will primarily focus on how the same principles may be applied in a unified manner at the higher level APIs as well.
Plug & Play Modular Intelligent Agents
We argue that for smart systems to have the kind of functionalities we have discussed thus far, they should be designed to have three basic properties, as follows -
Semantic Plug & Play
This enables a system to -
Discover and integrate (i.e. resource allocation of) new components into the system automatically.
Re-evaluate and update self-capabilities as the system components evolve with time.
Deal with the dynamics of connection, e.g. individual components plugging in and out of the system due to network failures, internal failures, etc.
This concept of plug & play is consistent with the traditional notion of plug & play in computing, that facilitates the discovery and integration of hardware components (e.g. hotplug systems like USB and IEEE 1394 FireWire) usually during boot-time without requiring manual device configuration [\citeauthoryearWikipedia2016]. At the same time we argue that the for a truly smart system, the traditional notion of plug & play must extend to automatic dynamic re-configuration of hardware. We refer to this as semantic plug & play, wherein the system not only accommodates seamless hardware integration but also integration, at the API level, of abstract capabilities that may be reasoned with at a high level.
Finally, by intelligence, we mean that
Components of the system should be able reason about the current state of the environment, and the agents in it, in order to coordinate with other units in its ecosystem and achieve long-term tasks or goals.
The reasoning capabilities for the system should be realized in both centralized and decentralized fashion. This is critical as the system grows in complexity, in order to lower communication overhead and be suited to the limited computational power of embedded units, and also to avoid redundancy or backtracking during planning.
A smart system is inherently distributed in nature - both physically and in terms of capabilities. Thus the architecture must itself be open and modular to support -
Device agnosticism and, consequently, easy configuration across diverse platforms and hardware implementations.
Handling of multiple points of failure, which is critical in such massively integrated systems, while also leveraging redundancies of fault-tolerant design.
Agents capable of performing local computation. From the task planning standpoint, often only a small subset of the agents are required to complete a task. Further, the entire system capabilities is mostly not required by every single agent to compute its own contribution to the global plan. Thus making a centralized plan, or even planning individually with complete models, is often not necessary.
The need for both centralized and decentralized reasoning engines is complimentary to a distributed approach to architecture design. Note, however, that the notion of a distributed architecture is distinct from whether the reasoning algorithm itself is distributed. Further, we will restrict ourselves to deterministic sequential planning as the primary reasoning capability, but the ideas discussed here can be easily extended to accommodate other forms of reasoning engines.
Proposed Architecture Design
Now we describe the general principles involved in our architecture design, that we will adopt in our smart system.
Shared Communication Channel
The core of the architecture used is a single communication substrate as illustrated in Figure 2. All the individual components of the system or agents are plugged into this shared communication layer, and they communicate between each other using abstract message classes. Both the description of the agents and the messages they use to communicate is at an abstracted level, that does not interfere with the actual implementation of the system’s communication layer. Thus, the communication substrate can be swapped out and replaced with a different one, and the API’s for the agents and message classes will remain exactly the same. Each agent, however, has a Communication Agent (CA) built into it that acts as the interface to the communication layer. Thus the communication agent itself is implementation specific, and needs to be reconfigured according to the environment.
The abstract message classes provide a common language for the agents to communicate with. This closely follows the specifications of agent communication language (ACL) laid out by the IEEE Foundation for Intelligent Physical Agents (FIPA) in [\citeauthoryearThe Foundation of Intelligent Physical Agents (FIPA)]. This language is defined by 11 performative types that perform their specific roles during an information exchange. The types used in the paper and their typical roles are described in Table 1.
|performative type||typical functions|
|agree||- reply with plan proposal (from actuator)|
|cancel||- cancel existing commitment|
|refuse||- refuse deployed request|
|call for proposals||- broadcast call for plan proposals|
|propose||- reply with plan proposal (from planner)|
|accept||- accept proposal|
|reject||- reject proposal|
|query||- ask for information from the UI|
We use ROS [\citeauthoryearQuigley et al.2009] as our communication substrate. All agents are plugged into a central ROS server, and they communicate with each other using ROS messages. The abstract message API thus acts as a wrapper for the lower level ROS messages. The Communication Agent implements a ROS node that publishes and subscribes to the appropriate topics. Each of the message types have their specific global ROS topic that all agents have access to, where messages of corresponding type are published. Though the roles of the message types are specified as part of the language description, the semantics of a message of particular type is decided by the agent that processes it.
The architecture for centralized planning is shown in Figure 2(a). The agents plugged into the shared communication substrate are of three basic types - some of them handle the user interface (keyboard), some are capable of interacting with the environment (different types of actuators like the camera, the mobile base and stationary sensors) while the rest of them deal with the reasoning tasks of the system. This framework supports centralized planning since global agents deal with specific tasks of the planning process, and all agents report and hear back from these.
The architecture in Figure 2(b) is adopted to facilitate decentralized planning capabilities of the system. Here actuators (i.e. any agent that can influence the environment) are equipped with their own Planners and Domain Maintainers. Without going into details of these individual agents, this means that actuators are now capable of building their own plans. The processing of the plan request and execution is however still done in a centralized fashion so that proposals from individual agents can be evaluated.
The Base Agent
is the basic agent class that all other agents inherit from. It has abilities to send/receive messages with the help of the communication middleware attached to it, and can perform basic processing on these messages.
The Communication Agent (CA)
is the interface between the Base Agent API and the communication substrate. The primary functionality of the CA is thus to assist in the relaying of messages back and forth between agents through the shared communication channel. The CA also has special callback functions that alert its parent agent about specific messages addressed to it. The CA can also perform secondary tasks such as listening to the communication channel for agent heartbeats, perform queue operations on agent death/activation or in response to messages processing, cache broadcast messages for processing, and so on.
The Reasoning Engine
consists of agents concerned with task planning and execution, with the help of which the system can reason with models of its components at a high level without accessing their internal implementation. In the distributed version, the agents can continue using the same components to compute plans locally - only the architecture and communication protocols change. Four specific agents make up this reasoning engine -
sets up a request for plan computation (upon request from either the user or some other agent) and calls the Planning Agent for a plan. The plan request compiles all the state and domain information that may be required to solve a planning problem.
computes the actual plan (and replies back with the plan and plan status), given a plan request from the Plan Requester with specific domain and problem descriptions. Currently it is integrated with the state-of-the-art planners FAST-DOWNWARD [\citeauthoryearHelmert2006] and Metric FAST-FORWARD [\citeauthoryearHoffmann and Nebel2001].
is tasked with interfacing with Actuators. It receives a request for a plan to be executed, transforms these higher level actions into lower level methods that the specific actuators have access to, and sends specific action requests to the concerned agents. It is also responsible for plan monitoring and error handling during execution.
is tasked with maintaining the evolving capabilities of the system. These may be both global or local capabilities according to whether the centralized or distributed architecture is being used. It can inform the reasoning engine about changes to the current state, goal/cost function, and available actions and observations. This is the agent that is primarily responsible for managing the plug & play mechanism of the system by listening to the heartbeat of agents and re-evaluating the system capabilities dynamically. The agent models are currently represented in PDDL [\citeauthoryearMcdermott et al.1998] - PDDL support is the same as that of the underlying planning software being used.
inherit the Base Agent functionalities and add capabilities for interaction with the environment (e.g. sensing and actuation). They can also announce their self-capabilities to the system (by broadcasting their action models at regular intervals - this is referred to as its heartbeat and is initiated when it first becomes active) and execute actions within advertised capability when requested. Specialized actuators inherit from the basic Actuator class -
is a mobile base - it can move between (pre-defined) poses in the map. It can also carry non-stationary sensors. The onboard laptop also contributes to the distributed keyboard interface to the users.
can move (PTZ), record video, snap pictures, and detect motion [\citeauthoryearLavrsen2016]. Its controls are also accessible through the keyboard interface.
Temperature / Humidity Sensor
reports temperature at its current location (stationary).
Temperature IR Sensor
reports temperature at its current location (variable, when mounted on a mobile base).
The platform supports a wide variety of sensors, including CO Sensor, Motion Sensor, IR Distance Adapter with Sharp Sensor, Wide Range Light Sensor, IR Reflective Sensor, etc. All these sensors are stationary and need to connect to a SBC. We also have integration capabilities directly to the computer with a mini-USB port through a SBC Interface Kit (however, this requires power).
The user interface is through the keyboard (and maintained by the Keyboard Agent). The keyboard offers a simple platform for users to request plans or actions from the system. It also provides simple tools for debugging. One additional advantage of using the keyboard is that it can be conveniently distributed across the system through multiple shared screens. Currently the central server and also the laptops on the mobile bases shares the keyboard interface (e.g. through tmux). In terms of specific capabilities, through the Keyboard Agent the user can (1) request for plans/actions; (2) modify state or goal descriptions; and (3) respond to information requests from agents.
Flow of Control in Centralized Plan Execution
We will now illustrate an example of flow of control within the agents for centralized planning (Figure 4(a)). The setting consists of stationary temperature sensors at various locations, and mobile bases with on-board sensors.
Initially all sensors are active and broadcasting their action models. The Domain Maintainer compiles these into a composite high level model of the system.
The User requests a requirement (e.g. report temperature from all locations) through the Keyboard Agent, which it forwards on to the Plan Requester.
The Plan Requester receives the request, sets up the problem/domain by converting the requirement to a high level PDDL goal, and requests a plan from the Planner.
The Planner computes a plan (which involves every sensor reporting their measurements from their corresponding locations) and responds back to the Plan Requester, which forwards it to the Executor.
The Plan Executor goes through the actions in the plan sequentially, translates them into lower level methods of the agents involved, and dispatches these action requests to the appropriate actuators (it requests every stationary temperature node to respond with their measurements).
The Executor receives confirmation of execution success from the actuator and moves on to the next action in the plan. The plan execution is complete when the Executor has received acknowledgments from all the sensors.
Now some of the stationary sensors become inactive. The Domain Maintainer detects the missing heartbeats and updates the system capabilities to reflect this.A new plan request is formed, and the above procedure ensues again, until finally, the Executor dispatches mobile bases to compensate for the loss of stationary sensors.
The way the mobile bases are allocated tasks depends on action costs and map of the environment (which is reflected in the problem and domain descriptions compiled by the Domain Maintainer).
Flow of Control in Decentralized Plan Execution
The flow of control in the decentralized scenario is slightly different since their is no single global Planner and Domain Maintainer. This means that the Plan Requester has to adopt an interactive procedure with the agents to come up with a global solution, as illustrated in Figure 4(b).
As before, the user requests for a goal through the Keyboard, which forwards the request to the Plan Requester.
The Requester now sends out a call for proposal to every agent plugged into the system by means of a broadcast.
Each agent receives the request for a plan and computes a plan to address the goal(s) mentioned in the request. The agent does this by invoking its internal planner which has access to local domain knowledge as compiled by its personal Domain Maintainer.
The agents who are able to contribute a plan respond to the call for proposal with the proposed plan.
The Plan Requester listens to the communication channel and accumulates the plan proposals it receives. After the wait time is over, it goes through the cached responses and selects the cheapest candidate for execution.
The Requester dispatches this plan to the Plan Executor for execution, and the rest of the control flows as described previously in case of the centralized system.
Demonstrations111Video recordings of these demonstrations could not be made available for public release.
Our smart environment, shown in Figure 6, consists of two office rooms and one conference room (each equipped with a stationary temperature sensor) connected by a single corridor (that has a PZT camera equipped with motion detection). The corridor is patrolled by a mobile base, which is a TurtleBot that also carries an IR temperature sensor. The positions of these agents are shown in the figure. Besides, there are human users that can also interact with the system.
The goal here is to collect temperature measurements from all rooms. Office2 and confroom are equipped with stationary sensors but office1 is not - so the system dispatches the TurtleBot to report temperature from office1. This shows how the system can reason with the state of the environment and higher level models of its components to achieve goals. When the temperature sensor in office2 goes down, the system detects this and re-evaluates its capabilities automatically and dispatches the TurtleBot to office2 instead. This is an instance where the plug & play architecture comes into use, as the system is able to adapt and re-plan accordingly.
Now the sensor in confroom goes down, and the system adapts and replans accordingly. This again shows how the system responds not only to evolving capabilities but also to changing environment and (maintenance) goals.
We now emulate a simple access control mechanism, where the camera detects movement at the entry and requests for the person entering to be validated. The system dispatches the TurtleBot to the location so that the person can log in through the on-board screen. Here the agents themselves respond to the changing environment and request for a plan update. This is also an instance where the user gets to interact with the system through the distributed interface.
We end by envisioning a few extensions to the proposed architecture and motivating some future avenues of research.
Distributed Communication Substrate
As the number of agents increase, the communication load on a single ROS master will eventually become prohibitive. One way to alleviate concerns of scalability is to adopt different ROS masters for each agent ecosystem 7, where groups of agents are using their own ROS environment, that by itself works as described in this paper; so that these separate ecosystems interact with each other through Interfacing Nodes (IN) to share messages of mutual interest. This architecture will not only deconflict identical ROS topics across ecosystems, but also preclude the need for ROS namespace mappings, and privatize topics that does not involve other agents.
The protocols for decentralized planning discussed in this paper will only work, of course, for non-disjunctive goals and when agents will not require mutual cooperation. However, the same protocols can support sharing of other information too, such as domain models, state information, etc. We can thus equip the Plan Requester with more sophisticated plan processing algorithms, like auctioning and merging [\citeauthoryearBorrajo2013], to come up with a full-fledged distributed planning protocol. Given the framework can already support this, this also opens pathways to leverage existing literature in planning by distributed search. [\citeauthoryearBrafman2015].
- [\citeauthoryearBorrajo2013] Borrajo, D. 2013. Multi-agent planning by plan reuse. In AAMAS, 1141–1142.
- [\citeauthoryearBrafman2015] Brafman, R. I. 2015. A privacy preserving algorithm for multi-agent planning and search. In IJCAI, 1530–1536.
- [\citeauthoryearBrooks1997] Brooks, R. A. 1997. The intelligent room project. In Second International Conference on Cognitive Technology. Humanizing the Information Age., 271–278.
- [\citeauthoryearCashmore et al.2015] Cashmore, M.; Fox, M.; Long, D.; Magazzeni, D.; Ridder, B.; Carrera, A.; Palomeras, N.; Hurtos, N.; and Carreras, M. 2015. Rosplan: Planning in the robot operating system.
- [\citeauthoryearHelmert2006] Helmert, M. 2006. The fast downward planning system. Journal of Artificial Intelligence 26:191–246.
- [\citeauthoryearHoffmann and Nebel2001] Hoffmann, J., and Nebel, B. 2001. The FF planning system: Fast plan generation through heuristic search. 14:253–302.
- [\citeauthoryearLavrsen2016] Lavrsen, K. J. 2016. Motion - a software motion detector. www.lavrsen.dk/foswiki/bin/view/Motion/.
- [\citeauthoryearMcdermott et al.1998] Mcdermott, D.; Ghallab, M.; Howe, A.; Knoblock, C.; Ram, A.; Veloso, M.; Weld, D.; and Wilkins, D. 1998. PDDL - The Planning Domain Definition Language. Technical report, Yale Center for Computational Vision and Control.
- [\citeauthoryearMERS and RoboCup Logistics League2016] MERS and RoboCup Logistics League. 2016. Enterprise Task Planning System. http://bit.ly/2cgix62.
- [\citeauthoryearQuigley et al.2009] Quigley, M.; Conley, K.; Gerkey, B. P.; Faust, J.; Foote, T.; Leibs, J.; Wheeler, R.; and Ng, A. Y. 2009. ROS: an open-source Robot Operating System. In ICRA Workshop on Open Source Software.
- [\citeauthoryearRanganathan and Campbell2003] Ranganathan, A., and Campbell, R. H. 2003. A middleware for context-aware agents in ubiquitous computing environments. In Middleware 2003: ACM/IFIP/USENIX International Middleware Conference, 143–161.
- [\citeauthoryearRanganathan and Campbell2004] Ranganathan, A., and Campbell, R. H. 2004. Autonomic pervasive computing based on planning. In International Conference on Autonomic Computing, 80–87.
- [\citeauthoryearThe Foundation of Intelligent Physical Agents (FIPA)] The Foundation of Intelligent Physical Agents (FIPA). Agent Communication Language (ACL) Specifications. http://bit.ly/2cOrFnF.
- [\citeauthoryearThe IEEE Standards Association2015] The IEEE Standards Association. 2015. IEEE-SA Internet of Things Ecosystem Study. http://bit.ly/2ch0YEh.
- [\citeauthoryearWikipedia2016] Wikipedia. 2016. Plug and Play. http://bit.ly/2c18nWh.