Saturday, November 16, 2013

iRobot Create: Getting Started

Introduction

This is the first section of a tutorial I wrote for use in classes here at Tennessee Tech. The purpose of the tutorial is to teach the users the basics of operating an iRobot Create. The Create is an affordable mobile robot platform that incorporates sensors, motor drivers, and other control systems. It is very well documented and has been used extensively by many people. 

Sections


Reference Documents

These documents should be referenced for details on interfacing with the Create
  • iRobot Create Open Interface Manual (OIM)- This manual provides detailed information on the serial interface with the Create. It details the implementation of the opcode system used to control the various systems as well as the necessary measures that must be taken to receive sensor data from the Create. Information regarding sensor packet size, connector pinouts, and command details can be found here.
  • iRobot Create User Manual - This manual provides an introduction to the basic functions of the Create and an overview of the basic onboard functionality

Necessary Hardware


Necessary Software


Getting Started: Using OI Commands

OI commands are sent to the Create via a serial connection. For a first example, we will send the these commands from a PC using a terminal program called RealTerm. Basic information regarding this interface can be found on page 11 of the the Create User Manual.

Connect Create

The Create communicates via the computer's serial port. Connect the Create as shown below using the white serial tether. This tether handles the logic level shifts necessary for the Create to communicate with the computer safely and connects only to the mini-DIN connector on the side of the Create, above the charging port. Note that serial cable extensions may be used to increase the Create's tether length. It is also important to note that nothing should be connected to the Create's cargo bay port at this time. Connected electronics can interfere with serial communications on the other port.

Configure RealTerm

Open RealTerm. Configure the serial settings to 57600 baud, 8 data bits, 1 stop bit, and no flow control. Select the “Send” tab on RealTerm. 

Control LEDs

This string of commands will turn on the Create's Play LED
128 131 139 2 0 0 [Send]
  • 128 - This is the first Opcode. It starts the OI. This command must always be entered before sending other commands or the Create will ignore them.
  • 131 - This Opcode puts the Create in "Safe" Mode. This enables the user to control the iRobot Create without removing safety critical sensor lockouts.
  • 139 - This Opcode controls the LEDs on the Create. When received, the Create listens for 3 data bytes
    • 2 - This byte tells the Create to light the Play LED. Details on OIM pg 9. In binary, 2 = 00000010 (Play LED), 8 = 00001000 (Advance LED), 10 = 0001010 (Both LEDs)
    • 0 - This sets the Power LED color (green)
    • 0 - This sets the Power LED intensity to 0 (off).

As each string of commands is sent, the user should be able to observe a quick flash of the indicator LEDs on the Create serial cable.

Drive Forward 20cm

It is possible to input a string of commands that the Create will then execute concurrently. This next example does this. Note:Be sure you have adequate room for the Create to drive as well as sufficient cable length BEFORE executing this sketch.
128 131 152 13 137 1 44 128 0 156 0 200 137 0 0 0 0 [Send]
153 [Send]
  • 128 - Start OI
  • 131 - Safe Mode
  • 152 - Script. See OIM pg. 15 for details.
  • 13 - Number of bytes in script. This must always follow the script command
  • 137 - Drive Opcode. Create listens for 4 bytes (OIM pg. 9)
    • Velocity - Velocity data is a 16 bit signed integer value sent in 2 8 bit bytes. We will send the value 300 (mm/s) (0b = 00000001 00101100)
      • 1 - Velocity High byte. 1 0b = 00000001
      • 44 - Velocity Low byte. 44 0b = 00101100
    • Radius - Radius data is a 16 bit signed integer value sent in 2 8 bit bytes. Straight is a special case. For this we will enter 32768 (0b = 1000000000000000)
      • 128 - Radius High byte. 128 0b = 10000000
      • 0 - Radius Low byte. 0 0b = 00000000
  • 156 - Wait Distance (OIM pg. 16) This data comes from the onboard wheel encoders. Accepts a 16 bit signed integer sent in 2 8 bit bytes.
    • 0 - Distance High byte
    • 200 - Distance Low byte
  • 137 - Drive Opcode. Create listens for 4 bytes (OIM pg. 9)
    • 0 0 0 0 - Stop
[Send] 
  • 153 - This opcode executes the script previously stored. Note that this command can be added to the end of the script to make the script repeat. In this case, adding this command to the script would make the Roomba drive forward indefinitely.

Try other values for the distance. (binary/decimal/hexadecimal converter)
  • 400mm = 1 144
  • 500mm = ?
  • 1000mm = ?

Goto: GUI Control

No comments:

Post a Comment