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

BathRuby on Robots

BathRuby on Robots

Andrew Nesbitt

June 12, 2014
Tweet

More Decks by Andrew Nesbitt

Other Decks in Programming

Transcript

  1. Controlling
    Robots with Ruby

    View full-size slide

  2. Andrew Nesbitt
    @teabass
    github.com/andrew

    View full-size slide

  3. Controlling
    Robots with Ruby

    View full-size slide

  4. Lower
    Barriers

    View full-size slide

  5. http://artoo.io

    View full-size slide

  6. http://celluloid.io

    View full-size slide

  7. require 'artoo'


    connection :arduino, :adaptor => :firmata, 

    :port => '/dev/cu.usbmodem1411'

    device :led, driver: :led, pin: 9


    work do

    loop do

    led.toggle

    sleep 1

    end

    end
    Hello World

    View full-size slide

  8. Sparkfun Inventors Kit
    hobbytronics.co.uk/sparkfun-inventors-kit-v3

    View full-size slide

  9. Sparkfun Inventors Kit
    hobbytronics.co.uk/sparkfun-inventors-kit-v3

    View full-size slide

  10. Sumobot
    http://www.pololu.com/catalog/product/2506

    View full-size slide

  11. !
    require 'artoo'
    !
    connection :arduino, :adaptor => :firmata, :port => '/dev/cu.usbmodem1411'
    !
    device :board, :driver => :device_info
    device :left_motor, :driver => :motor,
    :forward_pin => 6, # hack!
    :backward_pin => 8,
    :speed_pin => 10
    !
    device :right_motor, :driver => :motor,
    :forward_pin => 6, # hack!
    :backward_pin => 7,
    :speed_pin => 9
    !
    MAX_SPEED = 60
    !
    connection :keyboard, adaptor: :keyboard
    device :keyboard, driver: :keyboard, connection: :keyboard

    View full-size slide

  12. def keypress(sender, key)
    puts key
    case key
    when 'left'
    left_motor.backward MAX_SPEED
    right_motor.forward MAX_SPEED
    when 'right'
    left_motor.forward MAX_SPEED
    right_motor.backward MAX_SPEED
    when 'up'
    left_motor.forward MAX_SPEED
    right_motor.forward MAX_SPEED
    when 'down'
    left_motor.backward MAX_SPEED
    right_motor.backward MAX_SPEED
    when 'space'
    left_motor.stop
    right_motor.stop
    end
    end
    !
    work do
    puts "Ready!"
    on keyboard, :key => :keypress
    end

    View full-size slide

  13. AR Drone
    http://ardrone2.parrot.com

    View full-size slide

  14. require 'artoo'


    connection :ardrone, :adaptor => :ardrone, :port => '192.168.1.1:5556'

    device :drone, :driver => :ardrone, :connection => :ardrone


    work do

    drone.start

    drone.take_off


    after(10.seconds) { drone.hover.land }

    after(15.seconds) { drone.stop }

    end
    AR DRONE

    View full-size slide

  15. Sphero
    https://github.com/hybridgroup/artoo/blob/master/examples/conway_sphero.rb

    View full-size slide

  16. Dance Dance Drone

    View full-size slide

  17. Lego Controlled Rabbit

    View full-size slide

  18. http://gobot.io
    Gobot

    View full-size slide

  19. http://cylonjs.com
    Cylon

    View full-size slide

  20. Thanks!
    code: github.com/andrew/artoo-experiments
    slides: speakerdeck.com/andrew/bathruby-on-robots

    View full-size slide