A Simulation-Based Study of Maze- Solving-Robot Navigation for Educational Purposes

The point of education in the early stage of studying robotics is understanding its basic principles joyfully. Therefore, this paper creates a simulation program of indoor navigations using an open-source code in Python to make navigation and control algorithms easier and more attractive to understand and develop. We propose the maze-solving-robot simulation as a teaching medium in class to help students imagine and connect the robot theory to its actual movement. The simulation code is built for free to learn, improve, and extend in robotics courses or assignments. A maze-solving robot study case is then done as an example of implementing navigation algorithms. Five algorithms are compared, such as Random Mouse, Wall Follower, Pledge, Tremaux, and DeadEnd Filling. Each algorithm is simulated a hundred times in every type of the proposed mazes, namely mazes with dead ends, loops only, and both dead ends and loops. The observed indicators of the algorithms are the success rate of the robots reaching the finish lines and the number of steps taken. The simulation results show that each algorithm has different characteristics that should be considered before being chosen. The recommendation of when-to-use the algorithms is discussed in this paper as an example of the output simulation analysis for studying robotics. Keywords—Robot simulation; Maze-solving robot; Random mouse; Wall follower; Pledge; Tremaux; Dead-end filling


I. INTRODUCTION
Robots are all forms of machines that automatically replace human effort, including those whose physic or function does not always resemble humans [1]. Some essential robot abilities are interacting with the surrounding environment and moving, conforming with it. Therefore, the robots must be equipped with navigation ability. Navigation is the process of directing a robot to pass through a specific environment [2]. The environment can be simple, like a single track, or complicated, such as a maze [3].
When the robot interacts with the environment, it needs to be equipped with an embedded algorithm in the source code. The source code contains a series of actions or reactions to an event, which can be simple logic, such as finite state machines or a series of complex systems [4].
The robot navigation needs to know the surrounding, which can be partial or a whole and has a series of control systems equipped to support [5], [6]. Some advantage automation for navigation can be used the wireless-based sensor to communicate or using some advanced vision sensor and algorithms [7], [8]. The author's previous work also emphasized indoor localization for a small object, i.e., a mobile robot based on the received signal from a wireless device [9], [10], and comparisons of certain positioning algorihm for distance or range-based [11]. We also constructed the simple line-following robot to test our algorithm for both stationary and moving robot tracking [12].
This paper discusses the maze-solving-robot algorithms by simulation. Unlike previous standards in robotics simulations, i.e., [13], [14], we are eager to explain the algorithms in visualization to students with a straightforward method. Especially students who are new to robotics can absorb the material efficiently [15]. We aim that first, the students might be interested and pay more attention to the learning process. This paper is made to demonstrate how to study and understand the robot's motion planning and navigation with a simple and interactive maze-solving simulation. Based on our concerns, a limited study shows some algorithms applied using free and straightforward software, i.e., Python [16]- [18]. With the free and open software, the funding and difficulty barriers of learning robotics at the first concern can be removed. As a learning model using this program, maze-solving algorithms are compared. With this study case, the characteristic of each algorithm is identified when it interacts with various mazes. This identification will help students implement a suitable algorithm for the maze type.
It is also the case that novice programming can learn faster by simple robotics, as proven in [19]. Simulating robots is one of the good examples that learners can use in two ways: first, study programming, and second, understand the essential part of robotics. By studying the robotics simulation to solve the maze, the learning process can be scaled up to build a straightforward robot, i.e., line-following robots. In education and robot learning, the sparks of interest in the novice learner can significantly impact the subsequent robotics learning. In the first stage, the simulation can also reduce the risk of a bug or error in the robot before building the real one [20]. This paper considered five algorithms used commonly in maze robot navigation. The algorithms are Random Mouse Algorithm (RMA), Wall Follower Algorithm (WFA) [21], [22], Pledge Algorithm (PA), Tremaux Algorithm (TA), and Dead-End Filling Algorithm (DEFA). Meanwhile, the mazes are varied based on the finish point location and whether they have dead ends, loops, or both. The maze type variation will give insight into how a robot with a particular algorithm interacts with obstruction in the maze. Another algorithm, i.e., flood filling, is similar to our variation in the maze for dead ends and loop [23], [24].
The paper is structured as follows. We introduce the paper topic in the first part of the paper. In the second part, we discussed the algorithms applied for maze-solving-robot simulation. The next part discusses the maze structures and variations. In the fourth part, we detail the simulation scenario and the implemented algorithm flowcharts. The fifth part discusses the simulation results, and lastly, we conclude the finding in the conclusion section.

