Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How to build Open Hardware self-navigating car robot

How to build Open Hardware self-navigating car robot

Slides from my lecture at mDevCamp Prague 2016 about How to build a Open Hardware self-navigating car robot #Probee using RaspberryPi and Arduino, Multi-Agent Systems and actor programming in Ruby.

The presentation includes small overview of few AI techniques and a short introduction to Behavior Trees.

Source codes of the #Probee robot can be found at https://github.com/Juicymo/probee

Tomas Jukin

June 17, 2016
Tweet

More Decks by Tomas Jukin

Other Decks in Technology

Transcript

  1. How to build
    Open Hardware Robot
    with Arduino, RaspberryPi and Hot Glue
    Tomáš Jukin
    @Inza

    View full-size slide

  2. Tomáš Jukin
    @Inza
    www.juicymo.cz
    @JuicymoCZ

    View full-size slide

  3. True evolution…

    View full-size slide

  4. True evolution…
    GDG ohwHack 2014 mDevCamp 2016

    View full-size slide

  5. True evolution…
    GDG ohwHack 2014 mDevCamp 2016

    View full-size slide

  6. Robotics 101

    View full-size slide

  7. Robotics 101
    Micro-Computer
    vs.
    Micro-Controller

    View full-size slide

  8. Robotics 101
    Micro-Computer
    vs.
    Micro-Controller

    View full-size slide

  9. Robotics 101
    Micro-Computer
    vs.
    Micro-Controller

    View full-size slide

  10. Robotics 101
    Micro-Computer
    vs.
    Micro-Controller
    Voltage: 3.3V
    Flash: SD card
    RAM: 512 MB (CPU & GPU)
    CPU: ARM11 (BCM2835 SoC)
    Clock: 700 MHz
    GPIO: 40 pin
    HDMI, Ethernet
    RaspberryPi 1
    B+
    Arduino
    UNO
    Voltage: 5V
    Flash: 32KB (-0.5 bootloader)
    SRAM: 2KB
    EEPROM: 1KB
    Clock: 16 MHz
    Digital I/O: 14/6 PWM
    Analog In: 6

    View full-size slide

  11. Robotics 101
    ways of communication

    View full-size slide

  12. Robotics 101
    IIC (i2c, I2C, I2C)
    Inter-Inter Circuit, 2 wires, <128 devices, <2m
    ways of communication

    View full-size slide

  13. Robotics 101
    IIC (i2c, I2C, I2C)
    Inter-Inter Circuit, 2 wires, <128 devices, <2m
    ways of communication
    Serial Peripheral Interface, N+3 wires, N devices
    SPI

    View full-size slide

  14. Robotics 101
    IIC (i2c, I2C, I2C)
    Inter-Inter Circuit, 2 wires, <128 devices, <2m
    ways of communication
    Serial Peripheral Interface, N+3 wires, N devices
    Universal Asynchronous Receiver/Transmitter, 2 wires, 2 devices, <20m
    SPI
    UART

    View full-size slide

  15. Robotics 101
    IIC (i2c, I2C, I2C)
    Inter-Inter Circuit, 2 wires, <128 devices, <2m
    ways of communication
    Serial Peripheral Interface, N+3 wires, N devices
    Universal Asynchronous Receiver/Transmitter, 2 wires, 2 devices, <20m
    Full Serial Line, 9 wires, 2 devices, <20m
    RS-232 (COM port)
    SPI
    UART

    View full-size slide

  16. Robotics 101
    IIC (i2c, I2C, I2C)
    Inter-Inter Circuit, 2 wires, <128 devices, <2m
    ways of communication
    Serial Peripheral Interface, N+3 wires, N devices
    Universal Asynchronous Receiver/Transmitter, 2 wires, 2 devices, <20m
    Full Serial Line, 9 wires, 2 devices, <20m
    RS-232 (COM port)
    Industry, 2 wires, <32 devices, <1200m
    RS-485 (EIA-485)
    SPI
    UART

    View full-size slide

  17. Robotics 101
    IIC (i2c, I2C, I2C)
    Inter-Inter Circuit, 2 wires, <128 devices, <2m
    ways of communication
    Serial Peripheral Interface, N+3 wires, N devices
    SPI
    UART
    Industry, 2 wires, <32 devices, <1200m
    RS-485 (EIA-485)
    Universal Asynchronous Receiver/Transmitter, 2 wires, 2 devices, <20m
    Full Serial Line, 9 wires, 2 devices, <20m
    RS-232 (COM port)

    View full-size slide

  18. What does a
    4 wheels self driving car robot
    consist of?

    View full-size slide

  19. 1x RaspberryPi 1 B+ Starter Set https://goo.gl/jaTY70
    1x Chinese 4WD Car Kit with Funduino UNO http://goo.gl/qetuW5
    5x Ultrasonic Sensor HC-SR04 http://goo.gl/YojTTp
    1x Wi-Fi dongle D-Link DWA-127 https://goo.gl/9d9BPo
    1x Arduino Micro https://goo.gl/yjVqgC
    1x I2C Level Converter http://goo.gl/9i4jCK
    1x RTC module DS1307 http://goo.gl/esKm7t
    1x PIR sensor HC-SR501 http://goo.gl/LyYGmb
    1x 4D Touch TFT Display 4DPi-35 Rev. 1 http://goo.gl/RWs7rI
    1x Skewers
    1x Hot Glue
    *plus PiCamera and PowerBank to power Pi… (and cables)

    View full-size slide

  20. http://goo.gl/tnXteh

    View full-size slide

  21. I2C
    USB
    PWM
    12V

    View full-size slide

  22. I2C
    SPI
    USB
    PWM
    12V

    View full-size slide

  23. I2C
    SPI
    USB
    PWM
    PWM
    12V

    View full-size slide

  24. I2C
    SPI
    USB
    PWM
    PWM
    12V

    View full-size slide

  25. I2C
    SPI
    USB
    PWM
    PWM
    12V

    View full-size slide

  26. I2C
    SPI
    USB
    I2C
    PWM
    PWM
    12V

    View full-size slide

  27. I2C
    SPI
    USB
    I2C
    PWM
    PWM
    12V

    View full-size slide

  28. I2C
    SPI
    USB
    I2C
    PWM
    PWM
    12V

    View full-size slide

  29. I2C
    SPI
    USB
    I2C
    PWM
    PWM
    12V
    I2C
    PWM

    View full-size slide

  30. I2C
    5V USB 7V
    5V
    3.3V

    View full-size slide

  31. The Heart
    Hardware

    View full-size slide

  32. The Heart
    Hardware
    HAL

    View full-size slide

  33. The Heart
    Hardware
    HAL
    Events

    View full-size slide

  34. The Heart
    Hardware
    HAL
    Events
    Pre-Emptive
    Multi-Tasking

    View full-size slide

  35. The Heart
    Hardware
    HAL
    Events
    Pre-Emptive
    Multi-Tasking
    Config

    View full-size slide

  36. How do we develop in
    Arduino?

    View full-size slide

  37. Wiring / Processing

    View full-size slide

  38. 5 Circles of Hell

    View full-size slide

  39. 5 Circles of Hell
    in Arduino

    View full-size slide

  40. 5 Circles of Hell
    in Arduino
    .ino includes

    View full-size slide

  41. 5 Circles of Hell
    in Arduino
    .ino includes
    LCD_i2c.h

    View full-size slide

  42. 5 Circles of Hell
    in Arduino
    .ino includes
    LCD_i2c.h
    Crappy China goods

    View full-size slide

  43. 5 Circles of Hell
    in Arduino
    .ino includes
    LCD_i2c.h
    Crappy China goods
    HW bugs

    View full-size slide

  44. 5 Circles of Hell
    in Arduino
    .ino includes
    LCD_i2c.h
    Crappy China goods
    HW bugs
    The need of switch

    View full-size slide

  45. v0 - Procedural (by MacGyver on ohwHack)
    The Heart

    View full-size slide

  46. v0 - Procedural (by MacGyver on ohwHack)
    The Heart
    v0.5 - “Spagetka” (was to ugly to Git -> lost :-(…)

    View full-size slide

  47. v0 - Procedural (by MacGyver on ohwHack)
    The Heart
    v0.5 - “Spagetka” (was to ugly to Git -> lost :-(…)
    v1 - “Spagetti MAS” (in Git repo)

    View full-size slide

  48. v0 - Procedural (by MacGyver on ohwHack)
    The Heart
    v0.5 - “Spagetka” (was to ugly to Git -> lost :-(…)
    v1 - “Spagetti MAS” (in Git repo)
    v2 - “The Platform” (in Git repo, in progress)

    View full-size slide

  49. v0 - Procedural (by MacGyver on ohwHack)
    The Heart
    v0.5 - “Spagetka” (was to ugly to Git -> lost :-(…)
    v1 - “Spagetti MAS” (in Git repo)
    v2 - “The Platform” (in Git repo, in progress)
    https://github.com/Juicymo/probee

    View full-size slide

  50. http://goo.gl/lZuAzn

    View full-size slide

  51. https://goo.gl/OhNByp
    I2C

    View full-size slide

  52. https://goo.gl/QzYRjs
    https://goo.gl/lG0ggl
    I2C

    View full-size slide

  53. How do we develop
    for RaspberryPi?

    View full-size slide

  54. But not only. It is a full
    featured* Linux.

    View full-size slide

  55. But not only. It is a full
    featured* Linux.
    *running on ARM… :-(

    View full-size slide

  56. 5 Circles of Hell

    View full-size slide

  57. 5 Circles of Hell
    in RaspberryPi

    View full-size slide

  58. 5 Circles of Hell
    in RaspberryPi
    USB driven computer

    View full-size slide

  59. 5 Circles of Hell
    in RaspberryPi
    USB driven computer
    Unstable

    View full-size slide

  60. 5 Circles of Hell
    in RaspberryPi
    USB driven computer
    Unstable
    More features madness

    View full-size slide

  61. 5 Circles of Hell
    in RaspberryPi
    USB driven computer
    Unstable
    More features madness
    Wi-Fi dongle

    View full-size slide

  62. 5 Circles of Hell
    in RaspberryPi
    USB driven computer
    Unstable
    More features madness
    Unstable!!!
    Wi-Fi dongle

    View full-size slide

  63. Multi-Agent System
    The Brain
    build on a
    Actor-based concurrent
    object framework in Ruby
    https://github.com/Juicymo/probee

    View full-size slide

  64. The Brain
    Raspbian

    View full-size slide

  65. The Brain
    Raspbian
    rvm

    View full-size slide

  66. The Brain
    Raspbian
    rvm
    ruby

    View full-size slide

  67. The Brain
    Raspbian
    rvm
    ruby
    celluloid

    View full-size slide

  68. The Brain
    Raspbian
    rvm
    ruby
    celluloid
    agens

    View full-size slide

  69. The Brain
    Raspbian
    rvm
    ruby
    celluloid
    agens
    probee MAS

    View full-size slide

  70. The Brain
    Raspbian
    rvm
    ruby
    celluloid
    agens
    probee MAS
    https://github.com/Juicymo/probee
    https://rubygems.org/gems/agens
    https://github.com/celluloid/celluloid
    https://rvm.io

    View full-size slide

  71. The Brain
    Object
    Ruby OOP

    View full-size slide

  72. The Brain
    Object
    Cell
    Ruby OOP
    Celluloid

    View full-size slide

  73. The Brain
    Object
    Cell
    Actor
    Ruby OOP
    Celluloid
    Celluloid

    View full-size slide

  74. The Brain
    Object
    Cell
    Actor
    Agent
    Ruby OOP
    Celluloid
    Celluloid
    agens

    View full-size slide

  75. The Brain
    Object
    Cell
    Actor
    Agent
    MovementAgent
    Ruby OOP
    Celluloid
    Celluloid
    agens
    probee

    View full-size slide

  76. The Brain
    MovementAgent
    Probee MAS

    View full-size slide

  77. The Brain
    Motors
    MovementAgent
    Probee MAS

    View full-size slide

  78. The Brain
    Motors
    SteeringAgent
    MovementAgent
    Probee MAS

    View full-size slide

  79. The Brain
    Motors
    Sensors
    SteeringAgent
    MovementAgent
    Probee MAS

    View full-size slide

  80. The Brain
    Motors
    Sensors
    CollisionAgent
    SteeringAgent
    MovementAgent
    Probee MAS

    View full-size slide

  81. The Brain
    Motors
    Sensors
    CollisionAgent
    SteeringAgent
    MovementAgent
    Probee MAS

    View full-size slide

  82. The Brain
    Motors
    Sensors
    CollisionAgent
    SteeringAgent
    MovementAgent
    Probee MAS
    Simple Agents can
    perform complex tasks

    View full-size slide

  83. How to make AI Logic
    Scripting
    HFSM Heuristics
    MAS GA ANN
    HTN

    View full-size slide

  84. How to make AI Logic
    Scripting
    HFSM Heuristics
    MAS GA ANN
    HTN
    ?

    View full-size slide

  85. HFSM
    Movement FSM
    Stop Drive Slowly Drive Fast

    View full-size slide

  86. HFSM
    Movement FSM
    Stop Drive Slowly Drive Fast
    Turn Turret FSM
    Stop Scan Target

    View full-size slide

  87. HFSM
    Movement FSM
    Stop Drive Slowly Drive Fast
    Turn Turret FSM
    Stop Scan Target
    How to combine them??

    View full-size slide

  88. HFSM
    Movement FSM
    Stop Drive Slowly Drive Fast
    Turn Turret FSM
    Stop Scan Target
    How to combine them??
    Modularity sucks too…

    View full-size slide

  89. How to make AI Logic
    Scripting
    HFSM Heuristics
    MAS GA ANN
    HTN
    ?

    View full-size slide

  90. How to make AI Logic
    Scripting
    HFSM Heuristics
    MAS GA ANN
    HTN
    Behavior Trees

    View full-size slide

  91. Behavior Trees
    http://aigamedev.com/open/article/bt-overview/
    http://behavior3js.guineashots.com/
    http://aigamedev.com/open/article/behavior-trees-part1/

    View full-size slide

  92. Neural Nets
    HFSM
    MAS
    HTN
    Behavior Trees
    https://github.com/Inza/agens
    https://en.wikipedia.org/wiki/Multi-agent_system
    https://github.com/aasm/aasm
    https://en.wikipedia.org/wiki/Finite-state_machine
    https://github.com/Maumagnaguagno/HyperTensioN
    https://en.wikipedia.org/wiki/Hierarchical_task_network
    https://github.com/jvoegele/behavior_tree
    https://en.wikipedia.org/wiki/Behavior_tree
    https://github.com/SergioFierens/ai4r
    https://en.wikipedia.org/wiki/Artificial_neural_network

    View full-size slide

  93. Tomáš Jukin
    @Inza
    www.juicymo.cz
    @JuicymoCZ

    View full-size slide