Modeling and Supervisory Control of Mobile Robots: A Case of a Sumo Robot

Modeling and Supervisory Control of Mobile Robots: A Case of a Sumo Robot

1st IFAC Conference on Cyber-Physical December 7-9, 2016. Florianopolis, Brazil& Human-Systems 1st IFAC Conference on Cyber-Physical Human-Systems Dec...

567KB Sizes 60 Downloads 70 Views

1st IFAC Conference on Cyber-Physical December 7-9, 2016. Florianopolis, Brazil& Human-Systems 1st IFAC Conference on Cyber-Physical Human-Systems December 7-9, 2016. Florianopolis, Brazil& 1st IFAC Conference on Cyber-Physical & Human-Systems Available online at www.sciencedirect.com December 7-9, 2016. Florianopolis, Brazil December 7-9, 2016. Florianopolis, Brazil

ScienceDirect IFAC-PapersOnLine (2016) 240–245 Modeling and Supervisory Control 49-32 of Mobile Robots: A Case of a Sumo Robot Modeling and Supervisory Control of Mobile Robots: A Case of a Sumo Robot Modeling and Supervisory Control of Mobile Robots: A Case Modeling and Supervisory of Mobile Robots: Case of of aa Sumo Sumo Robot Robot César R. C. Control Torrico*, André B. Leal**, Ana T. Y. A Watanabe**

César R. C. Torrico*, André B. Leal**, Ana T. Y. Watanabe** César R. C. Torrico*, André B. Leal**, Ana T. Y. Watanabe** César R. C.Department, Torrico*, André B. Leal**, Ana T. Y. Watanabe** *Electrical Engineering Technological Federal University of Paraná – UTFPR   *Electrical Engineering Department, Technological Federal University of Paraná – UTFPR Pato Branco-PR, Brazil (Tel: +55 46 32202571; e-mail: [email protected]). *Electrical Engineering Department, Technological Federal University of – Pato Branco-PR, Brazil (Tel: +55 46 32202571; e-mail: [email protected]). *Electrical Engineering Department, Technological Federal University of Paraná Paraná – UTFPR UTFPR **Electrical Engineering Department, Santa Catarina State University – UDESC Pato Branco-PR, Brazil (Tel: +55 46 32202571; e-mail: [email protected]). **Electrical Engineering Department, Santa Catarina State University – UDESC Pato Branco-PR, Brazil (Tel: +55 46 32202571; e-mail: [email protected]). Joinville-SC, Brazil, (e-mails:[email protected], **Electrical Engineering Department, Santa [email protected]) State University – UDESC Joinville-SC, Brazil, (e-mails:[email protected], **Electrical Engineering Department, Santa [email protected]) State University – UDESC Joinville-SC, Brazil, (e-mails:[email protected], [email protected]) Joinville-SC, Brazil, (e-mails:[email protected], [email protected]) Abstract: This paper presents a methodology for modeling and controlling autonomous mobile robots Abstract: This paper presents a methodology for modeling and controlling autonomous mobile robots and illustrates approach using a sumo robotfor problem. Theand free behavior of the robot and its control Abstract: Thisthis paper presents a methodology modeling controlling autonomous mobile robots and illustrates this approach using a sumo robot problem. The free behavior of the robot and its control Abstract: Thisarepaper presents a methodology for modeling and controlling autonomous mobile robots specifications modeled byusing finite state machines, and the supervisory control theory of and discrete event and illustrates this approach sumo robot problem. The free of the robot its specifications are modeled byusing finiteaa state and the supervisory control theory of and discrete event and illustrates this approach sumomachines, robot problem. The free behavior behavior of the robot its control control systems is used to obtain the logical behavior of the robot in closed-loop. We also present a proposal for specifications are modeled by finite state machines, and the supervisory control theory of discrete event systems is used to obtain the logical behavior of the robot in closed-loop. We also present a proposal for specifications are control modeledstructure by finiteobtained state machines, and the approach. supervisory control theory of discrete event implementing the by the presented systems is obtain the behavior robot closed-loop. implementing obtained byof presented systems is used usedtheto tocontrol obtain structure the logical logical behavior ofthethe the robot in in approach. closed-loop. We We also also present present aa proposal proposal for for implementing the structure obtained by approach. © 2016, IFAC (International Federation ofSupervisory Automatic Control) by Elsevier Ltd. All Mobile rights reserved. Keywords: Discrete Event Systems, Control,Hosting Monolithic Approach, Robotics, implementing the control control structure obtained by the the presented presented approach. Keywords: Discrete Event Systems, Supervisory Control, Monolithic Approach, Mobile Robotics, Microcontrollers. Keywords: Discrete Microcontrollers. Keywords: Discrete Event Event Systems, Systems, Supervisory Supervisory Control, Control, Monolithic Monolithic Approach, Approach, Mobile Mobile Robotics, Robotics, Microcontrollers.  Microcontrollers.  problems. Furthermore, difficulties in the implementation of  1. INTRODUCTION problems. Furthermore, in the implementation of  control logic, especiallydifficulties in microcontrollers, due to their 1. INTRODUCTION problems. Furthermore, difficulties in the implementation of control logic, especially in microcontrollers, due to their 1. INTRODUCTION Furthermore, inthetheadoption implementation of memory constraints, havedifficulties hampered of SCT for Obtaining the control logic for mobile robots can be a problems. 1. INTRODUCTION control logic, especially in microcontrollers, due to their memory constraints, have hampered the adoptiondue of SCT for control logic, especially in microcontrollers, to their Obtaining the control logic for mobile robots can be a industrial applications. complex activity that requires the use of formal memory have Obtaining the control logic for mobile robots methods can be to industrialconstraints, applications. constraints, have hampered hampered the the adoption adoption of of SCT SCT for for complex activity that requires thecontrol use of specifications. formal toaa memory Obtaining the fulfillment control logic for mobile robots methods can beThe guarantee the of the industrial applications. complex activity that requires the use of formal methods to This work aims to explore the constraints between industrial applications. guarantee the fulfillment of the control specifications. The complex activity thatTheory requires(SCT) the use of formal to This work aims to explore the constraints between Supervisory Control (Ramadge andmethods Wonham, guarantee the fulfillment of the specifications. The subsystems modeling in order the to reduce the number of Supervisory Control Theory (SCT) (Ramadge and Wonham, This work in to explore constraints between guarantee the fulfillment ofsuitable the control control specifications. The 1989) is a formal approach for this purpose. In this subsystems inaims modeling in order to reduce thefeasible number of This work aims to explore the constraints between Supervisory Control Theory (SCT) (Ramadge and Wonham, states in the global system and thereby make the 1989) is a formal approach suitable for this purpose. In this subsystems in modeling in order to reduce the number of Supervisory Control Theory (SCT) (Ramadge and Wonham, framework, the plant to be controlled is purpose. modeled asthisa states in the global system and thereby make feasible the subsystems in modeling in order to reduce the number of 1989) is a formal approach suitable for this In implementation of the control logic inmake real feasible controllers. framework, the plant to be controlled is modeled as a states in the global system and thereby the 1989) is a formal approach suitable for this purpose. In this Discrete Event Systemto (DES), and using controllable implementation of the control logic for inmake real feasible controllers. states in the global system and thereby the framework, the plant be controlled is modeled as a Furthermore, are presented a proposal implementing the Discrete Event System (DES), and using controllable framework, thefinite plant to automata, be controlled is modeled as a Furthermore, implementation the logic for in real controllers. languages and state a minimally restrictive are of presented a proposal the implementation of the control control in implementing real controllers. Discrete Event System (DES), and using controllable control structure obtained by thelogic presented approach. For languages and finite state automata, a minimally restrictive Discrete Event System (DES), and using controllable Furthermore, are presented a proposal for implementing the and nonblocking control logic is obtained (Cassandras and control structure obtained by the presented approach. For languages and finite state automata, a minimally restrictive Furthermore, presented a proposal for implementing the validation, areare proposed a systematic procedure for modeling, and nonblocking control logic is obtained (Cassandras and languages and finite state automata, a minimally restrictive control structure obtained by the presented approach. For Lafortune, 2008). control logic is obtained (Cassandras and control validation, are proposed aimplementation systematic procedure for modeling, and nonblocking structure obtained by the presented approach. For controller synthesis, and of the control logic Lafortune, 2008). and nonblocking control logic is obtained (Cassandras and controller validation, are proposed systematic modeling, synthesis, andaacompetition. implementation of the for control logic Lafortune, 2008). validation, are proposed systematic procedure procedure for modeling, a mobile sumo robot In (Wang et2008). al., 2005; 2005b) the authors present the design, for Lafortune, controller synthesis, and implementation of the control logic for a mobile sumo robot competition. controller synthesis, and implementation of the control logic In (Wang et al., 2005; 2005b) the authors present the design, modeling, and supervisory control of a mobile robot based on for a mobile sumo robot competition. In (Wang et al., 2005; 2005b) the authors present the design, The major contributions of this paper are: through a for a mobile sumo robot competition. modeling, and supervisory control of a mobile robot based on (Wangreal et al., 2005;of2005b) the authors behavior. present the design, aIn signed measure itscontrol discrete-event Thus, the The majorcase contributions of athis paper are: through a modeling, and supervisory of a mobile robot based on successful study, propose manner to modeling plants, amodeling, signed real measure of its discrete-event behavior. Thus, the The major contributions of this paper are: through and supervisory control of a mobile results robot based on successful case study, propose a manner to modeling plants,a robot plant model is built upon experimental derived The major contributions of this paper are: through a aarobot signed real measure of its discrete-event behavior. Thus, the restrictions order totoreduce the number is built upon experimental results derived successful physical case study, propose in a manner modeling plants, signed realmodel measure of itsand discrete-event behavior. Thus, the exploring from aplant specific scenario the supervisor is synthesized exploring physical restrictions in order toto reduce the number successful case study, propose a manner modeling plants, robot plant model is built upon experimental results derived of states of the global system; the proposition of an from aplant specific supervisor results is synthesized robot modelscenario is built and uponthe experimental derived in reduce the using language-measure-based quantitative approach. The exploring of states physical of the restrictions global system; theto proposition of an exploring physical restrictions in order order toin reduce the number number from aaaa specific scenario and the supervisor is synthesized operational structure to implement a DES real controllers. using language-measure-based quantitative approach. The from specific scenario and the supervisor is synthesized of states of the global system; the proposition resultant supervisor is the same as the conventionally operational structure to implement a DES in real controllers. using a language-measure-based quantitative approach. The of states of the global system; the proposition of of an an resultant supervisor is the same as the conventionally using a language-measure-based quantitative approach. The operational structure to implement a DES in real controllers. designed by means ofisthethe SCT. Jayasiri et al.conventionally (2009; 2011) operational structure to implement a DES in real controllers. resultant supervisor same as the 2. SUPERVISORY CONTROL OF DES designed by means of the SCT. Jayasiri et al. (2009; 2011) resultant ansupervisor isofthe same the of conventionally suggest using the astheory fuzzy 2011) DES 2. SUPERVISORY CONTROL OF DES designedan by alternative means of the SCT. Jayasiri et al.of(2009; suggest of using using fuzzy the theory fuzzy 2011) designed by alternative means of the SCT. Jayasiri et al. (2009; 2. CONTROL DES where decisions are made logic. In (Sales etDES al., This section is dedicated to reviewing theOF basic concepts of 2. SUPERVISORY SUPERVISORY CONTROL OF DES suggest an alternative of using the theory of fuzzy DES where decisions are made using fuzzy logic.for In al., This section suggest anproposed alternative of usingnavigation the theory of (Sales fuzzy etDES is dedicated to reviewing the basic concepts of 2012) is a visual autonomous the supervisory control theory (Ramadge and Wonham, where decisions are made using fuzzy logic. In (Sales et al., This section is dedicated to reviewing the basic concepts of 2012) isthat proposed aonvisual autonomous where decisions are made using navigation fuzzymachines. logic.for In (Sales et al., the supervisory control theory (Ramadge and Wonham, vehicles is based finite state Lopes et al. This section is dedicated to reviewing the basic concepts of 1989), which is thecontrol basis for this paper. 2012) is proposed aaonvisual navigation for autonomous the supervisory theory (Ramadge and Wonham, vehicles that is based finite state machines. Lopes et al. 2012) is proposed visual navigation for autonomous 1989), which is thecontrol basis for this paper. (2016) proposed and demonstrated the use of SCT for the supervisory theory (Ramadge and Wonham, vehicles that is on finite machines. Lopes et al. which is the basis for this paper. (2016) proposed andcontrollers demonstrated the use of SCT vehicles that is based based on finite state state machines. Lopes et for al.a 1989), A Discrete is a discrete-state, eventformally developing in swarm robotics. Using 1989), whichEvent is the System basis for(DES) this paper. (2016) proposed and demonstrated the use of SCT for A Discrete Event (DES) is a discrete-state, eventformally developing in swarm robotics. Using (2016) andcontrollers demonstrated the to use of SCT fora A driven system, that System is, its state evolution depends entirely on series ofproposed case studies, they illustrated how formally model Discrete Event System (DES) is a discrete-state, eventformally developing controllers in swarm robotics. Using a driven system, that is, its state evolution depends entirely on series of case studies, they illustrated how to formally modela the A Discrete Event System (DES)discrete is a discrete-state, eventformally developing in swarm robotics. Using occurrence of asynchronous events over time. It the capabilities of controllers robots and their desired behavior series of case studies, they illustrated how to formally model driven system, that is, its state evolution depends entirely on the occurrence of asynchronous discrete events over time. It the capabilities of robots and their desired behavior driven system, that is, its state evolution depends entirely on series of case studies, they illustrated how to formally model can be modeled by a deterministic automaton, a five-tuple (specifications). thesebehavior models the occurrence of asynchronous discrete events over time. It the capabilities Supervisors of robots were andderived their from desired can be modeled by a deterministic automaton, a five-tuple (specifications). Supervisors were derived from these models occurrence asynchronous overtime. It the capabilities of robots and their was desired behavior the , q0,Qof where Q is discrete the automaton, set events of states, is the G=(Q,, and the code forSupervisors controlling the derived robots automatically m), can be by aa deterministic aa five-tuple (specifications). were from these models or , qfinite where Q isassociated the automaton, set of states,  is the G=(Q,, and the code for controlling the derived robots was automatically 0,Qm), can be modeled modeled by deterministic five-tuple (specifications). Supervisors were from these models alphabet set of events with the transitions generated by a tool named Nadzoru. Systematic experiments m), where Q is the set of states,  is the G=(Q,, or ,, q and the code for the robots was automatically 00,Qm of events with the transitions generated by toolcontrolling named Nadzoru. Systematic experiments G=(Q,, qfinite where Q isassociated the function, set of states,  the and the code for controlling the600 robots was confirmed automatically 0,Qm),setis with up to 40aae-pucks and up to Kilobots the alphabet Q×Q, the transition qthe Q is is the in G, : or 0 transitions alphabet finite set of events associated with generated by tool named Nadzoru. Systematic experiments with up to 40 e-pucks and up to 600 Kilobots confirmed the  : Q×Q, is the transition function, q Q is the in G, 0 transitions alphabet or finite set of events associated with the generated by a tool named Nadzoru. Systematic experiments correctness of the implementation code. initial state and Qm is Qthe is atransition set of marked states. 0 with up e-pucks and Kilobots :: Q×Q, function, q G, correctness of the implementation code. initial and Qm is Qthe is atransition set of marked states. with up to to 40 40 e-pucks and up up to to 600 600 Kilobots confirmed confirmed the the in Q×Q, function, q00   Q Q is is the the in G, state correctness of the implementation code. m  Q is a set of marked states. initial state and Q m The SCT has gradually usedcode. for flexible manufacturing In correctness of been the implementation  is Q a mpartial function, to be defined only for a set general,  Q is a set of marked states. initial state and The SCT communication has been gradually used forand flexible manufacturing general,  is a partial function, to be defined only for a set systems, protocols, process control. A In The SCT communication has been gradually used forand flexible manufacturing  can also only be naturally of general, events (q) at q and In  is aaoccurring partial function, to be defined for a set systems, protocols, process control. A The SCT has been gradually used for flexible manufacturing  can also only of events (q) occurring at q and is partial function, to be defined for In general, major obstacle in the use of SCTandis process the combinatorial systems, communication protocols, control. A extended to(q) strings of events denoted bycan (q,s ) =be (naturally (q,s)aset ).  also be naturally of events occurring at q and major obstacle in the use of SCT is the combinatorial systems, communication protocols, andsolution process ofcontrol. A of extended strings of events (q,s ) =be (naturally (q,s)). explosion of states that use occurs the complex eventsto(q) occurring at denoted q and bycan also major obstacle in the of in SCT issolution the combinatorial explosion of states that occurs in the of complex  (q,s  ) =  (  (q,s)  extended to strings of events denoted by major obstacle in the use of SCT is the combinatorial extended to strings of events denoted by (q,s) =((q,s)). ). explosion states that occurs in the solution of complex explosion of of states Copyright@ 2016 IFACthat occurs in the solution of complex 240 2405-8963 © 2016, Copyright@ 2016 IFAC IFAC (International Federation of Automatic Control) 240Hosting by Elsevier Ltd. All rights reserved. Peer review under of International Federation of Automatic Copyright@ 2016 responsibility IFAC 240Control. Copyright@ 2016 IFAC 240 10.1016/j.ifacol.2016.12.221

2016 IFAC CPHS December 7-9, 2016. Florianopolis, Brazil César R.C. Torrico et al. / IFAC-PapersOnLine 49-32 (2016) 240–245

241

The automaton G can be interpreted as a device that starts in state q0 and generates a sequence of events following the automaton.

The presentation of this paper will be done with the assist of a small problem in mobile robotics. The robot for this study has two strip sensors s1 and s2 as shown in Figure 1.

The generated language by G is defined as L(G) = {s : s  *  (q0,s) is defined} and marked language by G as Lm(G) = {s : s  *   (q0,s)  Qm }. In Ramadge-Wonham’s model, a DES of generated language L (partial sequences) and marked language Lm (completed tasks) can be represented by a generator G such that L(G) = L and Lm(G) = Lm.

Figure 1. Basic robot to study. The mobility is restricted to two directions of motion, forward and backward. The movement is limited by two strips placed at the ends of the paths, which are detected by sensors s1 and s2, respectively.

The control of the DES is the switching of the control inputs, depending on the past behavior of the system, called closedloop behavior. This concept leads to the distinction of the system to be controlled (Plant) and control agent (Supervisor), thus distinguishing the physically possible behavior of the system and the constraints linked to unwanted behaviors.

Traditional modeling of two sensors would be as shown in Figure 2(a) and the model of the synchronous composition of these two sensors is shown in Figure 2(b), where all events are uncontrollable.

In order to associate control structures to a DES, the alphabet  is partitioned into a set of controllable events c that can be inhibited by the controller, and a set of uncontrollable events u over which the control agent has no influence (Ramadge and Wonham, 1989). The supervisory control theory aims to synthesize a minimally restrictive and nonblocking controllable language. An automaton S that recognizes this language implements the required supervision. The control action of S, defined for each state of the automaton, is to disable in the plant G events that may not occur in S after a sequence of observed events. The automaton obtained from the synchronous composition of S and G, that is, S||G, represents the closed-loop behavior. In fact, in synchronous composition, only those transitions allowed in both the system G and the supervisor S are enabled.

S1

s1on

S2

s1off s2on

s1on

S1 S2

s1off s2on

s2off

s2off s1on

s2on

s1off

s2off

(b)

(a)

Fig. 2. Plant Model for S1 and S2. (a) Traditional Modeling of sensors S1 and S2. (b) Synchronous composition of S1 and S2. It can be observed that it is not physically possible to reach state 3 in this application, since the two sensors cannot be connected simultaneously.

It is said that a supervisor S is nonblocking for the plant G if from every state of the plant in closed-loop, one marked state can be achieved, which means that a task can be completed. 3. DES MODELING WITH RESTRICTIONS ON THE PLANT

To remove this state, following a supervisory control theory, a specification could be formulated, but this would not be feasible since all the events involved are uncontrollable and thus, cannot be prevented from happening by the supervisor.

One of the biggest problems faced in the modeling of DES using state machines is the explosion of states. Techniques that minimize or solve this problem are the current challenge for researchers.

In order to solve this problem, is proposed to adopt a model that restricts the behavior of each subsystem according to the behavior of the others. Thus, it is proposed a new model for the sensors s1 and s2 as shown in Figure 3(a).

S1

In supervisory control theory, typically a complex system is divided into smaller subsystems for modeling. Each subsystem is modeled such that all possible sequences are represented, without worrying about the behavior of the other subsystems.

s2on s1on 0

S1 S2

s1off S2 s1on s2on

As a modeling alternative, aiming to reduce the explosion of states, this paper attempts to explore restrictions where a subsystem interferes with another system. Note that this proposal is not equivalent to a simple additional specification restricting the problem.

0

1

0

s2off (a)

s1off

1

s2on

s2off 1

s1on

2 (b)

Fig. 3. Plant Models. (a) Restrictive Modeling of sensors S1 and S2. (b) Synchronous product of S1 and S2. 241

2016 IFAC CPHS 242 December 7-9, 2016. Florianopolis, Brazil César R.C. Torrico et al. / IFAC-PapersOnLine 49-32 (2016) 240–245

Notice that while s1 is in state 0, sensor s2 can be activated, but as soon as s1 finds the strip (s1on) going to state 1, there is no longer possibility of sensor s2 being activated. Thus, the automata model only allows physically possible behaviors. The synchronous product of the two models results in Figure 3(b). Observe that, in this way, there is a decrease in the number of states and transitions in the plant model.

Two DC motors located at each side of the robot are responsible for locomotion. Some strategic combinations of movement were attached as illustrated in Figure 5(b). Each combination of locomotion is an operational sequence that can be attributed to a controllable event. p3 b

4. MODELING AND DESIGN OF THE SUPERVISOR FOR A MOBILE ROBOT

s1

p1

s2

p2

p4

In this section, the whole procedure involved in modeling and control of an autonomous mobile sumo robot will be presented.

(a)

4.1 Problem Description In the context of mobile robotics, robot sumo is a form of competition between robots whose goal resembles the human sumo, but instead of people, the contestants are robots. Just like human sumo, the goal is to take the opponent out of the ring, known as a dojo. This has a circular shape, is painted black and delineated with a white border. The robot of interest is the autonomous sumo category up to 3kg.

f

ge1

ge2 ge3

ft

gd1

gd2 gd3

r

(b) Fig. 5. Sumo Robot. (a) Sumo Robot with sensors and actuators. (b) Possible forms of robot locomotion.

The dojo size depends on the category of competition. In Brazil, Robocore (2016) is in charge of organizing this type of competition. Abroad, the IEEE-INTERCON and Robogames (2016) are important robotics competitions.

In the implementation of the supervisory system, the controller generates randomly the controllable events. Some controllable events (ge2, gd2, ge3, gd3) are timed until a timeout or an uncontrollable event occur. For example, if event ge2 occurs, the controllable event generation is stopped until a timeout. If during this break an uncontrollable event occurs, this will be treated normally and the automatic generation of controllable events reactivated.

At the start, both contestant robots are positioned on the dojo as shown in Figure 4, with initial orientation of the front decided by lot.

4.2 Plant Modeling Once having described all the events involved in the system, it is possible to model the plant. Using the traditional way of modeling, the sensors would be modeled by two-state automata and the synthetized supervisor will have states that are physically impossible to be reached. Thus, this way of modeling would lead to unnecessarily large models, representing situations that do not occur in the plant. In order to reduce the size of the models, are proposed to explore behavioral restrictions in each subsystem of the plant.

Fig. 4. Dojo or sumo ring with robots positioned to start the fight. For the purposes of perception, several sensors were connected to the robot. As shown in Figure 5a, the robot used in this project has two strip sensors s1 and s2 and four presence sensors p1, p2, p3 and p4. The strip sensors are to prevent the robot from leaving the dojo, and presence sensors are to look for the opponent. There is also a button b to initiate the fight.

In figures 6(a) and 6(b) the behavior of sensors p1 and p2 are described by automata G1 and G2, respectively. The initial state of both automata represents the idle state of the robot, where the activation of any sensor is ignored and only the corresponding event b for the start button will be monitored. In the state 1, the robot is in the initial attack position; when the p1 sensor finds the opponent, going to state 2, p3 and p4 sensors are not read anymore until it returns to the initial attack position, which happens at the occurrence of the event p1p, ts or r.

The events coming from all these sensors will be considered as uncontrollable, because there is no inhibiting action on them. For modeling s1, s2, p3, p4 sensors and b only the transition from the rising edge was chosen as an event, since the falling edge is not relevant information, while for the sensors p1 and p2 transitions from the rising and falling edges will be considered. 242

2016 IFAC CPHS December 7-9, 2016. Florianopolis, BrazilCésar R.C. Torrico et al. / IFAC-PapersOnLine 49-32 (2016) 240–245

243

Once having the plant model, the next step is to design some specifications for the system, according to obtain a desired behavior. 4.3 Specification Modeling Since the goal of the system is a robot fight, specifications for attack and defense were developed. Automaton E1 showed in Figure 7(a) is an attack specification using sensors p1 and p2. These sensors operate in cooperation aiming to get the opponent out of the dojo. State 1 is the initial state of attack where no sensor has been activated. From state 1 if any of the sensors p1a or p2a finds the opponent, reaching states 2 or 3, the robot is directed through the events ge1 or gd1 in an attempt to find the second sensor and stay in front of the opponent. When the robot is in front of the opponent (state 4), it turns on the motor turbo (event ft) to throw the opponent out of the dojo.

Fig. 6. Plant Model: Automata G1, G2, G3, G4, G5, G6, for sensors p1, p2, p3, p4, s1, s2, respectively. The automata for sensors p3 (G3) and p4 (G4) are shown in figures 6(c) and 6(d), respectively. States 0 and 1 have the same interpretation of the previous case. When the robot finds the opponent at its left side (sensor p3 is activated), G3 enters state 2 and p1, p2 and p4 sensors may not be activated. The robot will come back to the initial attack position after rotating on its axis to the left for a limited time (event ge3), trying to stay with the front facing the enemy, or if it finds the borderline and then moves backwards (event r).

E4:

Handling of strip sensors s1 and s2 is the highest priority. Figures 6(e) and 6(f) show the models for these sensors. Considering the plant G5 corresponding to sensor s1, this model can be interpreted as follows: states 0 and 1 have the same interpretation as in the first case. After the activation of sensor s1 (state 2), all presence sensors are ignored and priority is given to the event r to go in reverse in an attempt to get away from the strip. After the reverse movement (state 3) sensor s1 can only be activated again after changing the direction of movement (transition from state 3 to 1).

ge3 ,p 2p

, p 2a p 1p 2 , a gd p1 0

f ge3 gd3

Following the monolithic approach of Ramadge and Wonham (1989), the overall composition of the plant corresponding to 6 subsystems resulted in an automaton with 43 states and 247 transitions, which corresponds to a reduction of about 40% in the number of states and 34% in the number of transitions, if compared with the traditional model.

s1

b

1

p1a p1p p2a p2p p3a p4a

s2 p1

ge a ,p 2 1p , p2

a ,p 2p

2

p3a

p3a

r,s2 r,s1 3

4

p4a p4a

5

gd3

(d) Fig. 7. Specifications. (a) Attack specification using sensors p1 and p2. (b) Attack Specification E2 using sensor p3. (c) Attack Specification E3 using sensor p4. (d) Defense specification E4. 243

2016 IFAC CPHS 244 December 7-9, 2016. Florianopolis, BrazilCésar R.C. Torrico et al. / IFAC-PapersOnLine 49-32 (2016) 240–245

It is noteworthy that if event r occurs, the attack operation is aborted, since this event will occur only when the robot finds the range of the limit of the dojo. Figures 7(b) and 7(c) show the attack specifications involving the sensors p3 (E2) and p4 (E3), respectively. State 1 is the initial state of attack. Although these specifications are very similar to the behavior of plants G3 and G4, the main goal is to prevent the robot from continuing to move forward after finding the adversary with side sensors p3 or p4. Similarly to the previous case, the occurrence of the event r aborts the attack operation. The automaton E4 of Figure 7(d) is the defense specification. The strategy to escape the limits of the dojo is understood as a defense. Soon after the robot finds the limit, reaching states 2 or 3 of specification E4, enables the reverse event (r) and then it immediately turns into the dojo with events ge2 or gd2. Although in state 2 events r and gd2 are enabled simultaneously, the plant G5 restricts it to the sequence r and gd2. Also in state 2 or 3 of E4 while the robot is backing up, the activation of a presence sensor can now place the robot in a position to attack again.

Fig. 8. Implementation structure. The signal flow denoted by "External Events" symbolizes the events that usually occur through the intervention of sensors. Since they cannot be prevented from happening by control action, they are associated to uncontrollable events. The block denoted "Internal Events" symbolizes the events generated by the controller itself, with the controller having the ability to control them, and thus are considered as controllable events.

Doing the synchronous composition of all specifications, we obtain an automaton with 113 states and 614 transitions.

The occurrence of the external event is recorded in the controller and in the absence thereof, the controller itself generates a controllable event. The event is processed in the automaton supervisor and, if it is enabled, it sends this information to the next block. In the "Operational Sequences”, each event enabled by the Supervisor is translated into low-level sequence actions in which actuators will act directly in the process.

4.4 Supervisor Synthesis Following the monolithic approach of Ramadge and Wonham (1989), we obtained a supervisor with 56 states and 125 transitions. This automaton was minimized (Cassandras and Lafortune, 2008) by keeping the recognized language, obtaining a supervisor with 22 states and 75 transitions.

5.2 Automatic Code Generation

This system was implemented in the Microchip Dspic30F3010 microcontroller, occupying 12% of the memory.

One way to quickly create new projects is through the automatic code generation for the controller. Following the structure shown in Figure 8 is proposed an implementation flowchart as shown in Figure 9.

If the traditional method were chosen, the automaton to be implemented in the microcontroller would have 113 states and 534 transitions.

Initially, it performs a mapping of external events with uncontrollable symbolic events that are part of the supervisor automaton. Then, the occurrence of these events is stored in a buffer for further processing. It should be noted that while there are external events recorded in the buffer, the controllable events could not occur because the handling of uncontrollable events is a priority. Once the event to be processed is determined, it is verified whether the supervisor authorizes this, and if so, it moves to the model of the supervisor. Finally, the occurrence of the symbolic event is translated into a sequence of low-level operations.

5. THE IMPLEMENTATION OF THE SUPERVISORY CONTROL STRUCTURE Most studies of implementation of the supervisory control structure in real controllers are targeted for Programmable Logic Controllers (PLCs). Application of PLC in smallembedded systems becomes inappropriate because the size and characteristics of a PLC are incompatible with embedded systems. In mobile robotics, the most suitable controller is a microcontroller.

The automatic code generation has been implemented in a developed tool called DESLAB1.0 for validating this proposal. It generates code for microcontrollers from the Microchip PIC18F and dsPIC30F families. For representation of automata efficiently and with less memory occupied in the microcontroller, have been used chained lists techniques.

5.1 Implementation Structure In this project was adopted the implementation structure as shown in Figure 8.

244

2016 IFAC CPHS December 7-9, 2016. Florianopolis, Brazil César R.C. Torrico et al. / IFAC-PapersOnLine 49-32 (2016) 240–245

The validity of the proposed methodology was tested on a robot that won first place in the 2011 IEEE INTERCON Competition in Latin America and first place in the 2011 Winter Challenge Robocore in Brazil. Despite the abovedescribed technique had been applied to a sumo robot in this work, it can be naturally extended to any mobile discrete event system. Currently, the tools and methods are being applied to tracking robots and line follower robots.

START

Mapping physical events with symbolic events

Reading external events and buffering

Buffer is empty?

Y

ACKNOWLEDGMENTS

Generation of a controllable event

The first author thanks the Technological Federal University of Paraná (UTFPR) and the others would like to acknowledge the Santa Catarina State University (UDESC) and FAPESC (TO 2015 TR 647) for the support given to this work. The second author also wishes to thank CAPES and UFSC by post-doctoral fellowship (PNPD/CAPES - Graduate Program in Automation and Systems Engineering - PPGEAS/UFSC).

N To take the event which is queued in the buffer Definition of the event to be processed

The event is enabled?

245

REFERENCES

N

Cassandras, C.G., and Lafortune, S. (2008). Introduction to Discrete Event Systems, 2nd ed. Springer, New York. Jayasiri, A., Mann, G., and Gosine, R. (2009). Supervisory control of fuzzy discrete event systems and its application to mobile robot navigation, In Canadian Conf. on Electrical and Computer Eng., 1147-1151. Jayasiri, A., Mann, G., and Gosine, R. (2011). Behavior Coordination of Mobile Robotics using Supervisory control of fuzzy discrete event systems, in IEEE Transactions on Systems, 41 (5), 1224-1238. Lopes, Y.K., Trenkwalder, S.M., Leal, A.B., Dodd, T.J., and Groß, R. (2016). Supervisory control theory applied to swarm robotics. Swarm Intelligence, v. 10, p. 65-97. Ramadge, P., and Wonham, W. (1989). The control of discrete event systems. Proc. of the IEEE, 77 (1), 81-98. Robocore (2016). “Sua tecnologia à prova - combate de robôs, robot hockey, sumô de robôs, guerra de robôs.” http://www.robocore.net/. Robogames (2016). “Robolympics - the largest robot competition and expo in the United States.” http://robogames.net/. Sales, D.O., Fernandes, L.C., Osório, F.S., and Wolf, D.F. (2012) FSM-based visual navigation for autonomous vehicles. In: IEEE/RSJ Intern. Conf. on Intelligent Robots and Systems (IROS), Algarve, Portugal. Wang, X., Lee, P., Ray, A., and Phoha, S. (2005). Discrete Event Supervisory Control of a Mobile Robotic System. In Ray, A., Phoha, V.V., and Phoha, S.P. (eds.), Quantitative Measure for Discrete Event Supervisory Control, 133-156, Springer, New York. Wang, X., Mafiapragada, G., and Ray, A. (2005). Languagemeasure-based supervisory control of a mobile robot, Proc. American Control Conference. Vol. 7, 4897-4902.

Y Transit the supervisor automaton Execute operational sequences in low-level

Fig. 9. Implementation flowchart. 6. CONCLUSIONS The supervisory control theory has hardly been explored in implementing solutions using microcontrollers, and even less so in mobile robotics. Through a sumo robot for competitions, are showed a systematic procedure for the modeling, design and implementation of the supervisor in a real controller of supervisory control theory structure proposed by Ramadge and Wonham. The introduction of physical behavior restrictions in plant modeling caused the global model to become smaller. This is possible since any physically impossible or irrelevant sequence for the process is already outside the plant model. The reduction depends on the number of restrictions assigned to the plant. An advantage of this approach is the possibility of creating small models for each subsystem or specification, easy to be designed. The overall behavior can be obtained by composition of these models using a computational tool. Any additional restriction only implies an increase in the overall composition of the model. The implementation flowchart and structure along with automatic code generation provided a fast and efficient way to create new strategies for robot attack and defense, although this methodology may be applied to any embedded system.

245