Skip to content

A node.js API for interacting with an iRobot Create/Create2 or Roomba 600 Series. Because robots are fun.

Notifications You must be signed in to change notification settings

drzaiusx11/create-oi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

create-oi: iRobot Create® driver for node

An API for interacting with an iRobot Create. Because robots are fun.


The iRobot Create provides a low-level serial protocol called the "Open Interface" (OI) documented here. What this library attempts to do is implement a simple and intuitive API on top of OI in node.js using the great serialport library.

Prerequisites

  • iRobot Create (version 1 or 2)
  • Installed usb-serial drivers and connected laptop, Raspberry Pi, Gumstix or similarly node-capable machine to your Create
  • node and npm are installed (on above machine)

Installation

npm install --save create-oi

Getting Started

After plugging in your Create USB cable you'll need to find out what serial port your operating system has assigned your Create.

On linux:

$ dmesg | grep tty

On a mac:

$ ls /dev/tty.*

On a windows box, open device manager and look under "Ports":

C:\> mmc devmgmt.msc

In your code you'll probably want to start with these two lines:

var robot = require("create-oi");

robot.init({ serialport: "/dev/tty.usbserial-A2001nf6", version: 1 }); // use version: 2 if using a Create2

Make sure to set your serialport to the device name you found earlier. On my mac for me this is "/dev/tty.usbserial-A2001nf6". Yours will be different.

The API is event-based, meaning all the important stuff happens in event callbacks. The first event you'll need to deal with is the ready event which gets fired when the module sucessfully connects to the Create over the serial port. Note that the this context for all your callback handlers will be set to the create-oi module itself, so you can easily call drive, rotate or any other module method within a callback. Several events such as bump or wheeldrop will contain information about which specific sensor was triggered inside the event parameter passed into your callback function.

robot.on('ready', function() {
    // twirl towards freedom
    this.rotate(100);
});

robot.on('bump', function(bumpEvent) {
    console.log(bumpEvent.direction);
    ...
});

Examples

Working examples (provided you change the serial port) can be found in the examples directory.

API Docs

See the API Reference on the wiki.

About

A node.js API for interacting with an iRobot Create/Create2 or Roomba 600 Series. Because robots are fun.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages