An Application Programming Interface for the MORSE Simulator
Total Page:16
File Type:pdf, Size:1020Kb
Bachelor’s Thesis Czech Technical University in Prague Faculty of Electrical Engineering F3 Department of Control Engineering An application programming interface for the MORSE simulator Lukáš Bertl Cybernetics and Robotics: Systems and Control [email protected] January 2017 Supervisor: RNDr. Miroslav Kulich, Ph.D. Acknowledgement / Declaration I would like to express my gratitude to I hereby declare that I have complet- my supervisor RNDr. Miroslav Kulich, ed this thesis with the topic ”An ap- Ph.D. for a great mentorship, patience plication programming interface for the and wise comments that helped me com- MORSE simulator” independently and plete this project. that I have listed all sources of informa- I would like to thank my girlfriend tion used within it in accordance with and my parents for their unlimited men- the methodical instructions for observ- tal support throughout my whole stud- ing the ethical principles in the prepara- ies. tion of university theses. Finally, I thank my brother and Kač- In Prague, January ...., 2017 ka Janatková for the proofreading of this thesis. ........................................ Lukáš Bertl iii Abstrakt / Abstract Práce představuje CCMorse, což je Thesis presents the CCMorse, a simu- knihovna pro komunikaci se simuláto- lator communication library, that I have rem, kterou jsem vytvořil. Práce dále created. The thesis also describes the popisuje proces vývoje simulačního pro development process of a MORSE sim- simulátor MORSE. ulation environment. Teze probírá nejprve teorii robotic- The thesis discusses the theory of kých middleware a robotických simu- robotic middlewares and robotic sim- látorů. Dále obsahuje stručné popisy ulators first. It contains a brief intro- různých simulátorů, které jsou potom duction to various simulators which are porovnány za účelem simulování mo- compared for the purposes of simulating bilních robotů, následované popisem mobile robots, followed by a description knihovny CCMorse umožňující uživateli the CCMorse library that enables the psát klientskou applikaci v jazyce C++ user to write a client application in za použití rozhraní Player a spustit jí the C++ language using the Player v simulátoru MORSE. Ke konci text interface and run it in the MORSE popisuje začlenění simulátoru do existu- simulator. At the end, thesis illustrates jícího systému, ilustruje proces vytvo- incorporation of a simulator into the ex- ření simulované reprezentace systému isting system, it illustrates the creation a ukazuje praktické použití knihovny v process of the simulated representation kurzu zaměřeném na mobilní robotiku. of the system and it shows the practical Knihovna CCMorse může být díky usage of the library in an introductory své vícevrstvé struktuře použita i k course to mobile robotics. implementaci jiného rozhraní než Pla- CCMorse can be utilized to imple- yer rozhraní a také může být upravena ment another API on top of the Player pro podporu dalšího simulátoru mimo and it can be also altered to support MORSE. another simulator besides MORSE, Klíčová slova: mobilní robot, simu- thanks to its layered structure. lace, e-learning, výukové technologie Keywords: mobile robot, simulation, Překlad titulu: Aplikační rozhraní e-learning, learning technologies pro simulátor MORSE iv / Contents 1 Introduction ........................1 1.1 Thesis outline ....................1 2 Current state .......................2 2.1 SyRoTek..........................2 2.2 Robotic middlewares.............3 2.2.1 Player ......................4 2.2.2 ROS ........................5 2.3 Robotic simulators ...............6 2.3.1 Comparison of simulators ..7 2.4 MORSE simulator ...............8 3 CCMorse library .................. 11 3.1 Philosophy ..................... 12 3.1.1 The Core layer ........... 12 3.1.2 The Second layer......... 13 3.1.3 The Third layer .......... 14 3.2 Configuration .................. 14 3.3 Communication ................ 15 3.4 Application example ........... 16 4 Practical usage of CCMorse..... 18 4.1 Creating SyRoTek simula- tion world ...................... 18 4.1.1 Modelling of the Arena .. 20 4.1.2 Modelling of the S1R .... 22 4.2 Developing of a grid-map component ..................... 24 4.2.1 Component at the MORSE side ............. 24 4.2.2 Component at the CC- Morse side ................ 27 4.3 The Practical robotics course . 27 4.3.1 Introduction task ........ 28 4.3.2 Path planning task ...... 29 4.3.3 Exploration task ......... 30 4.4 Practical experience with MORSE ........................ 30 5 Conclusion ........................ 32 5.1 Ideas for future enhancements . 32 References ........................ 34 A Specification ...................... 37 B The contents of the CD ......... 39 C Code listings ...................... 40 C.1 robot.h ......................... 40 C.2 robot.cc......................... 41 v Tables / Figures 2.1. Overview of robotics simula- 2.1. SyRoTek arena with robots......2 tors ...............................7 2.2. Middleware location in system ..3 2.2. Comparison of suitability of 2.3. Overall system architecture simulators ........................8 of Player ..........................4 2.4. Concept of messages in ROS ....5 2.5. Indoor simulation in MORSE ...9 2.6. Outdoor of simulation in MORSE...........................9 3.1. Diagram of libCCMorse usage . 11 3.2. Diagram of libCCMorse layers . 12 3.3. Inheritance diagram of class- es in the second libCCMorse layer ............................ 13 3.4. Inheritance diagram of class- es in the third libCCMorse layer ............................ 14 3.5. Diagram of communication between CCMorse and simu- lation ........................... 15 4.1. SyRoTek Arena in Blender .... 21 4.2. Collision bounds of the S1R model ........................... 22 4.3. Model of the S1R robot in Blender ......................... 22 4.4. Rendered model of the S1R robot ............................ 22 4.5. On-the-ground canvas mode ... 26 4.6. Mini-map canvas mode ........ 26 4.7. Full-screen canvas mode ....... 26 4.8. PAR – Introduction task....... 28 4.9. PAR – Planning task .......... 29 4.10. PAR – Exploration task ....... 30 B.1. Contents of the enclosed CD .. 39 vi Chapter 1 Introduction Robotics is getting out of the laboratories and heading to become a part of everyone’s life. Near future will bring high demand for robotics specialists across industries, so universities are supporting its robotics study programmes by development of various learning systems of robotics for their students. This also provides a platform for research in this specific field. The SyRoTek system is one of them and it is used to teach and study mobile robotics at Czech Technical University in Prague. Because inexperienced students train their skills on such systems, the simulated copy of the system is needed for safety of the often expensive hardware and to speed up development of a robotic application. Students can evaluate their programs in the simulation and then fine-tune the application in the real system. Robotic simulators are getting faster and more realistic which corresponds with a rapid increase of computing power of personal computers. SyRoTek has used the Stage simulator that is no longer being developed or supported. Therefore, it has been decided to select a new simulator. The new simulator should be actively developed, it should provide a physically as well as visually realistic simulation in 3D and it should be easily incorporated into the existing system. The goal of this thesis is to show the process of developing the SyRoTek system simulation environment, and to provide an overview of the CCMorse communication library, that I have created. The CCMorse library has been designed to create an application interface between the existing system and the new simulator, so the already written algorithms will be still usable with no or with only minor changes. 1.1 Thesis outline Chapter 2 includes multiple topics. The SyRoTek system is introduced in Section 2.1 followed by a theory around robotic middleware and two middlewares demonstrated in Section 2.2. An introduction of several robotic simulators, their comparison and the selection of a new simulator for SyRoTek are located in Section 2.3. Features of the selected simulator are outlined in Section 2.4. The philosophy behind the CCMorse library is explained in Chapter 3. The process of developing a simulation environment is shown in Chapter 4, together with highlighted features of developed components, and demonstration of a set of simulation templates created for the Practical Robotics course. An evaluation of the work and the outlook for the future work are contained in the last Chapter 5. 1 Chapter 2 Current state This chapter looks into the current state of robotics simulation related systems and software. The SyRoTek system is introduced first followed by an explanation of what robotic middlewares are. Two middlewares are introduced. Several robotic simulators are presented, and their pros and cons are discussed. 2.1 SyRoTek SyRoTek [1] (”System for Robotic e-learning”) was developed at Czech Technical Uni- versity in Prague (CTU), Prague, Czech Republic, and it provides the ability to test and learn various mobile robotics algorithms created by students or scientists in a real, but closed and safe environment (for persons as well as for robots). The whole SyRoTek system consists of an arena, a group of mobile robots, web pages [2] with reservation, observational and educational interfaces, cameras for positioning and observation pur- poses