Communication Within Multi-FSM Based Robotic Systems

The paper presents a robotic system design methodology based on the concept of an embodied agent decomposed into communicating subsystems, whose activities are specified in terms of FSMs invoking behaviours parameterised by transition functions and terminal conditions. In the implementation phase, this specification is transformed into a system composed of a whiteboard providing communication means and logically labelled FSMs (LLFSMs) defining the system behaviour. These concepts are used to generate the code of the robot controller. The inclusion of inter-subsystem communication model completes the resulting system design with respect to our previous work that did not account for this model. Thus communication plays a central role in this presentation. The design methodology is exemplified with a rudimentary table tennis ball-collecting robot. The presented methodology and the implementation tools are suitable and beneficial for application to the design of other robotic systems.

Introduction
Good practises of software engineering require that the creation of systems involves a specification phase that defines the model of what has to be created, and an implementation phase that discloses how this is done [84]. This paper uses the specification method based on the concept of an embodied agent [54,92]. The novelty is twofold. Our first contribution is the method of implementation of robotics systems using the concepts of logic-labelled finite-state machines (LLFSMs) and whiteboards. Secondly, we show the simplicity of the transformation of the embodied agent based specification into an (executable) implementation using LLFSMs and the Cezary  School of ICT, Griffith University, 170 Kessels Road, Nathan, QLD 4111, Australia whiteboard for communication. Especially the decoupling achieved by the method of communication between the components of a robotic system is of interest here. We start with a motivation for the presented research and the structure of the paper.

Motivation
The design of a robotic system starts with the specification of its architecture. As Andrew Tanenbaum points out in his seminal work [86], the term architecture pertains to: the instruction set, memory organisation, I/O, and bus structure. This obviously refers to the architecture of computer systems. However current robotic systems are computer based, thus their architecture has the same foundation. The instruction set defines what the processing capabilities of the system, i.e. possible activities, are. The remaining elements refer to the structure, i.e. the components and their interconnections [23,55]. In the approach that we follow in our work, the structure refers to the division of the system into subsystems and their interconnections, whilst the activities are specified by a set of such concepts as: Finite State Machines (FSMs), behaviours, transition functions and their arguments, and inter subsystem communication means, all of which will be detailed later in the paper. However, in many existing robotic systems, it is difficult to determine their architecture [55]. Robot control systems are inherently complex, nonetheless their authors rarely formally specify them. Lack of a formal system specification usually results in an obscure architecture that is difficult to modify or extend it in future projects or to integrate with other systems. The process of developing robotic systems requires both appropriate development methods (procedures, architectures, etc.) and tools (modelling languages, middleware and other frameworks). Many attempts have been made to introduce formal languages based on mathematics to determine both the controller structure and its activities [18,63,90,92,96]. However, the majority of the robot systems were developed based on software engineering [16,17,68], downplaying the domainspecific information required by robotics. The proposed method of modelling and specifying robotic systems, based on the concept of the embodied agent [54,92,94], relies on such fundamental concepts of robotics as: effectors, i.e. devices influencing the physical environment, and receptors, i.e. sensors gathering the information about the state of that environment, as well as mathematical concepts underlying decision making and sub-system behaviour. However, up till now this design methodology lacked a detailed representation of a vital component: inter-subsystem communication. Hence, the present paper delves into that issue. The main purpose of this paper is therefore to present the system design methodology split into two phases, as required by good practises in software engineering. The first phase produces the system model specification based on the concept of an embodied agent, whilst the second one is the implementation phase, which first transforms the model into the composition of a whiteboard and LLFSMs as an interim implementation model that is subsequently transformed into executable robotic system controller code.

Structure of the Paper
In Section 2 the classification of communication methods from the robotics perspective is introduced. Section 3 briefly presents the concept of an embodied agent, showing both its structure and its activities. The embodied agent is the primary concept of the robotic system design method used in this paper. The universality of an embodied agent is expounded in Section 4. Section 5 describes the interim implementation model, i.e. the elements necessary for the implementation of an embodied agent, focusing on the communication aspect.
As ROS currently is the most popular robot programming framework, the comparison of whiteboard and ROS communication mechanisms is presented in Section 6. Section 7 showcases the proposed design and implementation methods on a robot collecting table-tennis balls. This example is kept concise to enable the reader to focus on the presented methods rather than being forced to deal with the complexity of the robotic system. The last section presents the conclusions derived from the presented work.

