Master's Thesis
Total Page:16
File Type:pdf, Size:1020Kb
Autonomous Sailboat Prototype Sensors and Electronics Implementation with Machine Learning for Navigation A Master's Thesis Submitted to the Faculty of the Escola Tècnica d'Enginyeria de Telecomunicació de Barcelona Universitat Politècnica de Catalunya by Esteban Francisco Chacón Mosquera In partial fulfilment of the requirements for the degree of MASTER IN TELECOMMUNICATIONS ENGINEERING Advisor: Rosa M. Fernández Cantí Co Advisor: José A. Lázaro Villa Barcelona, January 2021 Title of the thesis: Autonomous Sailboat Prototype Sensors and Electronics Implementation with Machine Learning for Navigation Author: Esteban Francisco Chacón Mosquera Advisor: Rosa M. Fernández Cantí Co Advisor: José A. Lázaro Villa Abstract This thesis is part of the SenSailor Project of the Facultat de Nàutica de Barcelona in which an unmanned sailboat is being built to perform scientific research in the ocean in a cost-effective manner. The thesis contributions to the SenSailor Project include the reconfiguration, communication and commissioning of sensors for environment research and navigation guidance, and the development and implementation of a machine learning model based on Deep Reinforcement Learning to actuate over the rudder and sail aileron. A virtual software environment has been developed to train and test the Artificial Intelligence model, which uses the reward of reducing the distance to a given way point as a tuning parameter. In addition, a LIDAR and a camera have been installed and configured to add computer vision for future collision avoidance navigation maneuvers. All the devices are powered by solar panels and batteries with low power techniques for self-sustainability. Finally, Wi-Fi and Bluetooth communication protocols have been developed to control the SenSailor navigation system by either the Artificial Intelligence or by human intervention. Key words: Self-manned vehicles, autonomous sailboat, Q-learning, JSON, Python Turtle, LIDAR, Internet of Things. 1 Dedication This thesis project is dedicated to God the Father and God the Mother Who help me all the way with Their invisible hands to blessed paths and allowed me to meet so many wonderful persons in the journey of learning. 2 Acknowledgements Many thanks to my thesis tutors Rosa Fernández and José Lázaro for their guidance and support that encouraged me to exploit my potential through this work and their kindness that promotes the best working environment for a successful project development. Also, a special recognition to the UPC Automatic Control Department and to the UPC Barcelona Faculty of Nautical Studies for providing us with the tools to work with the edge of technology for projects that will certainly help the world to be a better place to live and explore. I am grateful to Carles Vallès, Joan Manich and Norbert Geraldo for their help during this project. Their effort to make the project go forward, certainly will be reflected in great success. This thesis couldn’t be done without the support of my father and mother that even from faraway, will give everything to help me achieve my dreams as if they were theirs. Certainly, any success I have, would not be possible without your love. 3 Revision history and approval record Revision Date Purpose 0 21/11/2020 Document creation 1 22/01/2020 Document revision 2 28/01/2020 Document revision Written by: Reviewed and approved by: Date 21/01/2021 Date 28/01/2021 Name Esteban Chacón Name Rosa Fernández Cantí Position Project Author Position Project Supervisor Reviewed and approved by: Date 28/01/2021 Name Jose A. Lázaro Position Project Co-advisor 4 Table of contents Abstract ............................................................................................................................ 1 Dedication ........................................................................................................................ 2 Acknowledgements .......................................................................................................... 3 Revision history and approval record ................................................................................ 4 Table of contents .............................................................................................................. 5 List of Figures ................................................................................................................... 7 List of Tables .................................................................................................................... 9 1. Introduction .............................................................................................................. 10 1.1. Requirements and specifications ...................................................................... 11 1.2. Statement of purpose ....................................................................................... 11 1.3. Previous work ................................................................................................... 14 2. State of the art of the technology used in this thesis ................................................ 16 2.1. Hardware .......................................................................................................... 16 2.1.1. Raspberry pi .............................................................................................. 16 2.1.2. Arduino ...................................................................................................... 17 2.1.3. ESP32 ....................................................................................................... 18 2.2. Software development ...................................................................................... 18 2.2.1. Python ....................................................................................................... 18 2.2.2. Arduino IDE ............................................................................................... 19 2.2.3. JSON......................................................................................................... 19 2.2.4. Notepad++ ................................................................................................ 19 2.3. Artificial Intelligence .......................................................................................... 20 2.3.1. Machine learning models ........................................................................... 21 2.3.1.1. Supervised Learning ............................................................................... 21 2.3.1.2. Unsupervised Learning ........................................................................... 21 2.3.1.3. Reinforcement Learning .......................................................................... 22 2.3.2. Turtle ......................................................................................................... 23 2.3.3. Artificial Intelligence for ships navigation ................................................... 24 3. Methodology / project development ......................................................................... 25 3.1. Hardware Design .............................................................................................. 25 3.1.1. Computation and roles .............................................................................. 25 3.1.1.1. LIDAR ..................................................................................................... 26 5 3.1.1.2. Raspberry Pi NoIR Camera ..................................................................... 27 3.2. Software Design ............................................................................................... 28 3.2.1. Developer tools ......................................................................................... 28 3.2.2. Code design .............................................................................................. 29 3.2.3. Data management ..................................................................................... 30 3.2.3.1. Communication between Arduino and Raspberry Pi ................................ 31 3.2.3.2. Communication between Raspberry Pi and GPS .................................... 31 3.2.3.3. Communication between Raspberry Pi and ESP32 ................................. 32 3.2.3.4. Data in the Raspberry Pi ......................................................................... 32 3.3. Power Management ......................................................................................... 33 3.3.1. Raspberry Pi 4 Low Power Techniques ..................................................... 34 3.3.2. Arduino ONE Low Power Techniques........................................................ 34 3.3.3. ESP32 low power techniques .................................................................... 34 3.4. Network Design ................................................................................................ 34 3.5. Artificial Intelligence .......................................................................................... 35 3.5.1. Model Development ................................................................................... 36 3.5.2. Simulation on Turtle Python ....................................................................... 38 3.5.3. Training the model with the GPU ............................................................... 40 3.5.4. Machine vision development ..................................................................... 41 3.5.4.1. LIDAR ....................................................................................................