II. ALGORITHMS
This paper compares the performance of the algorithms of RMA, WFA (Left and Right combined), PA (Left and Right combined), TA, and DEFA that follow the basic concept of Finite State Machine (FSM). A general example of FSM can be represented by state(s) and transition(s). Fig. 1 shows an instance of FSM with three states, namely 1 , 2 and 3 and four transitions, specifically 1 , 1 , 2 and 3 [25]. The graph nodes or circles represent the states, while the graph edges or arrows represent the transitions. For example, if there is a "start" trigger in S1, the robot state will shift from S1 to S2 and S3. Those shifting processes are called transition [25], [26].
FSM is a form of automata in robotics. It is powerful yet relatively simpler to be applied than other automata types, i.e., push down and turning machine. For robotics, FSM is sufficient to help complete a repetitive task. In this regard, FSM can help understand robot behavior as this paper's comparative study objective.

A. Random Mouse Algorithm (RMA)
RMA is an algorithm that moves robots without any specific guides. With this algorithm, the robots will go in a random direction whenever they meet an intersection. Without intersections, the robots will follow the path and never return unless they meet a dead end [4]. With its characteristics, this algorithm is considered the most unintelligent.

B. Wall Follower Algorithm (WFA)
WFA is an algorithm that moves robots using a wall as a guide. There are two types of this algorithm: Left WFA and Right WFA [3]. Like its name, the Left WFA makes the robots follow the left wall, and the right one makes the robots follow the right wall. With this algorithm, the robot may not find a way out if the followed wall is not connected to others.

C. Pledge Algorithm (PA)
Pledge Algorithm (PA) is an improved algorithm of WFA [27]. PA has two types as well, i.e., Left PA and Right PA. PA makes the robots follow the wall like WFA, but PA has a mechanism for the robots to exit a looping wall. It is possible by counting a number representing the turns. Initially, the value of this number is 0. This number will be added or subtracted by 1 (one) if the robots make a turn. For example, turning left is associated with subtraction, and turning right is associated with addition. This correspondence may be interchanged as long as it is consistent throughout the mazesolving process. This rule will automatically return the number to 0 when the robots face the original direction. When it happens, PA tells the robots to exit the followed wall by turning in the opposite direction at the next intersection. If the robot passes a turn but not an intersection, the PA algorithm then commands the to turn around and follow a wall across the previous one.

D. Tremaux Algorithm (TA)
The basic rule of Tremaux Algorithm (TA) is that robots cannot pass through a path more than twice. Therefore, TA requires robots to record their paths in memory [28]. The paths can be distinguished into three types [27]:  Unmarked, meaning that a path is not explored yet.  It was marked once, meaning that a path was passed once.  It was marked twice, meaning that a path was passed twice. If a path was marked twice, that path is considered wrong and will not be visited anymore. This marking procedure makes unnecessary multiple visits to the same path eliminated. At the end of exploration, TA leaves a continuous once-passed mark on a path connecting the starting and the finish point [27].

E. Dead-End Filling Algorithm (DEFA)
Dead-End Filling Algorithm (DEFA) is an algorithm requiring robots to know the maze before starting to explore. It can be done by equipping the robots with scanners above the maze that detect every dead end. If a dead-end is found, the scanner will mark and track it to the nearest intersection [29]. That path is then marked and will later not be visited by the robots. An intersection can be marked not to be visited as well if all the paths joining in the intersection lead to dead ends. Nevertheless, DEFA may leave an intersection with two or more unmarked paths, especially when the paths contain loops. In that case, DEFA leaves the robots unguided and makes them choose a path randomly. Ismu Rijal Fahmi, A Simulation-based Study of Maze-Solving-Robot Navigation for Educational Purposes whether the maze has dead ends, loops, or both. The first finish position is located in the maze's bottom-right corner, where the robots are said to reach finish when they exit the maze. Meanwhile, the finish location of the second type is in the center of the maze. The starting points for the bluecolored robots are the same in all the mazes, as shown in Fig.  2 to Fig. 7.

A. Bottom-Right Corner (BRC) Exit
The maze exit position is located in the bottom-right corner of each maze, as shown in Fig. 2 to Fig. 4.

B. Center Finish Point (CFP)
The algorithm needs to find the finish point in the center of the maze, as shown in Fig. 5 to Fig. 7. This paper used Python with the library of graphics.py to develop the simulation program. The way of the algorithms work was translated to the flow charts shown in Fig. 8 -Fig.  12 and run a hundred times for each maze. The flowchart of the right-wall following algorithm is the same as Fig. 9, except the left wall is replaced by the right wall. Meanwhile, the Right Pledge Algorithm has a similar flowchart, with the word "left wall" is replaced with "right wall" and "Number=Number+2" with "Number=Number-2".
In every simulation, the program notes whether the robots succeed in reaching the finish or not and the number of steps taken. The success rate shown at the end of the simulations represents the algorithm's reliability, while the taken-step numbers show how efficient the algorithm is.  Fig. 13 and Fig. 14. Fig. 13 and Fig. 14 show that RMA works for any maze, but it takes a long time to solve. It always took the most steps to solve the maze except slightly fewer than DEFA in the BRC Loop maze. Besides, DEFA is lower in the BRC with loop only because it runs as disorderedly as RMA since it cannot detect and block any dead-end in that maze. Moreover, RMA performed the worst in the CFP Loop because it took the wrong intersection most of the time and went to the edge aisles with relatively long distances. This simulation implied that RMA is suitable for a simple maze-solving robot project where speed is not essential. Fig. 13 shows that WFA is the least reliable algorithm because it will not work when the start and finish points are not connected with a continuous wall, such as CFP Mix and Loops. On the other hand, the success rate of WFA in BRC Mix is close to a quarter because there is a wall out of four that can guide the robot to the finish point. Similarly, BRC Loop has a success rate of 70% since three out of the four adjacent walls in the starting point connect with the finishing hole. However, once the WFA works, it can swiftly lead the robot, as shown in Fig. 14, since the robot will not wander the maze, similar to other algorithms. Ismu Rijal Fahmi, A Simulation-based Study of Maze-Solving-Robot Navigation for Educational Purposes the followed wall that makes the robot go through a longer path. Fig. 13 shows that TA effectively solves any mazes as it always has a 100% success rate. The results show that the speed is not affected by the maze type, as illustrated in Fig. 14. The TA algorithm focuses on the paths instead of the walls. As long as the mazes have the same size, the robot with TA needs roughly the same steps to reach the finish. Nevertheless, TA tends to explore the mazes more broadly than WFA and PA because of the random turns it takes when there is an intersection with more than one unpassed path. Fig. 11. TA flowchart According to Fig. 13, DEFA is a reliable algorithm in the same way as RMA and TA. However, DEFA is efficient only in the maze with dead ends. In other words, the more loops the maze has, the more DEFA's performance is like RMA's as it turns to a random direction when there is more than an unblocked path in an intersection. That phenomenon is seen in Fig. 14, where DEFA took the fewest steps in the CFP and BRC Dead-End while it did the most in BRC Loop. To compare our results to a recently published paper related to maze-solving robot simulation, we have a more relatively high number of data in terms of the number of steps, and we do not consider the timing process like in [30].
The discussion above is an example of the simulationoutput-data analysis that can help teachers illustrate each algorithm's characteristics or students learn robotics by themselves. As this program was developed using an opensource and simple code, they may modify and develop it according to their needs. In summary, the simulation results are shown in Table I and Table II.

VII. CONCLUSION
This paper creates simulation-based indoor navigations that can introduce robotics to students more easily and enjoyably. A comparative study of several navigation algorithms is then done using this program to know when the algorithms should be applied. The study case clearly shows that the algorithm should be chosen based on the type of maze explored. RMA will work in any mazes, but speed does not matter, and simplicity is highly considered. WFA will guide the robots rapidly to the finish if a continuous wall connects the start to the finish point. PA will be suitable if speed is essential, but the robots will encounter separated walls to reach the edge of the maze. TA is a good choice for the robots that will perform in various mazes with moderate speed, especially for mazes with many loops. Moreover, TA is a safe