Guides

A Guide by Humans, for Humans.

How To Connect with the API

With artoo can access a running API server.

Running your robot:

To test your code you can type this on your console:

artoo start myrobot.rb

or

ruby myrobot.rb

For example, on this code:

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

artoo automatically, starts the server.

How To Configure

The Artoo API server, allows a configuration for your robots.

You can set it up like this:

api :host => '127.0.0.1', :port => '4321'

Now you can run the server on the curl : http://127.0.0.1:4321.

For example:

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

Robeaux

Robeaux (/rō-bō/) is a universal dashboard to your robotic devices. Like a router admin page, but for robots.

Robeaux is powered by ReactJS, and provides a front-end to the API interface offered by Artoo

It can be accessed with a browser in the configured host and port. (Ex. http://127.0.0.1:4321/)

More information about Robeaux

Routes

GET /robots

Our first route returns all the Robots the master class knows about in JSON format.

[
  {
    "name": "SpheroBot",
    "connections": [
      {
        "name": "sphero",
        "port": "/dev/rfcomm0",
        "adaptor": "Sphero",
        "connection_id": 2778
      }
    ],
    "devices": [
      {
        "name": "sphero",
        "driver": "Sphero",
        "pin": null,
        "connection": {
          "name": "sphero",
          "port": "/dev/rfcomm0",
          "adaptor": "Sphero",
          "connection_id": 2778
        },
        "commands": [
          "detect_collisions",
          "roll",
          "set_color",
          "color",
          "stop"
        ]
      }
    ]
  }
]

GET /robots/:robotid

Given a robot's name, returns JSON information about the requested Robot:
{
  "name": "SpheroBot",
  "connections": [
    {
      "name": "sphero",
      "port": "/dev/rfcomm0",
      "adaptor": "Sphero",
      "connection_id": 2778
    }
  ],
  "devices": [
    {
      "name": "sphero",
      "driver": "Sphero",
      "pin": null,
      "connection": {
        "name": "sphero",
        "port": "/dev/rfcomm0",
        "adaptor": "Sphero",
        "connection_id": 2778
      },
      "commands": [
        "detect_collisions",
        "roll",
        "set_color",
        "color",
        "stop"
      ]
    }
  ]
}

Given a robot's name, returns JSON information about the devices belonging to the requested Robot:

[
  {
    "name": "sphero",
    "driver": "Sphero",
    "pin": null,
    "connection": {
      "name": "sphero",
      "port": "/dev/rfcomm0",
      "adaptor": "Sphero",
      "connection_id": 2778
    },
    "commands": [
      "detect_collisions",
      "roll",
      "set_color",
      "color",
      "stop"
    ]
  }
]

Given the names of a device and the robot it belongs to, returns data on the specified device.

{
  "name": "sphero",
  "driver": "Sphero",
  "pin": null,
  "connection": {
    "name": "sphero",
    "port": "/dev/rfcomm0",
    "adaptor": "Sphero",
    "connection_id": 2778
  },
  "commands": [
    "detect_collisions",
    "roll",
    "set_color",
    "color",
    "stop"
  ]
}

Given the names of a device and the robot it belongs to, returns all commands available for the specified device.

[
  "detect_collisions",
  "roll",
  "set_color",
  "color",
  "stop"
]

Given a robot name, device name, and command name, executes a robot's command and returns the result.

// example pending

Given a robot's name, returns JSON information about the connections belonging to the requested Robot:

[
  {
    "name": "sphero",
    "port": "/dev/rfcomm0",
    "adaptor": "Sphero",
    "connection_id": 2778
  }
]

Given a robot's name, returns JSON information about the connections belonging to the requested Robot:

{
  "name": "sphero",
  "port": "/dev/rfcomm0",
  "adaptor": "Sphero",
  "connection_id": 2778
}