Simulation of Mobile Robots with Unity and ROS - a Case-Study and a Comparison with Gazebo
Total Page:16
File Type:pdf, Size:1020Kb
DEGREE PROJECT FOR MASTER OF SCIENCE WITH SPECIALIZATION IN ROBOTICS AND AUTOMATION DEPARTMENT OF ENGINEERING SCIENCE UNIVERSITY WEST Simulation of Mobile Robots with Unity and ROS - A Case-Study and a Comparison with Gazebo Anna Konrad A THESIS SUBMITTED TO THE DEPARTMENT OF ENGINEERING SCIENCE IN PARTIAL FULFILMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF SCIENCE WITH SPECIALIZATION IN ROBOTICS AND AUTOMATION AT UNIVERSITY WEST 2019 Date: June 12, 2019 Author: Anna Konrad Examiner: Bo Svensson Advisor: Alexander Sung and Kati Radkhah-Lens, Robert Bosch GmbH Anders Appelgren, Högskolan Väst Programme: Master Programme in Robotics and Automation Main field of study: Automation with a specialization in industrial robotics Credits: 120 Higher Education credits (see the course syllabus) Keywords: Simulation, Mobile robots, Unity, ROS, Gazebo, Physics engine Template: University West, IV-Master 2.9 Publisher: University West, Department of Engineering Science S-461 86 Trollhättan, SWEDEN Phone: + 46 520 22 30 00 Fax: + 46 520 22 32 99 Web: www.hv.se ii Summary Simulation software is becoming an increasingly important tool for automation systems both in industry and research. Within the field of mobile robotics, it is used to evaluate the per- formance of robots regarding localization, motion planning and control. In order to evaluate the performance of a mobile robot based on a simulation, the simulation must be of suffi- cient precision and accuracy. A commonly used middleware in robotics with increasing usage and importance is ROS (Robot Operating System). The community and the amount of ro- bots in industry and research that are using ROS is growing. In the ROS community, the built-in simulator Gazebo is most often used for simulating purposes. Apart from Gazebo, popular game engines, like Unity, shift more in the focus of researchers for simulating robots. Those engines provide high capabilities in customized visualisations of simulations, the user interface and for example additional plugins for machine learning. Simultaneously, the phys- ics engines which calculate the physical behaviour of objects in regard to their environment in those game engines are improving their performance. The performance of Unity as a sim- ulator in the ROS environment should be tested in this thesis work. While testing the per- formance of the simulator, its ability to adapt to different scenarios and applications should be rated. For that purpose, benchmarks were created and the results were compared to reality and Gazebo. The simulations in Unity could depict the basic behaviour of mobile robots for varying circumstances. The simulation for the specific setup in Unity was more detailed and closer to reality than the simulation in Gazebo. A major influence for that result was a non-existing controller for the wheels in Gazebo. Quantitative benchmarks showed a similar behaviour to reality in the Unity simulations. The results were highly dependent on the friction values and other simulation parameters. With the chosen setup, Unity showed systematic and non- systematic errors in the end-position of predefined paths. A SLAM case study presented the possibility to use Unity in combination with SLAM algorithms on ROS. It was possible to implement other algorithms and simulate required sensors for data acquisition in Unity. Overall, Unity was rated to be suitable for the simulation of mobile robots in robotics research if no accurate simulation of the robots’ properties is needed. Of major importance when conducting simulations with mobile robots in Unity are the used robot model and the chosen parameters in the simulation. Only if the robot model is validated, the results can be judged accordingly. To reduce the effect of the parameter settings in Unity on the results, no setups to solely examine the robot’s hardware should be chosen. Instead, the simulations can be used for testing, improving and evaluating control algorithms on the robot. A huge op- portunity is seen in the usage of automatically and synthetically generated simulation data for teaching deep learning algorithms. iii Preface This thesis work was created in cooperation with the Robert Bosch GmbH during the master program “Robotics and Automation” at University West. I would like to thank my supervi- sors at the Robert Bosch GmbH, Dr. Alexander Sung and Dr. Kati Radkhah-Lens, for guid- ing me through this thesis, helping me with my measurements and sharing their knowledge with me. For enabling me to do this master thesis at Bosch and many good words of advice, I would like to thank Dr. Ralph Lange from the Robert Bosch GmbH. Special thanks go to Musa Morena Marcusso Manhaes from the Robert Bosch GmbH for conducting the meas- urements in Gazebo. I also want to thank my supervisor, Anders Appelgren, and examiner, Dr. Bo Svensson, from University West for their support during the whole time of my studies at University West. Thank you for your dedication for your students and all the work you put into teaching us. Last but not least I would like to thank my family, which encouraged and supported me all my life. Without you, I would never got to where I am today. iv Affirmation This master degree report, Simulation of Mobile Robots with Unity and ROS, was written as part of the master degree work needed to obtain a Master of Science with specialization in Ro- botics and Automation degree at University West. All material in this report, that is not my own, is clearly identified and used in an appropriate and correct way. The main part of the work included in this degree project has not previously been published or used for obtaining another degree. __________________________________________Anna Konrad __________12.06.2019 Signature by the author Date Anna Konrad v Contents Preface SUMMARY ............................................................................................................................................ III PREFACE .............................................................................................................................................. IV AFFIRMATION ....................................................................................................................................... V CONTENTS ........................................................................................................................................... VI Main Chapters 1 INTRODUCTION ............................................................................................................................ 1 1.1 LIMITATIONS ...................................................................................................................................... 2 1.2 AIM .................................................................................................................................................. 2 2 RELATED WORK ............................................................................................................................ 4 2.1 ROS ................................................................................................................................................. 5 2.2 UNITY ............................................................................................................................................... 7 2.3 MAIN CHARACTERISTICS IN PHYSICS ENGINES ............................................................................................ 9 2.4 RESEARCH IN PHYSICS ENGINES ............................................................................................................ 10 2.5 EXPERIMENTS FOR PHYSICS ENGINE EVALUATIONS .................................................................................... 12 3 METHOD ..................................................................................................................................... 14 4 SIMULATION SETUP AND SCENARIOS ......................................................................................... 15 4.1 UNITY SETTINGS ................................................................................................................................ 15 4.2 ROSSHARP ....................................................................................................................................... 17 4.3 ROBOT MODEL ................................................................................................................................. 19 4.4 TEST SCENARIOS ................................................................................................................................ 20 5 RESULTS AND DISCUSSION ......................................................................................................... 28 5.1 STACKING TEST ................................................................................................................................. 28 5.2 COLLISION TEST ................................................................................................................................. 30 5.3 INTEGRATOR TEST .............................................................................................................................. 30 5.4 µ-SPLIT ............................................................................................................................................ 31 5.5 RAMP ............................................................................................................................................. 34 5.6 FRICTION TURN ................................................................................................................................