• Stars
    star
    1,533
  • Rank 29,364 (Top 0.6 %)
  • Language
    Ruby
  • License
    Other
  • Created over 11 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Ruby framework for robotics, drones, and the Internet of Things (IoT)

Artoo

http://artoo.io/

Artoo is a micro-framework for robotics using Ruby.

Artoo provides a simple, yet powerful Domain-Specific Language (DSL) for robotics and physical computing.

Want to use JavaScript on robots? Check out our sister project Cylon.js (http://cylonjs.com)

Want to use the Go programming language to power your robots? Check out our sister project Gobot (http://gobot.io).

Code Climate Build Status

Examples:

Basic

Arduino with an LED and a button, using the Firmata protocol.

require 'artoo'

connection :arduino, :adaptor => :firmata, :port => '/dev/ttyACM0'
device :led, :driver => :led, :pin => 13
device :button, :driver => :button, :pin => 2

work do
  on button, :push => proc {led.toggle}
end

Parrot ARDrone 2.0

require 'artoo'

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

work do
  drone.start
  drone.take_off

  after(25.seconds) { drone.hover.land }
  after(30.seconds) { drone.stop }
end

Modular

You can also write more modular class-oriented code, that allows you to control swarms of robots:

require 'artoo/robot'

SPHEROS = ["4567", "4568", "4569", "4570", "4571"]

class SpheroRobot < Artoo::Robot
  connection :sphero, :adaptor => :sphero
  device :sphero, :driver => :sphero

  work do
    every(3.seconds) do
      sphero.roll 90, rand(360)
    end
  end
end

robots = []
SPHEROS.each {|p|
  robots << SpheroRobot.new(:connections =>
                              {:sphero =>
                                {:port => p}})
}

SpheroRobot.work!(robots)

Ruby versions supported: Ruby 2.1, Ruby 2.0, Ruby 1.9.3, JRuby 1.7.4+, and Rubinius 2.1+

Rubinius requires 1.9 mode, to install Rubinius in 1.9 mode using rvm

rvm get head && rvm install rbx-2.1.1 --1.9

Artoo is conceptualy influenced by Sinatra as well as borrowing some code from it.

Artoo provides a robust actor-based messaging architecture, that can support fully multi-threaded operation and high-concurrency, as long as it is supported by the Ruby version in which it is executing. This means you will need to use JRuby or Rubinius for maximum concurrency.

To a large extent, this is due to being built on top of Celluloid, Celluloid::IO, and Reel.

Hardware support:

Artoo has a extensible system for connecting to hardware devices. The following robotics and physical computing platforms are currently supported:

More platforms are coming soon!

Artoo also has support for devices that can work across multiple hardware platforms.

  • GPIO (General Purpose Input/Output) devices <=> Drivers
  • i2c devices <=> Drivers

Do you have some hardware that is not yet supported by Artoo? We want to help you, help us, help them! Get in touch...

Getting Started:

Installation

gem install artoo

Then install the gems required by the hardware you want to use. For example, if you wanted to integrate a PS3 controller to fly your ARDrone:

gem install artoo-joystick
gem install artoo-ardrone

If you will be using socket to serial commuication (required if you will use JRuby or Rubinius), you are ready to start programming your hardware.

If you want to connect via serial port directly, and are using MRI, install the hybridgroup-serialport gem:

gem install hybridgroup-serialport

Writing your robot code:

Now you are ready to write your own code. Take a look at the examples directory for a whole bunch of code you can use to help get started. We recommend using TDR (Test-Driven Robotics) with your preferred test frameworks.

Running your robot:

ruby myrobot.rb

API:

Artoo includes a RESTful API to query the status of any robot running within a group, including the connection and device status, and device streaming data via websockets.

To activate the API, use the api command like this:

require 'artoo'

connection :loop
device :passthru
api :host => '127.0.0.1', :port => '4321'

work do
  puts "Hello from the API running at #{api_host}:#{api_port}..."
end

Once the robot or group is working, you can view the main API page at the host and port specified.

Test-Driven Robotics:

Artoo makes it easy to do Test Driven Development (TDD) of your robotic devices using your favorite Ruby test and mocking frameworks.

Here is an example that uses Minitest, Mocha, and Timecop:

require './test_helper'
require './test_robot'

describe 'sphero' do
  let(:robot) { Artoo::MainRobot.new }
  let (:start) { Time.now }

  before :each do
    Timecop.travel(start)
    robot.work
  end

  after :each do
    Timecop.return
  end

  it 'has work to do every 3 seconds' do
    robot.has_work?(:every, 3.seconds).wont_be_nil
  end

  it 'receives collision event' do
    robot.expects(:contact)
    robot.sphero.publish("collision", "clunk")
    sleep 0.05
  end

  it 'must roll every 3 seconds' do
    Timecop.travel(start + 3.seconds) do
      robot.sphero.expects(:roll)
      sleep 0.05
    end
    Timecop.travel(start + 6.seconds) do
      robot.sphero.expects(:roll)
      sleep 0.05
    end
  end
end

to describe the following Sphero robot:

require 'artoo'

connection :sphero, :adaptor => :sphero, :port => '127.0.0.1:4560'
device :sphero, :driver => :sphero

def contact(*args)
  @contacts ||= 0
  @contacts += 1
  puts "Contact #{@contacts}"
end

work do
  on sphero, :collision => :contact

  every(3.seconds) do
    sphero.roll 90, rand(360)
  end
end

The repo with full example of using Artoo for test driven robotics is located at https://github.com/hybridgroup/artoo-test-example

CLI

Artoo uses the Gort http://gort.io Command Line Interface (CLI) so you can access important features right from the command line. We call it "RobotOps", aka "DevOps For Robotics". You can scan, connect, update device firmware, and more!

Artoo also has its own CLI so you can generate new robots, or use its console.

$ artoo
Commands:
  artoo console ROBOT                # Run a robot using the Robi console
  artoo generate SUBCOMMAND ...ARGS  # Generates a new robot or adaptor
  artoo help [COMMAND]               # Describe available commands or one specific command
  artoo install SUBCOMMAND ...ARGS   # Installs utility programs
  artoo start ROBOT                  # Run a robot
  artoo version                      # Displays the current version

Console:

Artoo includes a console based on Pry to allow you to interactively debug and control your robot.

$ artoo console ./examples/hello.rb
         run  robi ./examples/hello.rb from "."
I, [2013-07-03T17:11:35.793913 #5527]  INFO -- : Registering connection 'loop'...
I, [2013-07-03T17:11:35.794939 #5527]  INFO -- : Preparing work...
robi> start
Starting main robot...
I, [2013-07-03T17:11:48.950888 #5527]  INFO -- : Initializing connection loop...
I, [2013-07-03T17:11:48.955804 #5527]  INFO -- : Starting work...
I, [2013-07-03T17:11:48.956152 #5527]  INFO -- : Connecting to 'loop' on port '#<Artoo::Port:0xfea0>'...
robi> list
#<Artoo::MainRobot:0x100c0>
robi> hello
hello
hello
robi> stop
Stopping robots...
robi> exit
D, [2013-07-03T17:12:04.413060 #5527] DEBUG -- : Terminating 7 actors...
D, [2013-07-03T17:12:04.414300 #5527] DEBUG -- : Shutdown completed cleanly

Generator

Want to integrate a hardware device we don't have Artoo support for yet? There's a generator for that! You can easily generate a new skeleton Artoo adaptor to help you get started. Simply run the 'artoo generate adaptor' command, and the generator will create a new directory with all of the files in place for your new adaptor gem.

$ artoo generate adaptor awesome_device
Creating artoo-awesome_device adaptor...
      create  artoo-awesome_device
       exist  artoo-awesome_device
      create  artoo-awesome_device/Gemfile
      create  artoo-awesome_device/LICENSE
      create  artoo-awesome_device/README.md
      create  artoo-awesome_device/Rakefile
      create  artoo-awesome_device/artoo-awesome_device.gemspec
      create  artoo-awesome_device/lib/artoo-awesome_device.rb
      create  artoo-awesome_device/lib/artoo-awesome_device/version.rb
      create  artoo-awesome_device/lib/artoo/adaptors/awesome_device.rb
      create  artoo-awesome_device/lib/artoo/drivers/awesome_device.rb
      create  artoo-awesome_device/test/adaptors/awesome_device_adaptor_test.rb
      create  artoo-awesome_device/test/drivers/awesome_device_driver_test.rb
      create  artoo-awesome_device/test/test_helper.rb
Done!

Documentation

Check out our documentation for lots of information about how to use Artoo.

If you want to help us with some documentation on the site, you can go to artoo.io branch and then, follow the instructions.

IRC

Need more help? Just want to say "Hello"? Come visit us on IRC freenode #artoo

Contributing

  • All patches must be provided under the Apache 2.0 License
  • Please use the -s option in git to "sign off" that the commit is your work and you are providing it under the Apache 2.0 License
  • Submit a Github Pull Request to the appropriate branch and ideally discuss the changes with us in IRC.
  • We will look at the patch, test it out, and give you feedback.
  • Avoid doing minor whitespace changes, renamings, etc. along with merged content. These will be done by the maintainers from time to time but they can complicate merges and should be done seperately.
  • Take care to maintain the existing coding style.
  • Add unit tests for any new or changed functionality.
  • All pull requests should be "fast forward"
    • If there are commits after yours use “git rebase -i <new_head_branch>”
    • If you have local changes you may need to use “git stash”
    • For git help see progit which is an awesome (and free) book on git

(c) 2012-2016 The Hybrid Group

More Repositories

1

gobot

Golang framework for robotics, drones, and the Internet of Things (IoT)
Go
8,734
star
2

gocv

Go package for computer vision using OpenCV 4 and beyond. Includes support for DNN, CUDA, and OpenCV Contrib.
Go
6,284
star
3

cylon

JavaScript framework for robotics, drones, and the Internet of Things (IoT)
JavaScript
3,979
star
4

gabba

Simple way to send server-side notifications to Google Analytics
Ruby
464
star
5

gort

Command Line Interface (CLI) for RobotOps
Go
434
star
6

kidsruby

KidsRuby is a Ruby programming environment meant for kids to learn and have fun!
JavaScript
333
star
7

taskmapper

Taskmapper provides a universal API to bug tracking and project management systems using Ruby
Ruby
218
star
8

rubyserial

FFI Ruby library for RS-232 serial port communication
Ruby
154
star
9

mechanoid

Mechanoid is a framework for WebAssembly applications on embedded systems and IoT devices.
Go
145
star
10

node-bebop

A Node.js client for controlling Parrot Bebop & Bebop2 quadcopters.
JavaScript
144
star
11

robeaux

Universal dashboard to robotic devices based on React
CSS
125
star
12

GitHub-Wikifier

A pre-commit Git Hook that will generate all the Table of Contents you will ever need. Just write your content, and let it take over.
Shell
100
star
13

gitnesse

Acceptance testing with Cucumber using a git-based wiki to store feature stories
Ruby
88
star
14

cppp-io

Common Protocol for Programming Physical Input and Output
72
star
15

cylon-raspi

Cylon adaptor for the Raspberry Pi
JavaScript
69
star
16

go-ncs

Go language bindings for the Intel Movidius Neural Compute Stick
Go
49
star
17

watchbot

Pebble watch app to control robotic devices
JavaScript
46
star
18

cylon-sphero

Cylon adaptor for Sphero robot
JavaScript
46
star
19

cylon-firmata

Cylon adaptor for the Firmata protocol
JavaScript
45
star
20

artoo-arduino

Artoo adaptor for the Arduino microcontroller.
Ruby
45
star
21

tinyglobo

A pico balloon floats into the great big world, towing a RP2040 Pico programmed with TinyGo
Go
42
star
22

kidsruby-class-1

Class notes for KidsRuby Class 1
Ruby
40
star
23

gophercon-2019

Go
37
star
24

cylon-intel-iot

Cylon adaptors for the Intel Edison & Galileo
JavaScript
36
star
25

cylon-leapmotion

Cylon adaptor for the Leap Motion
JavaScript
35
star
26

gophercar

Gophercar is a DIY platform for self-driving miniature cars using the Go programming language.
Go
32
star
27

artoo-raspi

Artoo adaptor for the Raspberry Pi
Ruby
32
star
28

commander

Mobile application to control robots
JavaScript
30
star
29

cylon-ble

Cylon.js adaptor/drivers for Bluetooth LE
JavaScript
29
star
30

cylon-neurosky

Cylon adaptor/driver for the Neurosky Mindwave
JavaScript
28
star
31

cylon-sphero-ble

Cylon.js driver for the Sphero BB-8 & Sphero Ollie robots
JavaScript
26
star
32

gophercon-2017

Hardware hack day support info for Gophercon 2017 and beyond!
Go
26
star
33

cvscope

Experimental CLI tool for visually exploring video image filters and algorithms that are part of OpenCV. Written in Go using GoCV.
Go
25
star
34

artoo-sphero

Artoo adaptor for the Sphero robot.
Ruby
24
star
35

cylon-spark

Cylon adaptor for the Spark core device
JavaScript
24
star
36

cylon-octoblu

Cylon adaptor/driver for the Octoblu machine to machine messaging system
JavaScript
23
star
37

gophercon-2018

Gophercon hardware hackday
Go
22
star
38

cylon-opencv

Cylon adaptor and driver for OpenCV
JavaScript
20
star
39

cylon-beaglebone

Cylon adaptor for the Beaglebone Black single board computer
JavaScript
20
star
40

artoo-ardrone

Artoo adaptor for the ARDrone 2.0 quadcopter
Ruby
20
star
41

cylon-bebop

Cylon.js driver/adaptor for Parrot Bebop drone
JavaScript
19
star
42

cylon-gpio

Cylon drivers for GPIO devices
JavaScript
19
star
43

cylon-crazyflie

Cylon adaptor/driver for the Crazyflie nanocopter
JavaScript
18
star
44

cylon-ardrone

Cylon adaptor and drivers for the Parrot ARDrone 2.0
JavaScript
17
star
45

gopherbot

A robotic gopher plushie that you can code using TinyGo.
Go
17
star
46

kidsrubyinstaller-osx

KidsRuby installer for OSX
Shell
16
star
47

cylon-api-socketio

Cylon.js API plugin for Socket.io
JavaScript
15
star
48

gobot-firmata

Gobot adaptor for the Firmata protocol
Go
14
star
49

cylon-mip

Cylon.js driver for MIP
JavaScript
13
star
50

cylon-site

Website for Cylon.js - JavaScript robotics framework using Node.js
HTML
13
star
51

kidsruby-os

KidsRuby helps kids learn to program using the awesome language Ruby anywhere they go, just bring their own USB drive, plug in, and reboot.
Ruby
13
star
52

cylon-tessel

Cylon adaptor for the Tessel
JavaScript
13
star
53

artoo-opencv

Artoo drivers for OpenCV computer vision library
Ruby
12
star
54

artoo-leapmotion

Artoo adaptor for the Leap Motion controller
Ruby
11
star
55

taskmapper-redmine

Ticketmaster provider for Redmine API
Ruby
11
star
56

cylon-api-http

Cylon.js API plugin for http/https
JavaScript
11
star
57

cylon-i2c

Cylon.js drivers for i2c devices
JavaScript
11
star
58

kidsrubyinstaller-windows

KidsRuby installer for Windows
Ruby
10
star
59

mechanoid-examples

Examples written using Mechanoid framework for WASM-based embedded development.
Go
10
star
60

kidsruby-examples

KidsRuby examples
Ruby
10
star
61

gobot-gpio

Gobot drivers for GPIO devices
Go
9
star
62

gobot-site

Website for Gobot - Golang framework/set of libraries for robotics and physical computing
Haml
9
star
63

gobot-spark

Gobot adaptor for the spark core
Go
9
star
64

kidsruby-site

Have fun and learn Ruby programming for free! Works on any computer.
CSS
9
star
65

cylon-speech

Cylon adaptor/driver for the eSpeak Text To Speech software
JavaScript
8
star
66

gopherboat

Robotic boat programmed using TinyGo
Go
8
star
67

gobot-beaglebone

Gobot adaptor for the Beaglebone Black development board
Go
8
star
68

cylon-joystick

Cylon adaptor and driver for HID joysticks/controllers
JavaScript
8
star
69

artoo-roomba

Artoo adaptor for the Roomba robot.
Ruby
8
star
70

artoo-pebble

Artoo adaptor for the Pebble smart watch
Ruby
8
star
71

artoo-spark

Artoo adaptor for the Spark core device
Ruby
8
star
72

kidsruby-cookbooks

KidsRuby Chef recipes used for build server
Ruby
7
star
73

cylon-hue

Cylon.js adaptor/driver for Phillips Hue
JavaScript
7
star
74

cylon-mqtt

Cylon.js adaptor/driver for MQTT protocol
JavaScript
7
star
75

hacklab-2019

GoLab 2019 "HackLab" for hardware hacking using Go
Go
7
star
76

cylon-audio

Cylon.js adaptor/driver for audio
JavaScript
6
star
77

cylon-rapiro

Cylon adaptor/driver for the Rapiro bipedal robot
JavaScript
6
star
78

hashcode

Just a little fun project to chart the results of #code2014
Ruby
6
star
79

taskmapper-github

Ticketmaster provider for Github ticket system
Ruby
6
star
80

taskmapper-unfuddle

Ticketmaster provider for Unfuddle
Ruby
6
star
81

artoo-joystick

Artoo adaptor and driver for any SDL joystick
Ruby
6
star
82

artoo-gpio

Artoo standard drivers for GPIO devices
Ruby
6
star
83

gobot-sphero

Gobot adaptor for Sphero robot
Go
5
star
84

artoo-neurosky

Artoo adaptor/drivers for the Neurosky Mindwave Mobile
Ruby
5
star
85

gobot-dotgo-2017

Gobot workshop for dotGo
Go
5
star
86

gobot-opencv

Go
5
star
87

artoo-keyboard

Artoo adaptor/driver for keyboard interaction
Ruby
5
star
88

taskmapper-lighthouse

Ticketmaster provider for Lighthouse
Ruby
5
star
89

gophercon-2022

Hardware hack session at Gophercon 2022
Go
5
star
90

taskmapper-basecamp

Ticketmaster provider for 37 Signals' Basecamp
Ruby
5
star
91

gobot-ardrone

Gobot adaptor and drivers for the Parrot ARDrone 2.0
Go
5
star
92

cylon-chip

Cylon.js adaptor for the C.H.I.P. $9 computer
JavaScript
5
star
93

cylon-wiced-sense

Cylon.js driver for WICED Sense
JavaScript
5
star
94

phonegap-cylon-spark

An phonegap app to control spark with cylon
CSS
5
star
95

gdg-2019

Hardware hack session at the GDG Leads Summit 2019
Go
5
star
96

cylon-keyboard

Cylon adaptor and driver for keyboard input
JavaScript
5
star
97

taskmapper-assembla

Ticketmaster provider for Assembla API
Ruby
4
star
98

gopherconeu-2022

Go
4
star
99

gocv-site

The website for GoCV
HTML
4
star
100

cylon-powerup

Cylon.js driver for Powerup 3.0 glider
JavaScript
4
star