Communication
In telecommunications, the concept of the communication channel is central to the operation of a communication system [44,83], distinguishing between free propagation (broadcast, one-to-many) and guided propagation (point-topoint, one-to-one) communication types. Telecommunication deals with such characteristics of the communication channel as its linearity or non-linearity, time variability or invariance, bandwidth, or power limitation. However those physical properties are of secondary importance and can be abstracted away for communication of software implemented subsystems of robots. In the most rudimentary view, the communication model consists of the communicating systems/subsystems and the communication channel. The communication channel (the transmission medium) can be either based on technological means (e.g. wired or wireless) or use natural means (e.g. voice communication using air) [44,83]. In the latter case the environment itself can be used as a communication channel [4], then stigmergy results [12]. Both technological and natural communication channels can contain buffers, which can store the transmitted information for some time, or exist without a buffer. Transmission delays should not be treated as a capacity of the channel to store data. For communication to take place not only the transmission medium is necessary, but also a common protocol has to exist, as the transmitter and the receiver of the information must have a common understanding of the transmitted information.
In robotics, diverse communication methods have been considered. Three different types of communication between robots were discussed in [25]: two-way communication, explicit one-way communication, and completely implicit communication. This work also points out that there are several difficulties that should be considered in communication between collective robots, i.e. efficiency, fault tolerance and cost, and that in contrast to centralised communication approaches, e.g. [88], communication between robots should be distributed. Comparison of three types of communication, i.e. through the environment, using transmission of state between the agents, and utilising the transmission of the detected goal, was introduced in [8]. Similar criteria were discussed in [65], distinguishing direct (purely communicative act) and indirect communication (based on observed behaviour of other agents). Direct communication was further decomposed into one-to-one (peer-to-peer) and one-to-many (broadcasting), based on the the number of communicating entities. Another division of communication is direct vs indirect communication [34]. Direct communication occurs when a dedicated on-board hardware device is utilised, whilst indirect communication occurs through the environment. The paper also notices that indirect communication is particularly useful from the point of view of Multirobot Systems (MRS), in contrast to direct communication, which in MRS may result in much more expensive and unreliable solution. However, that paper also points out that direct communication in Multi-Agent Systems (MAS) may be used to guarantee locality of interactions and to avoid synchronisation procedures amongst agents. A similar criterion based on how the information may be obtained by robots was introduced in [75], where three types of communication were distinguished: implicit communication through the world, passive action recognition (robots use sensors to directly observe the actions of other robots) and explicit communication (robots communicate directly and intentionally through an artificial communication channel). Either way, care must be taken to avoid the hidden channel problem that results when differing temporal precedence between these means of communication creates inconsistencies between the intent of the system designer and the actual timing and order in which information is delivered [21].
Criteria pertaining to the communication range, communication topology and communication bandwidth were discussed in [24,26]. However, those criteria concern mainly physical aspects of communication, already discussed in [44,85]. Yet other criteria pertain to interaction distance (distance between the agents during the communication, i.e. direct physical contact, visual range, hearing range and long range), interaction simultaneity (period between the signal emission and reception, i.e. immediate, long time), signalling explicitness (explicitness of the emitter's signalling behaviour) and sophistication of interpretation (the complexity of the interpretation process that gives meaning to the signal) [48].
The above analysis shows that whilst similar terminology is used for the purpose of communication classification, the meaning attributed to the same names is slightly different, making it difficult to propose a comprehensive communication model. Some of the subdivision criteria are based on physical aspects of communication (topology, place, types of communication channels, bandwidth, etc.), neglecting other also very important criteria (e.g. whether the communicating entities block each other whilst sending/receiving data). Thus, to make the presentation clear, we summarise the criteria most relevant to the subject of this paper as follows. From the point of view of robot control system design, of importance is the possible number of subsystems writing to or reading from the communication channel. This leads to four communication types [39], depending on the number of message producers and the number of consumers: one-to-one (peer-to-peer), one-to-many (e.g. broadcast), many-to-one and many-to-many (e.g. multicast). An example of one-to-one communication is presented in [66] where a system composed of many robots executes a box-pushing task. Cases of one-to-many communication are presented in [7,45,65,74,76], where the consumers either utilise broadcast messages at their will or ignore them. The many-to-many communication can be organised as e.g. a blackboard system [41] or by stigmergy [12].
Another criterion worth considering is based on the location of the communication channel: inter-system or intra-system. Here the terms intra-system and inter-system need to be disambiguated. We assume that in the case of intra-system communication, the transmission occurs between nodes existing on a single computer (composed of a single or multiple processors), and in the case of inter-system communication transmission is between nodes residing on many computers. Thus in this case the word system does not refer to the robotic system as a whole, but only to the communicating nodes that are within the robotic system, located either on a single computer or on several computers forming a network. The importance of this distinction is due to each of these types of communication requiring different software and hardware means of implementation.
Still another criterium pertains to whether the producer or consumer block until message delivery has completed. Blocking producer behaviour requires the consumer to respond in order to unblock the producer, whilst in the non-blocking mode this is not required, i.e. after initiating the communication, the producer can continue with other activities. Similarly the consumer can either be blocked whilst waiting for the message or not. In the latter case, the consumer can poll the communication channel when required to find out whether there is a message for it to attend to. Still another criterion is storage, i.e. whether the communication channel contains a buffer or not. In the latter case the communication channel does not have the capability to store messages. In the former case the size and type of the buffer is of relevance. The commonly used buffer types in robotics are either queues or cyclic buffers.
Moreover, it should be noted that communication is sometimes associated with cooperation. However the former refers to the ability to transmit information between systems and the latter with the ability to jointly execute a task. Cooperation can be achieved both by using implicit and explicit communication. The former refers to a situation where the consumer of the message is not clearly defined, and thus the interpretation of the message by a consumer may be difficult (as in the case of stigmergy) and in the latter case the consumer is clearly defined, and thus the interpretation of the message using the commonly known protocol is straightforward (as is the case with the majority of technologically based channels or such natural channels as air used for voice communication). In robotics, there is a vast body of literature dealing with cooperation using implicit communication, especially stigmergy. For example [4] presents a schema based control of a multi-robot system used for common object retrieval, [81] describes robots communicating using sensors for detecting infrared radiation reflected by the environment, [87] presents robots communicating using traction forces, [25] describes robots communicating indirectly using on-board visual sensing, whilst [20] reports on the system composed of 20 e-puck robots pushing three different objects based on inputs from infrared proximity sensors, [89] describes a multi-robot system where individual robots use an adaptive behaviour selection strategy based on sensoric information about the location of the transferred object and the other robots, [95] presents multi-robot box pushing based on the detection of the motions of the translocated box. On the one hand the examples of implicit communication are abundant in the literature and on the other hand this form of communication does not influence the system specification from the point of view of communication, as it is realised by the perception subsystem. Thus this paper will limit itself to explicit forms of communication.

Embodied Agent
A single-or multi-robot system (a robotic system, in short) is represented by communicating agents [14,46]. An agent which has a physical body is called an embodied agent [14,54,94,96] -its general structure is presented in Fig. 1. An embodied agent a j (j is its designator) is decomposed into 5 types of subsystems: control subsystem c j , virtual receptors r j,k , virtual effectors e j,n , real receptors R j,l and real effectors E j,m , where k, n, l and m are the designators of particular subsystems of the agent a j [94].
Virtual receptors r j,k aggregate data acquired from the environment through real receptors R j,l . Virtual effectors e j,n transform control commands received from the control subsystem c j into a form acceptable by the real effectors E j,m . An embodied agent contains a single control subsystem and zero or more subsystems of each of the other types.
The activity of a system as a whole depends on the individual activities of its subsystems and their interactions. The activity of each subsystem s ∈ {c, e, r} is represented by a hierarchical FSM s F j,v [35], where v indicates the subsystem name. An FSM is represented as a directed graph composed of nodes and directed arcs. Each node represents a state, whilst each arc represents a state transition. Arcs are labelled by initial conditions, being predicates, which, if true, cause a state transition from the current to the state pointed at by the arc labelled by this predicate. With each state of an FSM s F j,v there is an associated subFSM s F B j,v,ω , specifying the behaviour s B j,v,ω , where ω names the behaviour. The subFSM template modelling a behaviour s B j,v,ω is presented in Fig. 2. Each iteration of a behaviour consists of calculation of a transition function and twoway transfer of data. The transition function s f j,v,ω takes as arguments the current data from the subsystem s internal memory s S i j,v and its input buffers x S i j,v , and calculates the values which are inserted into the output buffers y S i+1 j,v and the internal memory s s i+1 j,v . Superscripts i and i + 1 indicate the elapse of a single tick of the discrete time, The behaviour subsequently sends the results of calculations from the output buffers y S i+1 j,v to the inputs of the associated subsystems and acquires from them new data loading it into input buffers xS i j,v . Based on the obtained data an associated error condition s f ε j,v,β and terminal condition s f τ j,v,ξ are tested (β and ξ are their designators). The duration of a single iteration of the subsystem behaviour defines its sampling period. The iterations of the behaviour terminate when the associated error or terminal condition is fulfilled. At this moment the main subsystem FSM s F j,v resumes its activity, changing its state.

Universality of the Embodied Agent
The structure of the embodied agent and its ability to connect to other such agents, thus producing networks, enables the reproduction of other well known and studied architectures. Hence, the embodied agent can be treated as a general means for designing robotics systems. The most popular architectures employed in robotics are: Sense-Plan-Act (SPA), multi-tier (usually either two-(2T) or three-tier (3T) are used), subsumption, and the ones based on some forms of schemata. The universality of the concept of an embodied agent will be briefly justified here by showing its relationship to those architectures. Robotic system software reflects its architecture. Although some work has been done on formal specification of robot control software, e.g. [6,62,63,91,93] and its formal verification, e.g. [49,50], unfortunately this has not gained widespread adoption [56]. Usually, architectures are presented by informal text descriptions supplemented by block diagrams, with varying level of details. Early approaches to formalisation of the specification of a robotic system treated such systems as composed of computational modules and followed operational semantics in describing their structure and activities [62,63]. One of the few systems that employs formal specification and generation of code for the implementation of the lowest layer of robotic system controller is G en oM (Generator of Modules) [1,36]. It is integrated with the BIP (Behaviour Interaction Priorities) [10] framework and toolset, which is used to formally specify and verify the correctness of the produced system, treated as a real-time, component-based complex structure. However, as the majority of architectures presented in the literature is not specified formally this discussion will not rely on a formal description.
Frequently, hierarchical layered architectures are designed. One of the oldest hierarchical architectures is the sense-plan-act (SPA) structure, used for instance by the Shakey robot in the 1960s [71]. Shakey sensed its environment, invoked action planning, and then executed the thus derived plan. Later, different criterions have been used for the decomposition into layers. Usually, the time of the execution of a single behaviour iteration of a component within the layer is the discriminating factor. The higher the layer within the system, the longer the time of its single iteration execution. In some cases, task abstraction is the criterion, i.e. a single activity at an upper layer is decomposed into several lower layer activities, e.g. NAS-REM (NASA Standard Reference Model) [60]. Usually, as a consequence, the utilised ontology becomes more abstract going up the layers. The lowest layer is behavioural and is tightly coupled with actuators and sensors. The middle layer is the sequencing layer (sometimes termed as executive layer [56]), responsible for selecting behaviours that will eventually realise the task. The uppermost tier usually involves deliberation. In robotics, deliberation is associated with planning. From what has been said, it is evident that planning and sequencing layers act together to accomplish the plan and in some systems are tightly bound together (e.g. CRAM [9], CLARAty [68]), hence 2T instead of 3T architecture results. The proposed embodied agent based architecture can accommodate all of these possibilities. By design, an embodied agent forms a two tier architecture: virtual entities controlling the real devices form the first tier and the control subsystem forms the second one. Above that, a hierarchy of computational agents (embodied agents lacking effectors and receptors) can form supplementary tiers. A computationally demanding planning task can be decomposed into several parts, implemented as several interacting computational agents.
As planning is a time-consuming task, the subsumption architecture was proposed [13][14][15]. Its overall behaviour is the result of the interaction of the activities of modules, which react to input from other modules and sensoric stimulus. If lower layer reactions can not cope with the task, upper layer reactions suppress or inhibit them, taking over control, thus subsuming their actions. As the SPA architecture tends to be prohibitively slow and the subsumption architecture, although very reactive, lacks foresight, hybrid architectures emerged [5]. Those were usually designed as three tier systems (e.g. [1,38]), having: planning (deliberative layer), sequencing (usually implemented as a finite state machine governing the actions of the system), and device control layers (responsible for motor control and sensor data aggregation -a reactive layer resulting if both were combined). Behavioural systems [5,6], based on reactivity, have gained widespread attention. In order to satisfy the requirement of the fastest possible response, reactivity should be implemented at the lowest level. The shortest possible loop starts with proprioceptors and directly influences the real effector. As the activities of the reactive layer rely mainly on sensor input and to a very limited degree on internal state (i.e. memory) it is very easy to reproduce this layer within an embodied agent, where the quickest responses are organised within the virtual effector and are based on proprioceptive input. An example of this approach is the utilisation of force/torque sensing directly within the virtual effector (e.g. [97]). If a subsumption architecture [13,15] is to be reproduced, its modules can be represented by blocks within the data flow diagram definition of a transition function by using inhibiting and suppressing links (as presented in [54]). Otherwise, the modules can deliver the results of their computations into a composition unit, which will compute the final outcome, subsequently dispatched to a real effector for execution. If a slower reaction is permissible, exteroceptive input from the virtual receptors can be used by the control subsystem, which will use the same scheme of operation as the virtual effector. Thus, the same pattern will be reproduced at different levels of the control hierarchy. This can be continued at even higher levels of the hierarchy by using extra computational agents [98].
Schema Theory was formulated for the purpose of representing systems created to study both artificial intelligence and brain theory [2,3,5,62,63]. Schema Theory provides guidance to building models of animal and artificial agent behaviour, stating that behaviour is the result of competition and cooperation between schemata, which are conglomerates of knowledge and methods of processing [2]. Instances of schemas are created either by other schemas or as a reaction to sensory stimulus. Perceptual schemas process sensory input, whilst motor schemas produce action patterns. A network of schemas is called an assemblage. The overall behaviour of an agent is produced as a result of interactions between schemas composing the network. Such schemas can be embedded in an embodied agent, as virtual receptors reflect perceptual schemas, whilst virtual effectors reflect motor schemas. At a higher level, embodied agents without effectors match perceptual schemas, whilst those without receptors match motor schemas, this multi-agent networks can also reproduce assemblages. The application of Schema Theory in robotics followed different paths. One of them is described in [3,5]. In this case, motor schemas are basic units of behaviour. Motor schemas act in conjunction with embedded perceptual schemas. Concurrently acting behaviours, i.e. motor schemas, compute individual results that are composed together into the final control outcome. This architecture is easily reproduced in an embodied agent. Perceptual schemas are reproduced by virtual sensors. The control subsystem implements a behaviour that is parameterised by a transition function which in turn is decomposed into concurrently computed functions that define the computations of individual motor schemas. The transition function composes the results produced by partial transition function into an outcome that is dispatched to the virtual effector. A more formalised approach to Schema Theory is called Robot Schemas (RS) [63]. RS form a formal model of distributed computing in the robotics domain. The model is built of concurrent computing agents, each being a Schema Instance (SI). SIs communicate through ports, with which data types are associated. At SI instantiation time, its ports are connected to the ports of other SIs. Communication occurs when an SI writes to one of its output ports. Basic schemas are defined by the port connections, local variables and the procedural behaviour section, which specifies how the schema reacts to input. Basic schemas, once initiated, iteratively execute the behaviour section, synchronously reading or writing to ports, performing computations on local variables and input ports and instantiating and deinstantiating other SIs. Complex schemas, i.e. assemblages, are a recursive composition of basic schemas into ever more complex ones. Assemblages do not have the behaviour definition part, as that is defined by the schemas they are composed of. Only the port connection part exists. SIs form a dynamical network which grows or shrinks as the activities of the system take place. The task is represented as the outermost assemblage. Thus, the system is composed of sensory schemas, motor schemas and schemas that connect them, i.e. task schemas. In general, this reflects the structure of an embodied agent or can be reproduced as a network of embodied agents with some of their internal components missing. It should be noted that the design of an RS-based system focuses on computation, however this involves also instantiation and deinstantiation as well as communication, all considered at the same computational level. Thus, the basic level is flat and all aspects of system activities are entangled, hence intelligibility is sacrificed. Hierarchy emerges from assembling lower level schemas into higher level ones, but as the design principles of the lowest level are not expressed explicitly the creation of such systems is difficult. An embodied agent introduces a hierarchy of concepts starting from the lowest level: transition function and terminal condition (purely computational), behaviour (adds communication), FSM (selects behaviours), subsystems (distinguish perception, action and task control), agents (form networks of any size). Each of those concepts can be dealt with separately, thus it is easier for the designer to focus on a single entity at a time, simplifying the process of system creation. Systems composed of embodied agents, besides being capable of reproducing the well known architectures, can be used to create other architectural patterns [94,98].

Implementation of an Embodied Agent
The architecture of an embodied agent presented in Section 3 is implemented using several earlier-mentioned concepts. Here we shall concentrate on two important ones associated with the communication and behaviour selection [31]: the whiteboard, which is used as the main communication means between subsystems, and Logic-Labelled Finite State Machines (LLFSMs), which govern the actions of each of the subsystems present in the agent, including the exchange of information between subsystems. The whiteboard is our implementation of the general concept of a blackboard [42], thus whenever we refer here to the former we refer to our implementation and for the general concept, the latter is referred to.
The concept of a blackboard was created for the purpose of studying artificial intelligence (AI) [69]. The blackboard model consists of three major components [22,43,70,82]: knowledge sources (KSs) -corresponding to the domain experts, blackboard data structure -the global resource where information to be shared is written, and control mechanism -responsible for processing the knowledge contained in the blackboard and ensuring that only one domain expert has access to the blackboard at a given time. The blackboard can be any data structure accessible by all the KSs. Each KS operates in the following sequence: reads the information from the blackboard, acts based on the information found and writes its conclusions and hypothesis into the blackboard. The work on blackboards in AI concentrated on several aspects: the organisation of knowledge data structures, reasoning utilising those data structures as well as providing access to them. The concept of the whiteboard focuses on data access. The use of data-centric communication similar to blackboards has transcended AI and found its way into the wider software engineering community. The Data Distribution Service (DDS) is a standard formulated by the Object Management Group (OMG), implementing Data-Centric Publish/Subscribe (DCPS) communication model [40,58]. The main purpose of DDS is to assure dependable communication in dynamic, networked environments between distributed producers and consumer fulfilling real-time constraints. Whiteboard implements the pull approach, whilst the DDS, which is based on Publish/Subscribe model, is based on the push approach.
Blackboards have also been used in robotics.
The following examples show only a fraction of the diversity of their applications. A reconfigurable mobile robot used a blackboard enabling a horizontal system decomposition allowing the cooperation between all the subsystems considered as knowledge sources executing a specific task [72]. The CrunchBot [37] used a Bayesian blackboard to solve the mapping problem for a mobile robot equipped with whisker sensors. Autonomous mobile robots dealing with hazardous material spill emergency situation used a blackboard system to integrate information from various sensor-based and knowledge-based subsystems [73]. Those examples and the plethora of other works on the utilisation of blackboards in robotics show that the effort has concentrated on either different aspects of knowledge processing or on providing a balanced access to knowledge to all involved actors or on both. The concept of a whiteboard is derived from blackboards, however it focuses on information sharing, thus the communication aspect. The contents of the whiteboard is of secondary importance as is the purpose of information processing. The focus is on providing efficient communication means. A similar communication concept was introduced in [1], namely a poster. It uses shared memory for the purpose of communication. A poster is a structured shared memory only writable by its owner and readable by any element of the architecture. Posters are completely independent from each other. They are not regions of a common blackboard and cannot be written to by many producers, thus they do not have all the properties of a blackboard. A whiteboard has all the communication abilities of a blackboard, so it is more general than a poster.

Whiteboard
The gusimplewhiteboard (Griffith University Simple Whiteboard) is a library for organising inter-process communication [31]. It implements a mutation of the general blackboard concept [42]. It enables the transfer of C++11 objects through shared memory. As it is linked in, no broker is necessary. The message transfer is idempotent, i.e., if the transfer is repeated the result does not change. No queues need to be involved, however, if necessary, they can be organised, as the whiteboard does not determine the data structures it will be storing -this is the choice of the system designer using the whiteboard.
Shared memory communication exhibits certain advantages over the traditional approach taken by, e.g. ROS messages and services, [47]. Producers and consumers use local instances of classes to communicate. When a producer sends a message, it copies an object containing the message from its local store to the static instance of the class in the gusimplewhiteboard. When a consumer wants to retrieve the message, the current instance of the object in the gusimplewhiteboard is transferred to the local memory of the consumer. When operating in a distributed system, a UDP-based sharing algorithm that also makes use of the Time-Triggered Architecture (TTA) [52] is used to broadcast data to other receivers [61]. The implementation of the distributed version of the whiteboard uses efficient, fault-tolerant communication for distributed systems as presented in [11,51,57] [52,53]. Compared to the DCPS [58], the whiteboard does not offer inherent mechanisms for distributed reconfiguration, but offers a statically defined data classes and O(1), fail-silent communication within bounded real-time constraints [31]. A more detailed discussion of the networked version of the whiteboard [61] is presented in Section 6.

Communication Model
The blackboard can be considered as a broker, which enables the producer to depose in it, in a non-blocking way, whatever data it has to send out, whilst the consumer may act in one of the following modes. Either it acts in the push mode (similar to the DCPS), where the blackboard invokes a specific function of the consumer-subscriber, thus notifying it of the arrival of new data, or in pull mode, where the consumer accesses the data when it requires. The former usually involves queuing of messages, whilst the latter implies the delivery of only the most current data. The push model implies close coupling of modules, where the subscriber must react to all messages issued by the producer [30]. In the pull model, the components are decoupled, the consumer may react in its own time, and only to some of the produced messages. In both communication models, the publisher introduces a message into the blackboard. In the case of the push model the blackboard notifies the consumer that the message it has subscribed to is available and the subscriber invokes a call back function in response. The messages are queued, so the consumer should somehow react to all of them. An event driven architecture results. It relies on an assumption that there is enough of computational power to handle the messages as they come. However, in the case of the pull model, such an assumption is not necessary. The consumer is not notified about the arrival of a new message. When the consumer needs the new message it retrieves form the blackboard the most current one, neglecting the obsolete ones (in reality usually they will even not be available). The publisher and subscriber are very loosely coupled, without assumptions as to the available computational power, and thus the ability to respond timely to the incoming stream of messages results. Obviously, the pull model works on the principle that we get a better response, if the system at any moment uses the most current data. Both the publisher and the subscriber act with their own frequencies, without having to synchronise their activities. This way, no global timing schedule is required, fully decoupling the development of both components. The pull model is immune to messages being lost by definition, as it does not require response to every message, whilst the push model requires delivery guarantees, because every message attracts attention. The majority of middleware utilising the concept of a blackboard still relies on the push model. For instance, ROS topics act in push mode. However the blackboard provides an opportunity to base the communication on the pull model. Whilst the proposed whiteboard can be used in both push and pull modes, the latter should be the method of choice. In the majority of middleware, the structure of the contents of the messages transferred is limited, whilst in gusimplewhiteboard any C++11 objects can be used [31].

LLFSM
LLFSMs are FSMs, in which transitions from one state to another state are based on the fulfilment of logic expressions rather than events. As events are usually queued and logic expressions are computed just on the basis of current data, as is more appropriate for robot control, this form of an FSM is preferred. In the implementation presented here, the LLFSMs, in principle, operate concurrently, but in reality are scheduled sequentially, thus critical sections and synchronisation points become unnecessary. This inherently removes the possibility of race conditions. The communication between LLFSMs uses whiteboards. The utilised LLFSMs are synchronous automatons. With every state, three portions of code are associated: the code that is executed on entering the state, the exit code invoked when the logic expression with one of the outgoing transitions (directed arcs) is satisfied, and the code that is executed when none of those logic labels is true, hence the execution of this code may be repeated many times.
The LLFSMs can be composed hierarchically. Each LLFSM can be suspended, thus enabling the execution of a subLLFSM. It can also be restarted from the state it was suspended in or restarted from its initial state 1 . The subLLFSMs act like subprograms and need not act simultaneously -this prevents state replication [19]. The higher level LLFSM becomes dormant during the actions of the subLLFSMs, increasing the degree of determinism of the system performance.
From what has been said here, it is evident that the implementation of both the subsystem FSM s F B j,v and the behaviour subFSM s F B j,v,ω (specifying the behaviour s F j,v,ω ), as LLFSMs is straightforward, as the directed arcs of those FSMs are labelled by predicates, i.e. logic expressions, hence their equivalence is ascertained.

Scheduler
An embodied agent is composed of one control subsystem and usually several virtual effectors and receptors. Each of those subsystems is governed by one FSM -here implemented as an LLFSM. The proposed solution schedules sequentially the LLFSMs representing producers and consumers, thus minimising the problems of determining the delays in servicing the transfer of data. The majority of middleware, e.g. ROS, Microsoft Robotics Studio, relies on concurrency, data queuing and the non-deterministic TCP/IP suite. Hence real-time performance is compromised. Deterministic scheduling has the following advantages over the non-deterministic multi-threaded approach. Full concurrency, where switching between threads is operating system dependent, is much more difficult to envision and correctly apply by the robot control system designer, as it necessitates: thread synchronisation, vigilance of nondeterministic communication delays, managing critical sections, problems with fairness as well as avoiding deadlocks, live-locks, and starvation. Moreover, CPU context switch overhead has to be taken into account. The sequential LLSFSM switching procedure enables fairly simple formal correctness verification of models, as it avoids the usual combinatorial explosion of concurrent threads. The sequential switching is time-triggered in contrast to the frequently used eventtriggered approach, where due to peak-load situations it is often impossible to assure reliability. Specifications using LLFSMs constitute executable models that can be formally verified. A more detailed treatment of this subject can be found in [29,32,33].
Each iteration of an LLFSM operation starts with reading the relevant variables from the whiteboard and it ends with depositing the results of computations in it. Each iteration is treated as atomic, thus no inconsistencies can arise. The LLFSMs are executed in a round-robin fashion one iteration of each LLFSM at a time.
To show how the scheduler works in conjunction with the LLFSMs, a simple example is presented here. It is assumed that within the robotic system, only two subsystems v and h exist, where v and h are the specific names of the subsystems. The exemplary activities of each subsystem may be represented by hierarchical FSMs: s F j,v and s F j,h , presented in Fig. 3.
With each FSM state a behaviour is associated. It is represented as a subFSM based on behaviour template from Fig. 2. For simplicity it was assumed that the terminal Fig. 3 The activities of two subsystems v and h of a j condition of each behaviour is always fulfilled, whilst error condition is not. This implies that all behaviours are executed only once in each state of the FSM. The functioning of the scheduler is presented assuming that initially FSM s F j,v is in the state S 1 j,v and the FSM s F j,h is in the state S 1 j,h . The scheduler activates one state of each FSM or subFSM at a time, switching between all FSMs and subFSMs. Obviously this causes the execution of the code associated with that state. In this case the scheduler starts with state S 1 j,v of s F j,v and then switches to 1 of the subFSM executing the behaviour s B j,v,1 , so this will be the next state activated by the scheduler. The fourth state activated will be S 1 j,h,1 of the subFSM s F j,h,1 . The full switching sequence for both FSMs s F j,v and s F j,h and their subFSMs executing behaviours is presented in Fig. 4.
Whiteboard communication in conjunction with this way of switching the LLFSMs by the scheduler avoids deadlocks, because only one FSM accesses the whiteboard at a time. Moreover, because the variables contained in the whiteboard are located in cyclic buffers, always there is available data that can be accessed, alas not always the most current.

Communication Organisation
As in many cases, the example that follows requires only intra-system communication between subsystems. Whilst the utilised whiteboard is capable of providing inter-system communication [61], this is not our focus here. It should be noted that the whiteboard intra-system communication gives real-time guaranties (when the underlying operating system is real-time), whereas the inter-system one would depend on the network protocol.
The whiteboard is a table with slots. Each slot creates a separate communication channel containing a cyclic buffer. Hence, buffered communication based on a cyclic buffer of limited size is realised. The whiteboard as a whole supports concurrent many-to-many communication, but a message slot (buffer) with multiple producers requires locking and is therefore not recommended. We therefore recommend one-to-one or one-to-many communication, which is lock-free with O(1) complexity for access operations. In the following example one-to-one communication will be utilised. The LLFSMs together with the whiteboard enable the implementation of both blocking and non-blocking communication modes both in the case of the producer and the consumer. However, in the presented example both the producers and the consumers operate in the non-blocking mode. In the experiment, a single sequential scheduler is used, thus subsystem LLFSMs are executed sequentially.

Comparison of Whiteboard and ROS Communication Mechanisms
Initially, ROS was designed for large service robot control software, which was meant for implementation on several computers connected via Ethernet [78], thus ROS was in fact designed for communication between computers. However later it was mainly used for communication within a single computer. Hence below we introduce ROS communication mechanisms provided for a single computer and compare them with the whiteboard approach.
ROS uses: topics, services, nodelets, and a parameter server. Those communication concepts may be utilised only for certain types of communication (based on the localisation of the communicating nodes), i.e. inter-process and intra-process. The inter-process communication occurs between ROS nodes (implemented as processes) utilising TCP/IP server socket [80] and peer-to-peer topology, which requires some sort of lookup mechanism to allow processes to find each other at runtime. This mechanism is implemented as the ROS master [78]. ROS nodes may communicate with each other utilising topics, services and parameter service.
A ROS topic is a named bus implementing communication between nodes. Communication between two nodes may only occur if both nodes exist and are already registered with the ROS master (utilising Remote Procedure Call (RPC)). Nodes communicate utilising TCP. Since a ROS topic uses a publish/subscribe mode of operation, thus it implements the push paradigm, which forces the subscriber to act in an event-driven fashion. Events are deposited into the middleware which relays them to call-backs from the subscribers. It is assumed that there will be sufficient computational resources to enact all the threads generated and to execute the subscriber callbacks. An additional assumption is that events would occur with enough sparsity that the call-backs would be completed by the time they are executed again or alternatively require handling of concurrency issues. This event-driven approach also results in coupling and has timing consequences. The push approach compels the subscriber to keep up with message reading in order not to lose any data, even if a specific update rate is not necessarily convenient for the subscriber. In congested systems using TCP, if the acknowledgments do not reach the publisher on time, the packets will be retransmitted, thus the subscriber will eventually be flooded with repeated packets [77]. This means that the subscriber activity is tightly coupled with the publisher update rate. Additionally, the push approach assumes that the subscriber reacts to transmitted data immediately (otherwise data is queued), thus the data is presumed to be fresh and as recent as possible, what might not be the case. This will result in reaction delays. The negative influence of such delays on the performance of a drone are presented in [47]. Timeliness, sequencing and reliability of the data are taken for granted. Such scenario is very optimistic, which in fact, does not occur in reality often. Therefore, it requires that the producer must eventually be slowed down or complex handshaking protocols must be deployed, otherwise the data will be lost [30]. The push paradigm, used by topics, does not assure idempotent transfer of messages, thus an additional effort must be done to ensure that the data was received exactly once [30].
The ROS service is a simple RPC, thus the client is blocked until it obtains the response from the server. This type of communication has three additional features. It uses only plain old data (POD) structures, collections of basic types, thus object oriented concepts using inheritance and polymorphism can hardly be modelled [27], whilst the approach based on whiteboards implements object oriented approach [30]. Additionally, ROS service forces clientserver relationship between the two communicating nodes, possibly resulting in delays due to waiting for the server reply. Moreover, the ROS service again uses the TCP/IP communication protocol.
Parameter server is the last of the inter-process ROS communication concepts for intra-system inter-process communication. It is a shared, multi-variate dictionary stored in the ROS master. It is accessible by nodes via network APIs. However, it was not designed to be highperformance, as it is to be used for static data such as configuration parameters [79].
Nodelets are threads that use intra-process communication of ROS. Data is exchanged between nodlets executed within the same process by sharing memory. However, the developers have to take care to avoid contention due to concurrent access to the data, e.g. by using mutexes or by allocating new memory whenever new data is written. This again results in a large performance penalty as shown in [27].
There exist robotic systems that have special communication requirements. In some of them, both the producer and the consumer should be able to operate in a non-blocking fashion (i.e. the communicating nodes should be decoupled), as blocking implies possible lack of reaction from the system, when such a reaction is necessary. The communication should be capable of operating in the time-triggered mode, because in this mode of operation the system can react both to the message and its lack (usually those reactions are different), i.e. lack of a message is also a message. It is required that the communication be low latency and low jitter in the case of intra-system transmission, as quick reactions to events occurring in the environment may influence the survival of the robot. Finally, communication should be implemented in the same way both for threads and processes, because the imposition of single process system structure (even with many threads) is not acceptable, i.e. multi-process implementation is treated as an advantage.
None of the four ROS communication methods fulfils all of these requirements. The parameter server introduces high latency. ROS services use RPC, thus they block both the producer and the consumer. In the case of ROS topics, the consumer is activated by an event associated with the producer depositing a message in the communication channel, thus communication is event triggered, not time triggered. However non-blocking operation of the consumer using ROS and C++ can be realised through a separate thread dealing with acquisition of the message and using nodlets -rather a complex solution introducing significant communication delays. Unfortunately, nodelets can be used only for communicating threads, but not processes. As none of the ROS communication mechanisms satisfies the above-mentioned requirements, the whiteboard was chosen (in fact, a ROS package for the whiteboard is available at [67]). This approach provides intra-system inter-process communication, which does not block neither the producer nor the consumer; as it operates on common memory it is very low-latency [31,47]; by using the pull mode of operation it operates in time triggered mode; and moreover it can be used both by threads and processes in the same fashion.
If whiteboards could be used only for intra-system communication the proposed approach would not be scalable. However there exists a network implementation of the whiteboards [61], but here the latency introduced both by them and ROS are similar. In general, network based implementation of the concept of the whiteboard requires that each computer in the system instantiates its own whiteboards. One of those whiteboards contains variables for local communication whilst the others reflect the variables in the remote whiteboards. The latter variables are updated periodically broadcasted to other computers in the network utilising the UDP Bridge module. The UDP Bridge module is used for all network connectivity and connects directly to the shared data structures of the whiteboard. The UDP Bridge can either be run as an independent process (for debugging purposes) or can be started as a thread by an instance of the Remote Whiteboard class. The UDP Bridge has three main components: Listener -listening for incoming packets, Broadcaster -broadcasting packets when scheduled, and Manager -interacting with the whiteboards. Due to the fact that whiteboars contain cyclic buffers that are transmitted as a whole, even if (due to the use of UDP) a transmitted message is lost, in the next transmission period both the most recent data and previous data will be delivered.

Experiment
The robot system design methodology described in, e.g. [92], utilising hierarchical FSMs [35], has been applied to the design of the control system of a mobile robot collecting table-tennis balls. The robot (inspired by [64]) uses a suction mechanism to collect table-tennis balls and a camera to detect them, as well as a sonar to avoid obstacles. Based on the estimated ball position, the robot moves in the direction of the closest ball and vacuums it into its container. This simple, yet useful, robot is used here for the purpose of exemplifying the proposed general robotic system specification method and the implementation of the resulting system. Both the system architecture and the behavioural approach used resemble the well known solutions presented in Section 4. As the purpose of the example is the presentation of the proposed specification and implementation method, a well known architectural solution and control paradigm have been used, to enable the reader to focus only on the methodology.

Specification
The specification describes both the structure of the designed system and its activities. For the purpose of briefness, only relevant excerpts from the full system specification are presented here. Only a single behaviour of the control subsystem is specified formally here to provide an example -the others follow the same pattern.
Structure It suffices to represent the structure of the ball collecting robot (bc) by a single embodied agent a bc (Fig. 5). This agent contains: the control subsystem c bc and four Fig. 5 Embodied agent representing the table-tennis ball collecting robot virtual subsystems: r bc,cam , r bc,sonar , e bc,body , e bc,vacuum and four corresponding real subsystems: R bc,cam , R bc,sonar , E bc,body and E bc,vacuum . The real receptor R bc,cam detects balls, whilst the real receptor R bc,sonar detects obstacles. The real effector E bc,body controls four motors to which wheels are attached (a skid-steering mobile platform is used), whereas E bc,vacuum controls the vacuum cleaner providing suction. R bc,cam acquires images of the environment and sends them to the virtual receptor r bc,cam , so that it can detect table-tennis balls and subsequently inform the control subsystem c bc whether it detected at least one ball. If a ball is detected r bc,cam sends to c bc an estimated position of the ball within the image space. R bc,sonar provides to the virtual receptor r bc,sonar the measured time (i.e. interval between the emission of the ultrasonic signal and receiving its echo), based on which it calculates the distance to the obstacle. Next it sends the information to c bc whether an obstacle was detected. The c bc commands both virtual effectors e bc,body and e bc,vacuum using the information obtained from r bc,cam and r bc,sonar . Finally e bc,body controls E bc,body , whilst e bc,vacuum controls E bc,vacuum .
Each subsystem has its own input, output and internal buffers. Below only those control subsystem c bc buffer contents are introduced, which are relevant for this partial presentation of the specification. -Input buffer r x cbc, cam: ball det -ball was detected or not; x, y -X and Y coordinates of the detected ball centre (in pixels) w, h -image width and height (in pixels) r -detected ball radius (in pixels) Activities The behaviour of a bc is defined by the activities of its subsystems and the interactions between them. The activities of c bc are defined using a hierarchical FSM c F bc presented in Fig. 6. Each state of the FSM c F bc is associated with the corresponding behaviour: c B bc,search (robot searches for the balls within the environment), c B bc,collect (robot collects balls) and c B bc,avoid (robot avoids obstacles). Each behaviour is modelled using the general behaviour template presented in Fig. 2 The internal memory contains only constants, thus it does not require a transition function. The virtual receptors do not have input buffers fed by the control subsystem, thus those transition functions are not needed.
The partial function (1) calculates the parameters of the control commands for e bc,body and e bc,vacuum . In every iteration of the behaviour, c B bc,collect a new desired velocity of the robot is calculated using the function calculate vel, which takes into account the size of the detected ball image. Using the X coordinate of the the centre of the ball with respect to the centre of the image, an offset is computed that is used to navigates the robot towards the ball.  Other two behaviours are specified similarly. Behaviour c B bc,search is responsible for moving the robot in search for the balls. It terminates when either a ball or an obstacle is detected. Whenever an obstacle is detected behaviour c B bc,avoid is invoked. It uses the bug algorithm [59] for obstacle avoidance. All other subsystems of a bc , i.e. virtual receptors and virtual effectors, are governed by single state FSMs. The associated behaviours execute in their endless loops the subFSM template presented in Fig. 2 (thus the terminal conditions of those behaviours are always false). The virtual receptor r bc,cam executes the behaviour r B bc,cam,detect . The transition function of this behaviour uses the RGB image loaded into the buffer R x r bc,cam connected to R bc,cam , transforms this image into the HSV space, cheques whether pixels are in the appropriate colour range, erodes the image, dilates it, finds contours, cheques the shape of the detected contours, assuming that all circular contours represent balls, so the one with the largest circumscribed area is used to calculate the estimated ball position within the image space. Thus the transition function is defined as a composition of the above functions, as a result producing a pure function (no side effects are involved). This is an intrinsic property of all transition functions. Virtual receptor r bc,sonar executes r B bc,sonar,detect . Its transition function calculates the distance from the obstacle, based on the measured time of flight received from R bc,sonar . The virtual effectors: e bc,body and e bc,vacuum execute: e B bc,body,move and e B bc,vacuum,set , respectively. e B bc,body,move using its transition function transforms the commands received from c bc into PWM values and sends them to E bc,body . e B bc,vacuum,set transforms the commands obtained from c bc to an appropriate PWM value and dispatches it to E bc,vacuum . Only two states of the vacuum cleaner are considered: turned on or off, thus PWM is either of maximum value or zero. The intra-system communication between subsystems of a bc is realised as one-to-one communication. The communication between c bc and its virtual subsystems uses cyclic buffers. Both producers and consumers use nonblocking mode of operation, thus subsystems must react appropriately to lack of new data.

Implementation
The above defined subsystems are implemented using the MiCASE modelling tool [28]. It enables the high-level specification of the activities of the software-implemented subsystem (i.e. control subsystem and virtual subsystems) using hierarchical LLFSMs that constitute an executable model. To this end, a slight modification of the original FSM s F bc is required [35]. Each s F bc is implemented as s F bc . The transformation of c F bc , presented in Fig. 6, into its implementation version c F bc , presented in Fig. 7, is straightforward. Each state of c F bc , denoted as S ω bc (ω is the designator of the behaviour associated with the considered state of c F bc ), is implemented as a pair of consecutive states of c F bc : the original state org S ω bc (depicted as a rectangle   The ball collecting robot system requires five FSMs, because it contains five software subsystems. Additionally, for each behaviour within each subsystem an additional subFSMs must be produced. Thus in total there are 12 FSMs/subFSMs. Each of them is governed by the same, single sequential scheduler, switching their activities. The communication between subsystems is implemented using the whiteboard [30].

Robot Hardware
The table-tennis ball collecting robot (Fig. 8)

Performance of the Communication within the Robot
If a real-time operating system is used, the execution times of particular behaviour steps are as presented in Table 1. The produced system requires both intrasystem communication (i.e. between c bc and virtual subsystems) and access to the hardware (i.e. between virtual subsystems and the real subsystems). Communication with the hardware is organised as either: send operations of behaviours e B bc,body,move and e B bc,vacuum,set , or receive operations of behaviours r B bc,cam,detect and r B bc,sonar,detect . Hardware access uses standard driver interfaces whilst intrasystem communication utilises the whiteboard. The former communication uses USB serial port which introduces significant delays, hence those send/receive operations may take even several milliseconds. In the latter case, the messages are transferred using shared memory, thus the time required for execution a single send/receive operation is at the most 39μs (10μs+29μs). The hardware out of which the simple robot was built to present both the design method and the software used for the implementation of the controller was inexpensive. The camera enables image acquisition at the rate of 30 Hz. Thus the virtual receptor r bc,cam collects data every 34 ms. The balls are detected by the camera at a maximum distance of 2.5 m. The sonar enables the detection of obstacles in the range 2-400 cm, thus due to the velocity of sound in air, a data sample is obtained every 60 ms. As the maximum velocity of the robot is 0.25 m s , the robot is able to stop and change the direction of motion well ahead of possible collisions. The decisions as to the selection of the nearest ball to collect are also made well in advance, so the robot does not have to veer overly rapidly. The balls scattered between obstacles were collected efficiently.

Conclusions
This paper extends the robotic system design methodology (presented in e.g. [35,92,96]) by inter-subsystem communication model [31]. It assumes that the activities of each subsystem and each of their behaviours is represented by a LLFSMs. The communication between the subsystems takes place in specific states of the resulting hierarchic FSM, being the composition of the higher level FSM defining the task of the subsystem and the lower level ones governing the execution of this subsystem's particular behaviours. The subsystems in those states access the whiteboard, providing or acquiring the necessary data. As the scheduler switches the hierarchic FSMs sequentially no contentions arise. To refer the proposed communication model to the state of the art, a classification of communication methods from the robotics perspective has been introduced.
The choice of LLFSMs and the whiteboard as an implementation means for the proposed specification method was dictated by the fact that the specification method utilises the concept of FSM and transition function embedded in a behaviour, which organises the communication, i.e. the concepts into which it was easy to translate the specification. Importantly, the whiteboard ensures reliable access to data. The whiteboard gives precise communication semantics in terms of bounded timing as well as atomicity. Moreover always the latest readings are delivered and no buffer overflow occurs due to the use of a cyclic buffer. If only one scheduler is employed the LLFSMs ensure reliable sequential execution of the behaviours of the subsystems. Multischeduler implementation on a multi-processor system is also possible, but then contention resolution has to be used.
However for simple one-computer implementation of the system this is not necessary. The presented implementation approach ensures that at a given time only a single subsystem is active so there is no contention regarding data access.
An embodied agent is a set of subsystems communicating with the control subsystem utilising the whiteboard as a communication means. The constraint imposed on the internal structure of an embodied agent, which requires that all virtual entities contact only the control subsystem, limits the internal number of communication links. Each subsystem of an embodied agent is implemented as a separate process. An additional agent added to the system linearly increases the number of utilised processes. The number of new connections required within the system is equal to the number of the subsystems within the embodied agent and usually low number of interconnections of the added agent with the already existing agents, thus is scalable.
Embodied agents can be implemented not only by using LLFSMs and the whiteboard, but also by utilising OROCOS components, however the transformation procedure is not that straightforward. OROCOS is a component based robotics framework, where each component encapsulates an executable algorithm (primary code). Within the component there exists an Execution Engine, which processes asynchronous operations, calls plug-in functions and executes the primary code, when the component is in a running state. The FSM is related to the states of the component (pre-operational, stopped, running, exception etc.) not the states of the executed tasks. Thus, the FSM within the component is completely different from the FSM in the embodied agent. The former changes the state of the component, and only the running state is of relevance to us, as only in that state the task is executed. In the latter case, the FSM is related to the states of the task execution. With every one of those states a transition function parameterised behaviour is associated. Thus, if a subsystem would have to be implemented as an OROCOS component both the FSM and the behaviours would have to be recreated within the primary code. Hence no benefit is obtained. Our multilayer structure is being flattened within this code. The other method of using OROCOS is to associate a component with a behaviour. Then the primary code would represent a transition function. However then the subsystem FSM would have to be implemented by an extra component marshalling the other components (i.e. it would play the role of a scheduler). The activity of the agent would have to be produced by still another component executing the FSM of the control subsystem. However in such a system, not only the communication between subsystems would have to be organised, but also between behaviours (behaviours of subsystems of embodied agents have access to all the input, output and internal data of that subsystem). Thus, data transfers between behaviours would have to be arranged through ports, which was not the intention of the model employed by embodied agents.
Both the utility of the design methodology and the employed communication method have been presented on a rudimentary robot searching for table-tennis balls. The system was implemented by using the MiCASE tool [28]. It enables both modelling of the activities of the designed system and automatic code generation, resulting in an executable, high-level behaviour model. The resulting robot control system functions as specified.


extfieldsofstudy:
Physics
Computer Science

text:
Part Attentioned Fine-Grained Categorization Using Context Sensitive Flow

It is difficult to recognize fine-grained objects (e.g., dogs or cars) because of the challenges of difficult region localization and fine-grained feature learning. Current approaches neglect the fact that local context feature and global feature are mutually correlated and thus it is possible to use the related information from each other. In this paper, we propose a novel multiple scales attention fusing convolutional neural network which can learn region-based feature and discriminative object attention and at multiple scales in a mutually improved way. The learning is composed of several scales which consist of a classification sub-network and an attention fusing module. A Lrefine loss was proposed to refine the second sub-network category performance. We do some overall experiments and show that our proposed method achieves the best performance in two fine-grained tasks, with relative mean accuracy gains of 2.2%, on CUB Birds, and Stanford Cars.

Introduction
Fine-grained categories technology based on deep learning techniques (e.g., classifying bird species, dogs and flowers [1][2][3]) has attracted a lot of attention. Recently, a lot of research was made to improve accuracy on an increasing number of object classes [4]. In contrast to general object recognition, it is very challenging to classify the fine-grained categories (e.g., different grebe species) and it can only be recognized by domain experts. Different from traditional recognition, localizing and classification are the basic function of fine-grained image recognition which can different the very subtle visual differences within each sub-categories, and thus can benefit a lot of applications, such as complex image captioning, expert-level image recognition [5], and so on.
Recognizing fine-grained objects can be divided into two steps: locating the discriminative regions and extracting fine-grained feature from the located regions. Previous research has made state of the art progresses by using mixed part-based object features, which include two steps: 1) identifying different object part regions by differing convolutional responses from feature map in an unsupervised method or by using supervised labels, and 2) extracting significant feature representations from each part of object and using fused compact vectors for classification. Although a lot of perfect results have been reported, it is possible to achieve further improvement by eliminating the following limitations. First, it is not optimal for existing unsupervised methods to learn human-defined regions or the regions for machine classification. Second, the subtle visual differences existed in local regions from similar fine-grained categories can be difficult to learn. Third, context features were not used to learn discriminate feature. We found that adjacent parts region feature fusing can be used to improve feature discrimination, global features and local features learning are mutually correlated and thus can enhance each other. In this paper, we proposed a new research sub direction by introducing and evaluating a new deep part features fusing framework and adding a context sensitive loss to supervised improve different context features relation. Our main contribution is a formulation of the new deep feature fused architecture, called FFCSnet, which consist of two main components: a new part feature fused attention net and a context sensitive loss. We organized the rest of the paper as follows. Section 2 the related state of the art work was reviewed. Section 3 we proposed our method. Section 4 provides the experiments for evaluation and analysis, followed by the conclusion in Section 5.

