ESCUELA TÉCNICA SUPERIOR DE INGENIERÍA Y SISTEMAS DE TELECOMUNICACIÓN PROYECTO FIN DE GRADO TÍTULO: Development of a Sensorimotor Algorithm Able to Deal with Unforeseen Pushes and Its implementation based on VHDL AUTOR: Pablo G. Lezcano Giménez TITULACIÓN: Grado en Ingeniería Electrónica de Comunicaciones TUTOR: Prof. Dr. Manfred Hild UNIVERSIDAD: Beuth Hochschule für Technik Berlin CENTRO: Fachbereich VII: Elektrotechnik-Mechatronik-Optometrie PAÍS: Alemania Fecha de lectura: Calificación: El Coordinador de Movilidad, 1 R ESUMEN Development of a Sensorimotor Algorithm Able to Deal with Unforeseen Pushes and Its Implementation Based on VHDL es un Proyecto de Fin de Grado (PFG) que concluye mis estudios en la Escuela Técnica Superior de Ingeniería y Sistemas de Telecomunicación de la Universidad Politécnica de Madrid. En él se documenta el trabajo de investigación que realicé en el Neurorobotics Research Laboratory de la Beuth Hochschule für Technik Berlin durante el año 2015 mediante el programa de intercambio ERASMUS. Este PFG se centra en el campo de la robótica y en concreto en un circuito electrónico llamado Cognitive Sensorimotor Loop (CSL) y su algoritmo de control basado en lenguaje de modelado hardware VHDL. La particularidad del CSL reside en que se consigue que un motor haga las veces tanto de sensor como de actuador. De esta manera es posible que las articulaciones de un robot alcancen una posición de equilibrio (p.ej. el robot se coloca erguido) sin la necesidad de sensores en el sentido estricto de la palabra. Es decir, se mide la propia fuerza electromotriz (FEM) inducida sobre el motor y el algoritmo responde de acuerdo a su magnitud. El circuito CSL se compone de un convertidor analógico-digital (ADC) y un driver. El ADC consiste en un modulador sigma-delta, que genera una serie de bits con un porcentaje de 1's y 0's determinado, en proporción a la magnitud de la FEM inducida. El algoritmo de control, que se ejecuta en una FPGA, procesa esta cadena de bits y genera una señal para el driver. El driver, que posee una topología en puente H, provee al motor de la potencia necesaria y le otorga la capacidad de rotar en cualquiera de las dos direcciones. El objetivo de este PFG es documentar los experimentos y en general el trabajo realizado en algoritmos Sensorimotor que puedan ignorar fuerzas de gran magnitud (en comparación con la gravedad) y aplicadas en una corta ventana de tiempo. En otras palabras, ignorar empujones conservando el comportamiento original frente a la gravedad. Para ello se han desarrollado dos sistemas: uno basado en umbrales parametrizados (1) y otro basado en un filtro de corte ajustable (2). El sistema (1) contiene un módulo que, en el caso de detectar un empujón, genera una señal que bloquea el algoritmo Sensorimotor. Este módulo recibe diferentes parámetros como el incremento necesario de la FEM para que se considere un empujón o la ventana de tiempo para que se considere la existencia de un empujón. El sistema (2) consiste en un filtro digital paso-bajo de respuesta infinita que corta cualquier variación que considere un empujón. Para crear este filtro se requirió un estudio sobre como implementar ciertas funciones y tipos de datos (coma fija o flotante) no soportados por las librerías básicas de VHDL. Tras esto, el objetivo fue simplificar al máximo la solución del problema, sin utilizar paquetes de librerías añadidos. En ambos sistemas aparecen una serie de ventajas e inconvenientes de interés para el documento. La estabilidad, el tiempo de reacción, la simplicidad o la carga computacional son algunas de las muchos factores a estudiar en los sistemas diseñados. Para concluir, también han sido documentadas algunas incorporaciones a los sistemas: una interfaz visual en VGA, un módulo que compensa el offset del ADC o la implementación de una batería de faders MIDI entre otras. 2 A BSTRACT Development of a Sensorimotor Algorithm Able to Deal with Unforeseen Pushes and Its Implementation Based on VHDL is the title of my thesis which concludes my Bachelor Degree in the Escuela Técnica Superior de Ingeniería y Sistemas de Telecomunicación of the Universidad Politécnica de Madrid. It encloses the overall work I did in the Neurorobotics Research Laboratory from the Beuth Hochschule für Technik Berlin during my ERASMUS year in 2015. This thesis is focused on the field of robotics, specifically an electronic circuit called Cognitive Sensorimotor Loop (CSL) and its control algorithm based on VHDL hardware description language. The reason that makes the CSL special resides in its ability to operate a motor both as a sensor and an actuator. This way, it is possible to achieve a balanced position in any of the robot joints (e.g. the robot manages to stand) without needing any conventional sensor. In other words, the back electromotive force (EMF) induced by the motor coils is measured and the control algorithm responds depending on its magnitude. The CSL circuit contains mainly an analog-to-digital converter (ADC) and a driver. The ADC consists on a delta-sigma modulation which generates a series of bits with a certain percentage of 1's and 0's, proportional to the back EMF. The control algorithm, running in a FPGA, processes the bit frame and outputs a signal for the driver. This driver, which has an H bridge topology, gives the motor the ability to rotate in both directions while it's supplied with the power needed. The objective of this thesis is to document the experiments and overall work done on push ignoring contractive sensorimotor algorithms, meaning sensorimotor algorithms that ignore large magnitude forces (compared to gravity) applied in a short time interval on a pendulum system. This main objective is divided in two sub-objectives: (1) developing a system based on parameterized thresholds and (2) developing a system based on a push bypassing filter. System (1) contains a module that outputs a signal which blocks the main Sensorimotor algorithm when a push is detected. This module has several different parameters as inputs e.g. the back EMF increment to consider a force as a push or the time interval between samples. System (2) consists on a low-pass Infinite Impulse Response digital filter. It cuts any frequency considered faster than a certain push oscillation. This filter required an intensive study on how to implement some functions and data types (fixed or floating point data) not supported by standard VHDL packages. Once this was achieved, the next challenge was to simplify the solution as much as possible, without using non-official user made packages. Both systems behaved with a series of interesting advantages and disadvantages for the elaboration of the document. Stability, reaction time, simplicity or computational load are one of the many factors to be studied in the designed systems. 3 Development of a Sensorimotor Algorithm Able to Deal with Unforeseen Pushes and Its Implementation Based on VHDL Bachelor Thesis Pablo Gabriel Lezcano Giménez Matrikelnummer: 821978 SS 2015 Betreuer BHT: Prof. Dr. Hild Gutachter: Prof. Kersten Beginn Datum: 03. August 2015 Ende Datum: 03. November 2015 Abgabe Datum: 01. September 2015 4 Acknowledgements I would like to express my gratefulness to Prof. Dr. Hild for giving me the opportunity to do my Bachelor thesis in the robotics field. My special thanks to Benjamin Panreck, my colleague and constant supervisor, for his patience guidance, encouragement and useful suggestions on my research work. To my colleague Pablo de Miguel, who became a good friend during my year in Berlin and contributed with great effort with many common features to both our theses. I would also wish to thank Marcus Janz and Christian Thiele for their great assistance in some difficulties I encountered during my work. To Stefan Bethge, Jörg Meier, Peter Hirschfeld and the rest of the Neurorobotics Research Laboratory, for making me feel integrated from day one. To my friends of the Universidad Politécnica de Madrid César, Fabi, Sancho, Fernando, Andrés, Sergio, Alberto and many others. I am particularly grateful to get to know each and every one of you and to spend countless hours both studying and having fun during the last 3 years. There's not enough money in the world to thank you, so I won't be paying any rounds. This thesis is dedicated to my sister and my parents, who supported me throughout the whole degree. 5 Abstract There's no doubt about the increasing role played by robotics in today's society. We see it every day applied to the fields of medicine, industry, consumer electronics or even art. Some of these applications are fundamentally made with the purpose of interacting between humans and machines. This human machine interaction is one of the countless parts in the field of robotics that is in continuous development. "Defying gravity - A Minimal Cognitive Sensorimotor Loop Which Makes Robots With Arbitrary Morphologies Stand Up" [1] by Prof. Dr. Manfred Hild establishes the point of departure of this thesis. It defines an electronic circuit and a VHDL algorithm that fights against varying external forces without the employment of a sensor (in its most strict definition). Sometimes the application would require to ignore some of these forces (pushes) while still considering others (gravitational force). "Development of a Sensorimotor Algorithm Able to Deal with Unforeseen Pushes and Its Implementation Based on VHDL" is a Bachelor thesis with the object of developing, experimenting and documenting a Cognitive Sensorimotor Loop (CSL) algorithm able to differentiate a pushing motion from the gravitational force and decide whether or not to work against it. This new behavior in the CSL has a whole variety of applications and advantages as energy saving or submission to assistive forces among others. This thesis converse mainly around two models, one based on parameterized thresholds and the other one based on a filter, both of them with their own limitations. This thesis, elaborated during my ERASMUS year in Berlin, concludes my bachelor studies in Electronics Engineering at the Universidad Politécnica de Madrid and Elektrotechnik/ Mechatronik at the Beuth Hochschule für Technik Berlin. In it I wrap up, among other competences, the knowledge I acquired in VHDL hardware modeling. This thesis has some common ground with the bachelor thesis "VHDL-Based System Design of a Cognitive Sensorimotor Loop (CSL) for Haptic Human-Machine Interaction (HMI)" by Pablo de Miguel Nogales and the master thesis "Entwicklung eines Adaptativen Regelungsmechanismus für die Bewegungsoptimierung modularer Aktuatoren" by Benjamin Panreck. The three theses contain some inherited work regarding data visualization among other things, while some other modules were written "as a team" to extend features which are common in the three of them. 6 Table of contents Acknowledgements .................................................................................................. 5 Abstract ................................................................................................................... 6 1. Personal motivation ........................................................................................ 10 2. Objectives ....................................................................................................... 11 3. Basics and mathematical foundations ............................................................. 11 3.1. Infinite Impulse Response (IIR) Filters ................................................................. 11 3.2. Fixed comma data type ...................................................................................... 14 4. A quick introduction to Cognitive Sensorimotor Loops (CSLs)............................ 15 5. System overview and components ................................................................... 17 6. Voltage integration. Drift in the measure ........................................................ 21 7. Drift compensations. Fixing the ΔΣ-Modulator offset ....................................... 24 7.1. Dead Zone ......................................................................................................... 24 7.2. Linear compensation ......................................................................................... 25 7.3. Measures module. Finite State Machine ............................................................. 26 8. Common modules description ......................................................................... 29 9. Faders module. Keyboard's battery of faders. .................................................. 36 10. Systems based on parameterized thresholds ................................................ 40 10.1. System overview................................................................................................ 40 10.2. Static threshold model ....................................................................................... 41 10.3. Incremental threshold model ............................................................................. 43 10.4. VHDL implementation. push_ignore.vhd ............................................................ 44 10.5. VHDL implementation. Control.vhd .................................................................... 46 10.6. Resources and power consumption. ................................................................... 51 10.7. Outlook ............................................................................................................. 52 11. System based on a push bypassing filter ...................................................... 53 11.1. System overview................................................................................................ 53 11.2. VHDL Implementation. measures.vhd ................................................................ 53 11.3. Resources and power consumption .................................................................... 56 11.4. Outlook ............................................................................................................. 57 ANNEXE 1: Video description. System based on parameterized incremental thresholds .............................................................................................................................. 58 7 ANNEXE 2: Video description. System based on a push bypassing filter ................... 59 Bibliography ........................................................................................................... 60 Statement of Autorship .......................................................................................... 60 Table of figures Figure 1: IIR discrete-time low-pass filter example..................................................................................... 11 Figure 2: Integral filtering ........................................................................................................................... 12 Figure 3: right-shift operation of a 4 bits two's complement number ........................................................ 13 Figure 4: System overview used by Prof. Dr. Hild in [1]. (figure imported from [1]) ................................... 15 Figure 5: Pulse Width Modulation example ............................................................................................... 16 Figure 6: Connection overview ................................................................................................................... 17 Figure 7: ZYBO board .................................................................................................................................. 18 Figure 8: CSL Pmod ..................................................................................................................................... 18 Figure 9: MIDI Pmod ................................................................................................................................... 18 Figure 10: MIDI keyboard ........................................................................................................................... 18 Figure 11: VGA display ................................................................................................................................ 19 Figure 12: DC motor ................................................................................................................................... 19 Figure 13: Mounting surface ...................................................................................................................... 19 Figure 14: Power supply ............................................................................................................................. 19 Figure 15: Motor structure ......................................................................................................................... 19 Figure 16: MIDI cable.................................................................................................................................. 20 Figure 17: VGA cable .................................................................................................................................. 20 Figure 18: banana cable ............................................................................................................................. 20 Figure 19: USB cable ................................................................................................................................... 20 Figure 20: Laptop ........................................................................................................................................ 20 Figure 21: Differential Voltage-bit density of Delta-Sigma modulator ....................................................... 21 Figure 22: Drift vs Sense-time ..................................................................................................................... 22 Figure 23: Delta-Sigma datasheet extract .................................................................................................. 23 Figure 24: Dead zone characteristic curve .................................................................................................. 24 Figure 25: Asymmetrical Dead Zone characteristic curve ........................................................................... 25 Figure 26: Compensation triangle .............................................................................................................. 25 Figure 27: Measure sampling ..................................................................................................................... 26 Figure 28: Measure FSM flow diagram ...................................................................................................... 27 Figure 29: ClockTree module interface ....................................................................................................... 29 Figure 30: VGA1024 module interface........................................................................................................ 30 Figure 31: GridPaper module interface ...................................................................................................... 31 Figure 32: ASCII_canvas module interface ................................................................................................. 31 Figure 33: WriteBCD module interface ....................................................................................................... 32 Figure 34: Hex_sign module interface ........................................................................................................ 32 Figure 35: ASCII_sign module interface ...................................................................................................... 32 Figure 36: WriteSigned module interface ................................................................................................... 33 Figure 37: ShowScope module interface .................................................................................................... 33 Figure 38: ShowVBar module interface ...................................................................................................... 34 Figure 39: GetMIDI module interface ......................................................................................................... 34 Figure 40: faders module interface............................................................................................................. 35 Figure 41: faders addresses of the MIDI keyboard ..................................................................................... 36 8 Figure 42: fader battery FSM ...................................................................................................................... 37 Figure 43: Parameterized thresholds simplified diagram ........................................................................... 40 Figure 44: Push detection with static threshold ......................................................................................... 41 Figure 45: False push detection with static threshold ................................................................................ 42 Figure 46: Missed push with static threshold ............................................................................................. 42 Figure 47: push detection with incremental threshold ............................................................................... 43 Figure 48: push_ignore module .................................................................................................................. 44 Figure 49: control module (thresholds model)............................................................................................ 46 Figure 50: Control FSM flow diagram ......................................................................................................... 47 Figure 51: Thresholds system resources consumption overview ................................................................ 51 Figure 52: Thresholds system resources (extended) ................................................................................... 52 Figure 53: Thresholds system power consumption ..................................................................................... 52 Figure 54: Push bypassing filter simplified diagram ................................................................................... 53 Figure 55: Filter system resources overview ............................................................................................... 56 Figure 56: Filter system resources (extended) ............................................................................................ 56 Figure 57: Filter system power consumption .............................................................................................. 57 Figure 58: switches set up on parameterized thresholds model ................................................................ 58 Figure 59: BHT_BA_Thresholdmodel_1.mp4 set up ................................................................................... 58 Figure 60: BHT_BA_Thresholdmodel_2.mp4 set up ................................................................................... 59 Figure 61: switches set up on push bypassing filter model ......................................................................... 59 Figure 62: BHT_BA_IIRfiltermodel.mp4 parameter set up ......................................................................... 60 9 1. Personal motivation Since I was very young, science fiction always caught my eye. As a kid all started with spaceship toys and films, as usual. One of these films introduced me to short stories and novels by H.G. Wells, Aldous Huxley, Isaac Asimov, George Orwell, etc. To me, robotics is making science fiction real or at least getting as close as possible, if that sounds too corny to some. When the time came to choose a field of research for my thesis, robotics seemed like the best choice. It has also a lot of professional opportunities in the fields of biomedical engineering, industry, consumer electronics, automation etc. Once I was introduced to the Neurorobotics Research Laboratory (NRL) team, I noticed that It wasn't the average workplace. The team comprehends degrees in computer science, mechatronics, industrial engineering, physics, mathematics, economics and psychology, each and every one of them playing a role to develop Myon, a humanoid autonomous robot. Working the last months in the NRL has challenged my knowledge in both electronics and VHDL hardware modeling. The second has been particularly challenging, since I am not especially fond of programming. Nevertheless, It felt really motivating to research on something that could be applied in the future to anything much more complex e.g. Myon and in the event of not having satisfying results, help the next researcher to learn from my mistakes. "Science doesn't purvey absolute truth. Science is a mechanism. It's a way of trying to improve your knowledge of nature. It's a system for testing your thoughts against the universe and seeing whether they match. And this works, not just for the ordinary aspects of science, but for all of life" - Isaac Asimov 10
Description: