Pusat Khidmat Makiumat Aka' UNIVERSITI MALAYSIA SARF
94300 Kula Samarahan
A ROBOTWALL SIMULATOR
P. KHIDMATMAKLUMATAKADEMIK UNIMAS
uummniuimiiiui
1000133690HOR KENG SENG (Software Engineering)
This project is submitted in partial fulfillment of
the requirements for the degree of Bachelor of Computer Science with Honours
Faculty of Computer Science and Information Technology UNIVERSITI MALAYSIA SARAWAK
2005
ACKNOWLEGDEMENT
This final year project would not have been successful without the contribution of many individuals for their kind support and help. Therefore, I would like to take this opportunity deeply indebted to those peoples in the realization of this project.
First of all, I appreciate the help and support from my beloved supervisor, Madam Eaqerzilla Pang, who had sacrificed a lot of time and effort to lead and guide me during the development of this project.
Secondly, I would like to thank my co-operative supervisor, Assoc. Prof. Narayanan Kulathuramaiyer for his kind support, guidance and abundant ideas.
Finally, I would like to thank to my dearest family, who had offer unlimited morale and financial supports in the development of this project. Once again, I would like thanks to everyone that helped me in realizing this project. Thank you!
Ill
TABLE OF CONTENTS
DECLARATION
ACKNOWLEDGEMENT TABLE OF CONTENTS
LIST OF FIGURES LIST OF TABLES ABSTRACT ABSTRAK
CHAPTER 01: INTRODUCTION
Page
11
III iv-xi xii-xiii xiv
xv
xvi
1.0 Introduction I
1.1 Overview 1
1.1.1 Research Background 1
1.1.2 Why This Project's Worth 2
1.2 Problem Statement 3
1.2.1 Problem for a RW Moving Forward 4
1.2.2 Problem for a RW Turning a Corner 4
1.2.3 Problem for a RW While Too Far or Too Close From the Wall 4 1.2.4 Problem for a RW Turn Toward, Away From and Parallel to
Closest Wall 4
1.3 Proposed Solution 4
1.3.1 Solution to a RW Moving Forward 5
1.3.2 Solution to a RW Turning a Corner 5
iv
1.3.3 Solution to a RW While Too Far or Too Close From the Wall 5 1.3.4 Solution to a RW Turn Toward, Away From and Parallel to
Closest Wall 5
1.4 Objectives 6
1.5 Scope of Study 6
1.6 Procedures/Methodologies 7
1.7 Significant of Research 8
1.7.1 Solve Janitorial Problem 8
1.7.2 Help Human Conduct Difficult Jobs 8
1.7.3 Firefighting 8
1.7.4 Security 9
1.8 Project Schedule 9
1.9 Outline Of The Project 10
1.9.1 Chapter 01 1.9.2 Chapter 02 1.9.3 Chapter 03 1.9.4 Chapter 04 1.9.5 Chapter 05 1.9.6 Chapter 06 1.9.7 Chapter 07
10
10 10 11 11 12 121.10 Conclusion 12
CHAPTER 02: RESEARCH BACKGROUND
2.0 Literature Review 13
V
2.1 Introduction
2.2 Definitions and Concepts
2.2.1 The Term "Robot" and "Robotics"
2.2.2 The Word "Wall"
2.2.3 The Term "Simulator"
2.2.4 RobotWall Simulator (RWS) 2.3 History of Robotic
2.4 Current System Study A) 2D Robot Simulator
2.4.1 WSU Khepera Robot Simulator v7.0 (WSU KRSv7) 2.4.2 Saphira/Pioneer Robot Simulator (S/PRS)
2.4.3 EyeSim Robot Simulator B) 3D Robot Simulator
2.4.4 GLBot Mobile Robot Simulator (GLBot v3.921) 2.4.5 Webots 2.0 Robot Simulator
2.5 Comparison of Reviewed System 2.6 Artificial Intelligence (AI)
2.6.1 Gamma-Level Intelligence (Heuristic) 2.6.2 Al-Based Problem Solving
2.6.3 Genetic Algorithm (GA)
2.6.4 Metric Path Planning (Quantitative Navigation) 2.7 Reviews on Other Algorithms
2.8 Implementation Tools Study
2.8.1 C++ Object-Oriented Programming
13 13 13
14 1515 16
1617 17
18
2021
2122
24 24 25 27 27 38 28 2929
vi
2.8.2 Java Object-Oriented Programming 2.8.3 Comparison between Java and C++
2.9 Proposed System
2.9.1 Determine the Locus of Wall 2.9.2 GA Algorithm
2.9.2.1 Advantages of GA 2.9.3 Backtracking
2.9.4 Proposed Implementation Tool 2.10 Conclusion
CHAPTER 03: DETAILED REQUIREMENTS AND METHODS OF
INVESTIGATION
3.0 Introduction
3.1 Methodology Approaches 3.2 System Design
3.2.1 User Interface Design 3.2.2 2D Interface
3.2.3 Object-oriented Design (OOD) 3.2.4 Class Design
3.3 System Implementation
3.3.1 System or Program Logic
3.3.2 Algorithm in Artificial Intelligence (AI) 3.3.3 Stages of Implementation
3.4 Evaluation
30
30 31
31 3234 35 36 36
38
3940
40 41 41 41 4242
4243
43vii
3.5 Conclusion
CHAPTER 04: SYSTEM DESIGN
4.0 Introduction4.1 Bird Eye's View
4.1.1 Five Major Preparatory Steps for GP 4.2 Robot Simulation Design Concept
4.3 Key Features of Good Design in RWS 4.3.1 Identify Bottleneck
4.3.2 Flexibility and Extensibility 4.4 Object-oriented Design
4.4.1 Use Case Diagram 4.4.2 Sequence Diagram
4.4.2.1 Description of Sequence Diagram 4.4.3 Activity Diagram
4.4.3.1 Experimenter Activity Diagram 4.4.3.2 RobotWall Activity Diagram 4.4.4 Object Model (Class Diagram) 4.5 Conclusion
CHAPTER 05: SYSTEM IMPLEMENTATION 5.0 Introduction
5.1 Implementation Coverage 5.1.1 Genetic Programming
44
45 45
45 47
4949
49 4950
51 5154 54
55 57 5859 59
59
viii
5.1.2 Flowchart of Genetic Programming 5.2 Fitness Function
5.3 Selection
5.4 Genetic Operators 5.4.1 Reproduction 5.4.2 Crossover 5.5 RobotWall 5.6 Room
5.7 Collision Detection
5.8 Design of Experiment (DOE) 5.8.1 DOE 1
5.8.2 DOE 2 5.8.3 DOE 3 5.8.4 DOE 4 5.8.5 DOE 5 5.9 Conclusion
CHAPTER 06: SYSTEM TESTING AND EVALUATION 6.0 Introduction
6.1 Important of Testing
6.2 Software Quality Assurance
6.2.1 Evolving Wall-following Behaviors 6.2.2 RobotWall Movement
6.2.3 Room Painting
60
61 62 63 63 64 65 67 68 69
7070 70 71
71 7172 72 72
73 73
73IX
6.3 Line Chart
6.3.1 Experiment Results for DOE 1 6.3.2 Experiment Results for DOE 2 6.3.3 Experiment Results for DOE 3 6.3.4 Experiment Results for DOE 4 6.3.5 Experiment Results for DOE 5 6.4 Experiment Results and Comparison 6.5 Approximations Problem
6.6 Disadvantages of GA 6.6.1 Deception Problem 6.6.2 Fitness Function 6.7 Conclusion
CHAPTER 07: CONCLUSION AND FUTURE WORK
74
7475 76
7879 80 80
8181
81 817.0 Introduction 82
7.1 Achievement
82
7.1.1 To Study Wall-following Problem 82
7.1.2 Create an Intelligent Program 82
7.1.3 Niche Targetability and Ease of Portability to Other Domains 83
7.1.4 To Study Genetic Algorithm 83
7.1.5 To Use an Object-oriented Design Method 84 7.1.6 A Prototype Program
7.2 Future Work 7.3 Conclusion
84 84 85
X
REFERENCES BIBLIOGRAPHIES APPENDICES
APPENDIX A - PROJECT SCHEDULE
APPENDIX B - REVIEWS ON OTHER ALGORITHMS APPENDIX C - DESCRIPTION OF USE CASE DIAGRAM APPENDIX D - SEQUENCE DIAGRAM
APPENDIX E - DESCRIPTION OF CLASS DIAGRAM APPENDIX F - DOE'S EXPERIMENT RESULTS APPENDIX G - DOE'S EXPERIMENT SNAPSHOTS
86 90
91 92
95100 104 112 120
127XI
LIST OF FIGURES
Page
Figure 2.1: WSU Khepera Robot Simulator v7.0 18
Figure 2.2: EyeSim Robot Simulator 21
Figure 2.3: GLBot Mobile Robot Simulator v3.921 22
Figure 2.4: Webots 2.0 Robot Simulator 24
Figure 2.5: Fixed-wall and robot with eight sensors located in the middle of the room 32
Figure 4.1: Bird's Eye View of 2D RWS Design 48
Figure 4.2: RobotWall Simulator Use Case Diagram 50
Figure 4.3: Activity Diagram to Show Experimenter Activities 55 Figure 4.4: Activity Diagram to Show RobotWall Activities 56 Figure 4.5: Class Diagram of RobotWall Simulator Program 57 Figure 5.1: The flowchart of Genetic Programming in RWS 61
Figure 5.2: The Reproduction Operation 63
Figure 5.3: The Crossover Operation 65
Figure 5.4: The Robot Position with Red Solid Oval 67
Figure 5.5: Room with 120 tiles on periphery showing robot at its starting position (8, 8) 68 Figure 6.1: Line Chart of DOE 1
Figure 6.2: Line Chart of DOE 2 Figure 6.3: Line Chart of DOE 3 Figure 6.4: Line Chart of DOE 4 Figure 6.5: Line Chart of DOE 5
Figure D 1: Set Room Sequence Diagram Figure D2: Run GA Sequence Diagram
75 76 77 78 79
104
105xii
Figure D3: Move Forward Sequence Diagram Figure D4: Move Backward Sequence Diagram Figure D5: Turn Left Sequence Diagram
Figure D6: Turn Right Sequence Diagram Figure D7: Clear Steps Sequence Diagram Figure D8: Rebuild Sequence Diagram
106 107
108
109 110 111X111
LIST OF TABLES
Table 2.1: Comparison of Review Robot Simulator Table 2.2: Comparison between Java and C++
Table F1: 20 Experiment Results of DOE 1 Table F2: 20 Experiment Results of DOE 2 Table F3: 20 Experiment Results of DOE 3 Table F4: 20 Experiment Results of DOE 4 Table F5: 20 Experiment Results of DOE 5
Page
26
31 120 121 122 124 125XIV
ABSTRACT
This report is written to study the Genetic Algorithm (GA) that applies to the development of mobile robot wall-following behaviors. The purpose of the study is to have a better understanding and a practical experience in robotic fields. GA has presented to be effective procedures for solving wall-following problems. These algorithms are developed for a simulated robot that uses an array of range finders for navigation. It mimics the model of natural evolution and has the ability to adaptively search large spaces in near-optimal ways.
Also, this report will describe the use of genetic programming and path planning techniques to the task of evolving robot behaviors for wall-following problem. This experiment involves 30 x 20 grids with four extrusions were designed and implemented to test the scalability of GA to the solution. These experiments show that GA is capable to automatically produce algorithms for wall-following task.
xv
ABSTRAK
Laporan ini telah ditulis untuk membuat kajian tentang Algorithma Genetik (GA) yang telah diaplikasikan ke dalam perkembangan tingkah laku "dinding robotik". Kajian ini bertujuan untuk mendapat pemahaman yang lebih mendalam dan pengalaman yang lebih praktikal dalam bidang robotik. GA telah menjadi satu panduan kepada prosedur yang lebih efektif dalam usaha penyelesaian masalah "dinding robotik". Kesemua algorithma ini diperkembangkan selaras dengan simulasi robotik yang digunakan dalam bidang pencarian navigasi dalam sesuatu kawasan. Ia menyerupai modul evolusi yang bersifat alam semulajadi serta mempunyai kebolehupaya untuk mencari ruang yang lebih luas dan secara adaptif apabila ia lebih menyerupai sifat optimal.
Selain itu, laporan ini turut menerangkan penggunuan program genetik dan teknik laluan perancangan dalam bidang yang melibatkan tingkah laku robot untuk bidang penyelesaian permasalahan yang mencari dinding. Eksperimen ini melibatkan 30x20 grids serta empal ekstrusi yang telah direkabentuk dan diaplikasikan uniuk mengkaji kebolehupaya skala penyelesaian. Kesemua eksperimen ini telah menunjukkan bahawa GA berupaya untuk
menghasilkan algorithma dalam bidang penyelesaian "dinding robotik" secara automatik.
xvi
CHAPTER 01: INTRODUCTION
1.0 Introduction 1.1 Overview
Everyone has heard about the term `robot', and it has become common in manufacturing facilities all around the world. But, not everyone is really sure about the meaning of a robot. Therefore, as a software engineering student, the project will be introducing a robot simulation prototype program to allow people to know more about what simulated robot actually is. Also, the prototype program is designed based on basic user interface so that it will not cause any difficulty when a user uses this prototype program.
Hence, this chapter will show an in depth introduction of the basic knowledge that will be used in the project. The knowledge that will be applied in this prototype program are the fundamental study of the research problem, purposes or objectives of the research study, scope of the study, methodologies that will be used in this research study and the significance of the research study. In addition, a project schedule and the outline of each chapter of this report will be included to make this interim report throughout the development of this project.
1.1.1 Research Background
This report is produced for the Final Year Project with the title `A RobotWall Simulator' (RWS). This prototype program is a wall-following program, which is using wall-following behavior or algorithm to perform its functionality. It will outline
1
the program that would keep a robot within a certain range of the walls of an enclosure. The term "robot" generally connotes some human-like (anthropomorphic) appearance; consider robot "arms" for welding. An intelligent robot is a mechanical creature which can function autonomously.
This project demonstrates the used of genetic algorithm or genetic (evolutionary) programming to design and develop this proposed RWS. This algorithm will lay out the fundamental of the solution for planned follow-on projects such as map generation, maze traversal and so forth. This project will then give a positive result to show sufficient promise to warrant further research into more complex and large projects.
1.1.2 Why This Project's Worth
This topic is chosen to be my Final Year Project because it will fulfill the objectives of the degree requirement. Hence, the project will include several methodologies such as an object-oriented analysis and design, object-oriented programming and so forth to develop this RWS. This project is worth implementing because robots are well-suited for applications where a human is a significant risk such as nuclear, space and military. The economics or menial nature of the application results in inefficient use of human workers such as service industry and agriculture. Also, this project is good for humanitarian uses where there are great risks, for example, demining an area of land mines, urban search and rescue.
2
Robot cannot make many decisions and receives little or no sensory input in present- day. So, this project will enlarge the possibilities of using the Robotic Technology in terms of machine learning and artificial intelligence (AI) in RWS to answer to the robot's problem that cannot be solved. Al is used in this project so that the RobotWall (RW) can do things like a human can. It means that the RW will follow the shape of the designed wall as a human being wall through it.
Robotics application has become a tool for a little more than 30 years. According to Grant Fjermedal, "I met the tomorrow makers.. . Among them are the greatest scientists, and they are in a desperate race to be first at downloading the contents of the human mind into a computer housed within a robotic body so that we will never have to die... Others expressed a fear that what was now being created was in fact a new species that might soar beyond its human creators to become our evolutionary successors. " [5] Therefore, this RWS can be used in future work and will improve quality, enhance safety, and so forth.
1.2 Problem Statement
RWS will face different direction of movements when navigating in a desired closed room. In order to develop this prototype program, it must first figure out the requirements and the problem faced. Below are those problem statement faced and the proposed solution to this project:
3
1.2.1 Problem for a RW Moving Forward
When RW moves along the wall, it will not know whether there is a wall in the front or at a corner.
1.2.2 Problem for a RW Turning a Corner
The RW will not know whether to turn left or turn right by itself when the RW have reached a corner. Such case is possible to occur in this corner area. This means that it will hit the wall from the side and front at the same time.
1.2.3 Problem for a RW While Too Far or Too Close From the Wall
This will happen when the robot is too far or too close from the wall. If it is too far, the robot would not know where the position and direction is. If the robot is too close to the wall, then the steps are as the above but the condition is now too close rather than within acceptable range.
1.2.4 Problem for a RW Turn Toward, Away From and Parallel to Closest Wall
Here is another three problems that will be faced by a RW in this project. The RW itself needs to think whether to turn towards or turn away from or turn parallel to the closest wall.
1.3 Proposed Solution
Every problem statement must have at least one solution to solve it. At this point, all the possible inputs and outputs will be formulating appropriate reactions that the RW
4
should have in each specific problem area. Below are the suggested solutions that will be applied into this proposed RWS:
1.3.1 Solution to a RW Moving Forward
To solve this problem, it is just set to return to 1 if RW completes this without hitting.
Otherwise, return to zero. If the RW collides with a wall, movement stops at that point, it means that the RW is not allowed to move into or through the walls.
1.3.2 Solution to a RW Turning a Corner
The proposed solution is by rotating the RW 90 degrees to the right; return angle robot is now facing the left corner. When the robot is at the right corner, follow the same steps to turn right, excepted turn left 90 degrees.
1.3.3 Solution to a RW While Too Far or Too Close From the Wall
To solve this problem, it needs to set an acceptable range (in the corridor range), say 10 to 20 units (1 or 2 grids). This function will then repeatedly execute itself within this range. If the robot goes out of the range, it will return to zero by the function.
1.3.4 Solution to a RW Turn Toward, Away From and Parallel to Closest Wall
In such circumstances, the RW will be set to find the closest wall and turn to face it if it is towards closest wall. For RW turn away from the wall, it will be set to find the closest wall. Also, to turn parallel to the closest wall, find the closest wall first, and then turn 45 degrees sensor is facing the wall. All three conditions will return angle RW its facing position.
5
1.4 Objectives
The design of RWS is to discover the key principles by which how brains work and to implement these in artificial systems that interact intelligently with the real world.
Below are the objectives of this project:
To study wall-following problem.
" Create an intelligent program.
" Niche targetability and ease of portability to other domains.
" To study genetic algorithm.
" To use an object-oriented design method.
" A prototype program.
1.5 Scope of Study
The scope of this study is to create a genetic algorithm (evolutionary programming) program that will then be applied to this proposed RWS. Since this project is time
constraint and only one person is developing the whole project, therefore, the limitation of the study in this project is that it only concentrates on one robot that will follow the wall at one time during the process. Also, the shape of the wall will be fixed at all times when the program runs each time. It means that other phenomenons such as hitting between two or more robots are not included here. And, hitting two or more times to the wall for the robot is also not covered here.
This RWS project is to navigate the RW through open spaces until it encounters a wall. Then, it will navigate along the wall at some fairly constant distance. In this
6
project, the robot will traverse the entire circumference of its environment at least
once without straying either too close, or too far from the wall.
To test these navigation algorithms, a two-dimensional simulated environment is designed by using GP. Hence, this environment will only have a complete enclosed room with walls. Each individual algorithm from the GP population is tested in the same room in a sequence times. Therefore, this prototype program will be scored on how well it performs the wall-following the behavior by applying this genetic algorithm.
1.6 Procedures/Methodologies
The study on RWS is limited to the technologies and concepts that will be used to develop this simulation. There are many procedures and methodologies used to design a successful prototype.
In this RWS project, the suggestion is to use Object-Oriented System Development Life Cycle (OOSDLC) to analyze it. Hence, Object-Oriented Analysis (OOA), Object- Oriented Design (OOD), and Object-Oriented Programming (OOP) will be applied to this project. In the evaluation phase, it will use the Rapid Application Development
(RAD) and Incremental Testing to analyze and test the program. In addition, CASE tools such as Rational Rose will be used to develop the design prototype program.
In addition, the study of the concept of Human Computer Interaction (HCI) will also be included in this project to ensure its usability. By interaction design, Winograd
7
(1997) discusses it as "the design of spaces for human communication and interaction. " [3] This means that this project will apply the design of an interactive system to support people when in their working lives every day. Also, HCI can make sure this prototype program will meet the usability criteria and user experience.
1.7 Significance of Research
This project is developed to study the performance of GP in robotic fields to evolve the movements of a robot in wall-following problem.
1.7.1 Solve Janitorial Problem
One such activity is janitorial work, especially maintaining public rest rooms, which has a high turnover of personnel regardless of pay scale.
1.7.2 Help Human Conduct Difficult Jobs
This project can be applied to manufacturing companies, where repetitious activities in unpleasant surroundings make human workers inefficient or expensive to retain. One reason is that it is an unpleasant job for a human to work in such working environment that includes working in a hot environment, carrying sweaty and tedious work with a low tolerance for inaccuracy.
1.7.3 Firefighting
This activity is hazardous work for human beings. This project can help humans to fight fires in dangerous situations which are very dangerous especially to the firefighters. In addition, it also could survive some conditions that will kill the human
8
beings when this project integrates with other systems to make a robot firefighter. For example, the robot firefighter will not be affected when faced with extremely heavy smoke and very low levels of oxygen inside the area.
1.7.4 Security
This RWS is an intelligent simulator which may be applied to other systems to come out with an intelligent system that can perform dangerous patrols. In this case, that robot can move faster and remain alert better if compared with humans. Therefore, it can also be instructed to inform a human security person if it found something amiss.
1.8 Project Schedule
This project is divided into two phases to complete the entire related chapter that is starting from Chapter 1 until Chapter 7. The outline of every chapter will be discussed in the next section.
During the first phase, the report has to come out with a research on the RWS that will include some introduction of the proposed project, comparison for the similar existing system and so forth. Here it needs to hand in the first two chapters, which are the Overview of Introduction and Literature Review, as an interim report. For the second phase, it includes Chapter 3 to Chapter 7. After that, a final report for this project will be produced and handed in. This project started on Ist April 2004 and will end on 8th April 2005.
9