Related Work
Researching on fine-grained object recognition can be divided into two dimensions: learning discriminative feature representations and locating the different prominent parts.

Discriminative Feature Learning
Learning the powerful convolutional deep features was used by most of the methods, which have shown great improvement than traditional hand-crafted features on both general and fine-grained classification [6]. In [7], a deep residual network consisting of 152 layers CNN was proposed by concatenating residual feature which can learn stronger feature representation, and the error rate was reduced to 3.75% on ImageNet test set. Due to the success of deep learning, a lot of methods was developed for fine-grained object classification [7]. The main thinking of these approaches was to distinguish subtle differences among similar subcategories by finding the different context structure of different object parts existing in different fine-grained classes.
Recently, a bilinear structure was proposed to compute the mixed pair features by using two independent CNN branches to capture context semantic information, learning discriminative features is crucial to recognize fine-grained different objects, which has achieved the perfect results in fine-grained bird classification [8].

Difficult Part Localization
Previous works mainly focus on using the extra supervised information of bounding box and part annotations to discriminate different regions in fine-grained recognition [9]. However, it is impossible and not practical to get the exactly correct manual annotations large-scale real problems. Recently, a lot of advanced researchers aimed at a more general scenario and proposed to use unsupervised information to mine region attention. Spatial transformer [10] takes one step further and proposes a dynamic mechanism that can actively learn the transformation in an image for improved classification. Whereas, it is still difficult for existing models to exactly localize subtle regions due to their small sizes.
Our approach is related to existing work aimed at deeply fusing different object parts using no supervision labels and context features. For example, informative object parts are learned without needing part annotations by augmenting an existing CNN architecture with a differentiable spatial transformation module. In contrast to these methods, our FFCSnet consist of two main components: a new part feature fused attention net and a context sensitive loss, discriminated features can be achieved by attention fusing and context sensitive loss.

