Intelligent robots are the machines equipped with a diverse set of visual and non-visual sensors and actuators, which possess decision making and problem solving capabilities within their domain of operation [1,2]. As the intelligent robots are gradually coexisting with human in wider areas such as service robots, social robots, and healthcare robots, a basic level of morality or ethics is necessary for safe and natural HRI tasks.
After the pioneering work of Asimov’s three laws of robotics, architectural mechanisms to enable the agent to reason and determine ethically about their actions have been proposed [3,4]. In , the authors employed a cognitive robotic architecture, DIARC/ADE, in determining whether a human’s directive should be accepted or rejected according to the excuse categories. However, the architecture is mainly focused on HRI and natural language processing, and thus it has limitation in general cognitive capabilities such as semantic, episodic, and procedural learning and memories, which are essential for ethical reasoning based on sufficient knowledge and experience.
In the artificial intelligence society, human-level cognitive agent architectures have long been developed and disseminated worldwide including ACT-R , CRAM , SS-RICS , and Soar . Soar is reported to have superiority over the well-known cognitive architectures in terms of complete symbolic reasoning, easily understandable structure, and simple programming complexity, and complex implementation in low-level control, which is a consequence of a long development history since 1981 .
Soar has been rarely applied to robotics technology despite its rich components of various memories and learning functionalities. Therefore, a successful coordination of the cognitive architecture and ROS  will be a higher level integrated development environment (IDE) available to the roboticists whose goal is developing more human-like robots.
In the present paper, the authors propose a hybrid platform which integrates two different types of software platforms, Soar and ROS. The former helps robots restore the environment information and process on them with intelligence, and the latter provides robots with useful libraries to respond well to the situation where the robot is deployed. This study will cover connection of the two platforms and creating Soar agents to help a humanoid robot make reasonable and refusable decisions on an HRI task.
In this paper, Section 2 outlines the structure of Soar and its decision cycle. This section also briefly describes ROS platform as an environment for the soar agent and how messages are shared in ROS. In Section 3, the proposed connection strategy is described. Section 4 provides an experiment result for a simple HRI task implemented on the present hybrid platform with a small humanoid robot, and Section 5 concludes the present work with remarks on future research.
2.Soar and ROS
Soar and ROS are both software frameworks on which libraries and applications are executed. For the connection, the two structures are analyzed and investigated on how data moves.
Soar is a cognitive agent software architecture, which considers problem solving as application of an operator to a state to get a desired result [11,12]. Soar integrates knowledge-intensive reasoning, reactive execution, hierarchical reasoning, planning, and learning from experience, with the goal of creating a general computational system that has the similar cognitive abilities as humans. Soar is both a software platform for agent development and a theory of what computational structures are necessary to embody human-level agents.
Fig. 1 illustrates the Soar architecture composed of working memory, decision cycle, and long-term memories including procedural memory, semantic memory, and episodic memory, which correspond to their learning mechanisms. Each of the memory systems in Soar will be briefly introduced and compared below.
Firstly, the working memory is the short-term memory that represents the current problem-solving situation. This memory holds the current state and operator, or the current knowledge of the world and the status in problem solving. Secondly, the procedural memory is the long-term knowledge which encodes procedural knowledge. Thirdly, the episodic memory deals with specific events which are snapshots of working memory images. In other words, it is a record of an agent’s experience. Finally, the semantic memory restores general facts independent of specific contexts. These memories are like those of human, helping a software agent interact with external environment.
Soar acquires knowledge by production rules. If the conditions of a production rule match with those of working memory, the production fires, and the actions are performed. These production rules are to be understood as “if-then” statements in the conventional programming languages as shown in Fig. 2. The “if” part of the production is called its condition and the “then” part separated by “-->” is called its action. When the conditions of some production rules are matched with the current situation defined in the working memory, the corresponding production rules will fire in parallel, which means that their actions are executed and make changes to working memory.
A Soar agent is created with rules and applied to send commands out via output link based on the current context. The decision of the Soar agent is governed by a reasoning cycle as shown in Fig. 3, where the agent chooses an appropriate operator based on the information it knows about its current situation, i.e., working memory, and its long-term knowledges and memories. This cycle can be divided into four phases.
In the input phase, Soar agent can receive information from a simulated or real surrounding environment. In the operator selection phase, the current state is elaborated and one or more operators are proposed depending on the contents of the working memory. If more than one operator have been proposed, Soar has a mechanism to help its agents attempt to choose the most appropriate operator for the current situation using preference symbols such as acceptable (+), reject (-), indifferent (=), better/best (>), worse/worst (<). In the operator application phase, the selected operator is fired and make changes to the current working memory. In the output phase, Soar agent sends information to external environment or its actuators such as motors.
ROS is a sophisticated open source robot middleware platform. It can provide a communication framework, hardware abstraction, device drivers with a lot of useful libraries and tools to quickly develop robot applications. ROS consists of a number of executables called nodes which are connected in a peer-to-peer network topology. These nodes perform the system’s computation and communicate with other nodes through the message exchange mechanism in ROS.
ROS supports two types of messaging mechanisms between nodes; topic and service. A topic associates publisher and subscriber where a publisher broadcasts topic messages to the whole ROS system, while the subscribers listen to the published information on this topic. There may be more than one publisher or subscriber for the same topic. On the other hand, service is a pair of request and response. Unlike the topic, there is only one provider to handle the request for each service. In general, basic communication between nodes in ROS can be described in Fig. 4.
3.Connection of Soar and ROS
With Soar and ROS software platforms mentioned above, a method is required to bridge the two architectures which must ensure the processing cycle of Soar as well as the message exchange mechanism in ROS.
Fortunately, Soar provides users a tool named Soar markup language (SML) which allows to build an interface for collaboration of two or more Soar agents . The interface is also designed to support connecting other software development environments to Soar where input and output data structures are sent back and forth. In addition, ROS provides users with the two types of communication mechanisms, i.e., topic and service, which can be created in a package to send and receive messages from other packages.
In this paper, the authors propose a connection method to bridge Soar and ROS by creating a Soar wrapper inside a ROS package. This Soar wrapper package plays a key role as a common ROS package which subscribes to topics from other packages and publishes topics as well. Moreover, the Soar wrapper package with SML tool puts input data to input link of Soar agent and reads output data from its output link. By using this method, Soar wrapper becomes a ROS package obeying ROS communication framework and also following Soar reasoning cycle.
Fig. 5 depicts the Soar-ROS example graph as a first successful result of Soar-ROS association, where according to the input number between 0 and 9 the capital city for the corresponding country is printed as an output using semantic memory of Soar . The figure clearly points out that there are three nodes (talker, soarwrapper, and listener) which exchange messages via the “number” topic from the talker node to the soarwrapper node, and the “statement” topic from the soarwrapper node to the listener node. Inside the soarwrapper is a Soar agent that gets identifier number using SML input and make decisions according to it.
SML output reads decision commands from the Soar agent via output link and publishes them. This is how Soar agent interacts with other environments. The rules of the Soar wrapper agent are shown in Fig. 6 written in plain words.
As the next step of connecting Soar and ROS, the authors attempt to apply this Soar-ROS hybrid platform into a humanoid robot ROBOTIS-OP2 (OP2 hereafter) . The OP2 robot has been well known in the literature [15,16] which proved the robot appropriate for research and development. Fig. 7 shows an overall structure of the Soar-ROS hybrid platform implemented on OP2.
Soar agents in Fig. 7 are inherited from the soarwrapper node mentioned above. The Soar agents are integrated in a ROS package, and thus it can exchange information with other packages in ROS. Packages for machine vision, voice and image recognition, voice synthesis, and various OP2 actions are all ROS packages which can be obtained from the worldwide ROS communities. They individually interact with Soar agents through the publishing and subscribing mechanism of ROS topics.
Fig. 8 shows up a developed reasoning processes where in fact the approaching method points out how Soar agents understand the environment.
Below we present a demonstration of cooperation between Soar and ROS for an HRI task where OP2 follows the human’s instructions and it may reject a command if the command may lead to damage or harm for human and/or robot, which is a new trend for more safe and natural HRI.
In the present HRI scenario, we begin with the first command when the robot is ready with a sit-down position. At this state, robot is considered to be in a safe situation. A more advanced robot will obey human’s order unless the result might give a harm to robot itself and others. To this end, there are two marks in the present scenario; an O mark means a safe situation, whereas an X mark denotes a dangerous situation. That is to say, when the robot sees the X mark, it will only follow the commands predicted to be safe such as sitting down or shaking its head for expressing yes or no. Since walking forward in this case can cause the robot to be broken by clashing with other robots or falling from a table for example, the robot will deny such a bad commands and say “No, I cannot do it.” by the present scenario. It will continue refusing to the inappropriate command until it sees the O mark, which indicates that all the unsafe situation have been removed in the current environment. Then, the robot will behave normally following all the human’s commands.
Fig. 9 shows the node structure of the developed package based on Soar-ROS hybrid platform implemented on OP2. Two well-known open-source packages are employed to carry out the HRI task. First, pocketsphinx is a speech recognizer shown as a voice package in Fig. 9, recognizing incoming vocal sounds . Second, findobject package is a ROS integration for objects recognition. Using a webcam on the OP2 robot, objects can be detected and published on a ROS topic . For instance, as shown in Fig. 10, a circle object, i.e., an O mark, is recognized because thirteen points are matched with it.
All the information from camera and voice packages are gathered into the soarwrapper node as shown in Fig. 9. The find_object_2d node receives raw images from OP2’s camera, detects each shape, and publishes objects’ identification numbers. In parallel, the voice_cmd_vel node recognizes human’s utterances thanks to its recognizer. It then publishes command’s identification numbers. These two kinds of identification numbers inform the situation where the robot is deployed.
Based on these identification numbers, the soarwrapper node decides which behavior the robot should perform as a suitable response to the command and situation. For example, if the robot gets a “Go” instruction but it has seen an X mark, it will not go forward for the safety of itself and human based on the scenario, denying the instruction by saying “No, I cannot do it.” via the robotis_op_speaker node. There are six voice commands and two mark images available in the present HRI package as shown in Table 1.
Fig. 11 shows a part of the Soar code for the HRI task with four pairs of the proposed and the applied rules (four cases) in the production memory which is responsible for reasoning camera images. Each rule has two parts, “if” and “then” parts, separated by “-->”. Depending on different object shapes, robot will make corresponding interactive actions accordingly.
For case one, if camera detects the ‘X’ or ‘Δ’ object shape, operator case_1 is created. Then, this operator is applied and gives commands to output links which disable walking. Therefore, the robot will stop when it sees the ‘X’ or ‘Δ’ object.
For case two, if the camera detects no object, an operator case_2 is created, applying output command which saves the robot’s status. As a result, without objects recognition the robot will keep walking or standing according to its previous command.
In the third case, if the camera detects a circular shape, the third rule is fired, creating the case_3 operator and applying walking decision in output links. This case causes the robot to walk forward whenever it sees an O shape which stands for a safe situation.
For the last case, if the previous object shape was ‘X’ or a triangle which stands for a dangerous situation and voice command enables robot to walk, the fourth rule is fired. This is a situation in which robot is commanded to walk forward while facing with dangerous warning. Then, the command that disables walking is applied to output link and sound command is turned on for robot to show its denial. These four pairs of rules are made in Soar production memory, giving robot knowledges to reason and make decisions while operating in human being’s environment as described in the present HRI scenario.
Fig. 12 shows sequential snapshots captured from the experiment of conducting the proposed HRI task with OP2 using the Soar-ROS hybrid platform. In this experiment, OP2 follows well all the six vocal commands listed in Table 1 by default as shown in Fig. 12(a) to Fig. 12(d). However, after recognizing the symbol ‘X’ as shown in Fig. 12(e), it only refuses to respond the directive, “Go”. This decision is reasonable in case the robot is standing at the edge of a table, and the ‘X’ symbol means this unsafe situation. For the robot not to be misunderstood as out of order, it says “Sorry, I cannot do it” through its speaker as shown in Fig. 12(f).
When one shows to the robot ‘O’ mark which means that the danger to the robot and/or human has been removed, OP2 resumes walking forward as shown in Fig. 12(g). Then OP2 obeys well all the commands including the finishing motion of sitting down as shown in Fig. 12(h). Even though orders of telling the six commands and showing the two marks were mixed arbitrarily, the robot responded correctly according to the given setup of moral situation based on Soar.
For the purpose of education and collaborative research in cognitive robotics engineering, source code of the present package is uploaded in the dedicated website (http://robofriend.kr/).
This study proposes integration of Soar and ROS, aiming to make robots perceive surrounding objects, reason based on predefined rules, and decide its action appropriately with the situation. The implementation for a simple HRI task is demonstrated successfully with a humanoid robot OP2.
As future work, the Soar-ROS hybrid platform will be applied to development of artificial moral agent, which will interact human both intelligently and gently with basic morality.