Proposed method
In this section, we will introduce the proposed part based attention convolutional neural network for fine-grained image recognition. We consider the network with one whole scale and one part scale as an example in Figure 1, and finer scales can be stacked in a similar way. The inputs are full-size images in whole branch net to part discriminative regions in part branch net, where the part branch takes the input as the attended regions from the whole branch, respectively. First, images at different scales are fed into convolutional layers to extract region-based feature representation. Second, the CNN network proceed to predict both a probability score by fully-connected and softmax layers and a part region selection attention by an attention proposal network. The proposed network is optimized to  Fig.1.The CNN consists of one whole and one part scale branch It is important to mutually improve the learning for both localization and classification which can take advantages of the deeply trained networks. In this paper, we propose a self attention study network (SASN) and it is free to compute the region attention, the SASN can be trained end-to-end without supervision. We implemented an element-wise multiplication for the cropping operation between the input image at the whole scale and an attention mask, which can be formed as: ⨀

Part Based Attention fusing CNN
where ⊙ represents element-wise multiplication, Xatt denotes the cropped region in figure 1, M is a mask function and can be learned from end to end, with the specific form as: . ℎ Where h(.) is a softmax function, x is the feature maps of the whole scale. Multi-task network structure of SASN can improve the features learning and reduce overfitting. The whole scale feature maps were added element-wised to the part feature maps, the operation can mix low level features with high level features.

Context Sensitive Module
Inspired by the Inception-ResNet, it is important to take advantage of the gain of deeper and wider network features. We proposed the context-sensitive layer (CSL), see Fig. 1, in which we concatenate the FC layers of context module in the whole branch and the part branch. By using CSM, all the benefits of the multi-task approach can be utilized while remaining rich contextual features from the whole branch. After that, a loss was proposed to make bigger than a margin, which can be formed as: where P and P represent the whole branch and the part branch classification probability, respectively. γ is a margin, we set it 0.15 in all our experiments. The total loss function can be formed as: * where 0.5.

Datasets
We conduct experiments on two challenging fine-grained image recognition datasets, including Caltech-UCSD Birds (CUB-200-2011), and Stanford Cars. The detailed statistics with category numbers and data splits are summarized in Table 1 ICSP

Baselines
The baseline approaches were divided into two categories: using human-defined bounding box (bbox) of supervision or part annotation of weak supervision. In the following, the first two methods use human supervision, and the last one is based on part learning methods of weak supervision. Since state-of-the-art results were achieved in both categories, it is reasonable to compare with them. We lists all the baselines as follows: 1)LAC-AI: a pose-aligned part-based classification method was proposed for alignment, deep localization, and recognition.
2)PDFR: consisted on the three main ideas including learning part detectors , picking deep filter responses and finding distinctive filters.
3)PN-CNN: proposed a pose normalized CNN which can estimating the object's pose and compute local features.

Experiments on CUB-200-2011 and Stanford Cars
During infer time, we only used the part branch category results, which was showed in the table 2. For fair comparison, we used ResNet52 as the baseline network for all the methods, the results showed that the proposed method achieved the best accuracy.

Conclusion
In this paper, we propose a part based attention fusing convolutional neural network for fine-grained recognition, which learns discriminative region attention and concatenate region-based feature representations at different scale and context regions. Extensive experiments showed that the advanced performance can be achieved on fine-grained recognition tasks such as birds, dogs. In the future, we will continue to research on one main directions, how to fuse local visual cues and global image multiple scale structure and by context attention, to keep promoting the performance.


Clustering protein-protein interaction data with spectral clustering and fuzzy random walk

Spectral Clustering is a graph clustering algorithm that makes use of eigenvector obtained from a matrix describing pairwise similarity between data points. It provides a dimensionality reduction for clustering in lower dimensions. One example of spectral clustering application is the clustering of protein-protein interaction (PPI) network. PPI networks are usually represented as a graph network with proteins and interactions as vertices and edges respectively. However, this spectral clustering only produces a hard clustering of proteins, whereas there may be some relationship between each protein clusters, and possibly multiple functionality for each proteins that has not been detected before. Fuzzy Random Walk is a fuzzy clustering method based on transition probability from a random walk on a dataset. In this paper, we combine both Spectral Clustering and Fuzzy Random Walk to cluster PPI network of protein TP53, a protein thatplays an important role in managing cell cycle, especially in tumor cell suppression. Using PPI dataset of TP53 obtained from the STRING database, we found the combined algorithm is proven to produce both robust and fuzzy clusters with each cluster explains one of TP53 protein’s functionality related to the tumor cell.

Introduction
The increasing complexity and heterogeneity of a data make it difficult to interpret and extract possibly hidden information within the data. This problem has led the development of many dimensionality reduction and data clustering techniques over past decades. Clustering is a process of revealing the underlying structure of a dataset by grouping the data elements into a groups called clusters [1]. Clustering is usually done based on some similarity measure between data elements, and without any information on how the grouping should be done (unsupervised learning) [2].
Graph is a structure formed by a set ofvertices(also callednodes) and a set ofedgesthat connectthe pairs ofvertices.Graph clusteringis a task of grouping the verticesof the graph into some clusters,by considering the edgestructure of the graph, in such a way that there should bemany edgeswithineach cluster and relatively fewbetweenthe clusters [3]. One of the popular graph clustering techniques are spectral clustering. Spectral clustering provides a dimensionality reduction by using the eigenvectors of a similarity matrix of the graph [4]. Spectral clustering is a global clustering method, as it considers all of the graph vertices in its algorithm. Protein-protein interaction (PPI) is a physical contact of high specificity between two or more proteins as a result of biochemical activity steered by electrostatic force including hydrophobic effect [5]. PPI plays a significant role in almost all biological process [5]. Clustering of PPI network is an effective approach in identifying protein complexes and functional module, which is important in investigating a gene role in a disease and also drug target [6]. Broadly speaking, this approach could also give a new understanding about protein function and cell machinery. Spectral clustering of PPI data gives not only a robust clusters, but also possibly some meaningful interpretation in the lowdimensional embedding [7]. However, spectral clustering only produces a 'hard' clusters, whereas there may be some relationship between each protein clusters, and possibly multiple functionality for each proteinsthat has not been detected.
In this paper, we propose a fuzzy version of spectral clustering by combining spectral clustering with fuzzy random walk [8,9] and apply them toPPI network of protein TP53, an important protein for tumor suppression. We set a 'seed' or clustercenter for each clusters and perform a random walk for each data to determine its membership value. Using PPI datasets of TP53 obtained from the STRING database, we found the combined algorithm is proven to produce both robust and fuzzy clusters with each fuzzy cluster explains each one of TP53 protein's functionality related to the tumor cell.

Methods
Our proposed algorithm combines the concept of spectral clustering and fuzzy random walk along with its specific modification for PPI dataset. The input of the algorithm is a graph = ( , ) with nodes1,2,3, … , . There are some noticeable changes between our method and the original fuzzy random walk [8], namely, the determination of the number of clusters, cluster centers, and the assignment of the membership value. Our algorithm returns the number of cluster and a set of membership values ( ) where itdenotes the membership value of node in cluster . The sum of membership value of a node is 1, that is,

Determining the cluster center
A cluster in protein interaction dataset is often characterized by a densely connected region on the graph. Based on [9], in this paper we define the density of a node as the ratio of number of edges between and its neighbor, to the number of vertices in the neighbor of , which is where denotes a set of edges in the neighbor of , denotes a set of nodes in the neighbor of , and ( ) denotes the set of the neighbors of , a set of nodes that is directly connected to the node . The search of cluster center is done iteratively. For each iteration, node with maximum density is selected as the cluster center and then removed along with its neighbor. The node removal is done to ensure that the cluster centers found are not too close to each other. If two disjoint region and of a graph is indeed adifferent cluster, then the node removal of one of the clusters would not affect the density of the other clustersignificantly.
The iteration process is done until the maximum density is lower than a threshold . Then the set of maximum density node of each iteration is defined as the cluster center for different clusters, and the number of cluster centers is the number of cluster.The default value of threshold parameter is 1. Parameter is optional, if it's not provided, then the optimal number of clusters will be determined by the silhouette coefficient [10].

Spectral clustering
Basic concept of spectral clustering is to use the eigenvectors of the laplacian matrix of the input graph as the low-dimensional representation of the data [4,12,13,14]. Given the adjacency matrix of the input graph, the laplacian matrix is defined as where is diagonal matrix with its diagonal element = . Now, given the number of clusters , the spectral clustering algorithm computes the first eigenvectors (of smallest eigenvalues) of matrix , and assigns a -dimensional coordinate vector to each node of graph . This coordinate representation of the vertices is then clustered again using other clustering method (usually k-means clustering).
In summary, the steps done in spectral clustering algorithm is presented in the table below [12]  Each data point from the -dimensional data points =1,…, represents a node in the original graph. Fuzzy random walk uses these data points to assign a membership value for each node.

Fuzzy random walk
Fuzzy random walk consists of two steps, the computation of the auxiliary matrix andmembership value assignment by random walk [8]. Consider the -dimensional data points =1,…, . First, wedefine a family of matrices ( ) with its entries ( ), as clusters, meanwhile large value corresponds to the case where all the nodes are highly connected, and thus diffusion occur instantaneously. We search for the intermediate value of , when there is enough time to diffuse, but the equilibrium is not yet reached. We search for a * value that satisfies * = 2 1 | | the adjustment of parameter 1 also gives the same meaning as but restricted to the range (0,1). The default value of 1 is 0.3.Then, wedefine the auxiliary matrix as ( * ). Let = [ ] be a diagonal matrix with its diagonal entries defined by = .
We also define the transition matrix , as = −1 And the random walk time step, This process is done to every node for each clusters. In summary, the steps done in our method, spectral clustering with fuzzy random walk is presented in table below  Input : Graph = ( , ) with nodes 1,2, … , and edge weight as pairwise similarity  For each node , compute and search the maximum . Let the corresponding node be  Remove and neighbor of from , and repeat the search. Stop until the next found satisfies <  Set the number found as the number of cluster , and the set as the cluster centers.

Results and discussion
The implementation of our method is done on PPI data of TP53 protein using the python programming language on software Canopy 1.6.2 (64-bit). The program is run on computer that has specs: Intel®Core TM i5-4200U @ 1.60 GHz, 2.30 GHz, 4.00 GB RAM and Windows 7Ultimate operating system ©2009 Microsoft Corporate 64-bit.
The PPI dataset of TP53 protein that found in Homo sapiens is obtained from STRING (Search Tool for the Retrieval of Interacting Genes) version 10 [11] database available online on string-db.org. This interaction networks consists of 131 proteins (nodes) and 1478 interactions (edges) are presented in the figure below. The cluster centers obtained from this PPI network consists of 6 proteins. The list of cluster centers, the protein name and density score is presented in table below.  From this list we search for optimal number of clusters from = 2 to = 6 using the silhouette coefficient ( ) of a node defined by [9] = − max , where ( ) denotes the intra cluster average distance to node and ( ) denotes the second-closest cluster average distance to node . A silhouette coefficient score for a clustering result is the average of every node silhouette coefficient and is in range (−1,1), where value close to 1 denotes a tightly grouped clusters with high dissimilarity between each clusters while value close to −1 denotes a clustering result that may not properly clustered. For this purpose we assign each node to a cluster based on the highest membership value and compute the silhouette coefficient score for = 2 to = 6 and set the top cluster centers to be the cluster center. The highest silhouette coefficient score is then chosen as the number of clusters. The figure below show the plot of silhouette coefficient score for = 2 to = 6  figure 2 we get the maximum silhouette coefficient value is obtained when the number of cluster is set to 5, and therefore we choose the number of clusters to be 5.
.Even though the main protein, TP53 is not one of the cluster centers, we found that all cluster center listed in the previous table has a direct interaction with protein TP53. This indicates all the cluster formed has some connection regarding its function with protein TP53. The cluster centers for this clustering result are FZR1, RPA1, BCL2L1, CREBBP and TP53BP2. Also, from the membership value, we can infer that some protein has a greater importance than other protein in the same cluster. Although it not shown here, but our method gives the similar performance when compared with spectral clustering only.Without using fuzzy random walk, we can only infer the group in which each

Conclusion and future work
Based on the analysis of our clustering results, we found our method on clustering TP53 PPI network produces a well-separated clusters with its membership value as an additional information on how these proteins interact with other clusters. The cluster centers found (FZR1, RPA1, BCL2L1, CREBBP and TP53BP2) are directly interacting with TP53 proteins, which indicates some connections with TP53 protein. It should be any further work to interpret the clustering result from our method to obtain more understanding by using data from the fields of biology and medical research.
For future work, we plan to study our method further not only to apply it to the biological dataset, but also a more general dataset in a graph form. In order to do that we would try to develop a more general method for detecting a cluster centers. Also, from computational approach, to achieve substantial performance over CPU approaches on a large dataset, we can use massively parallel computing approaches using GPU computing.