The Robotics Primer Workbook
Developed by  USC, iRobot® and Microsoft® Robotics Studio
Categories: Hardware | Software | IRobot Open Interface

Introduction:iRobot Create and Command Module

Hardware

The iRobot Create programmable robot can be used as an autonomous control unit by purchasing the iRobot Command Module accessory. The Command Module is a green box that plugs into the Create. Inside the Command Module is a microntroller that can control all aspects of the Create, such as rotate the wheels and detect bumper hits. You will write programs for the Command Module that will instruct the microntroller what to do, such as how to respond to a bumper hit or how fast to rotate the wheels. The Command Module comes with a software CD and a a USB cable to connect the iRobot Command Module to a computer.

Setup

Please read the instruction manual provided with the iRobot Command Module available online here. This manual has detailed instructions how to program the Command Module via a PC, and outlines some functionality of the Create.

The manual will describe how to securely attach the Command Module to the Create, use the provided USB cable to create a connection between a PC and the Command Module, install the Win AVR software, and program the Command Module.

The exercises within this workbook rely on the Linux operating system. The exercise below will describe how to write programs, and download them to the Command Module using Linux. This setup requires exactly the same hardware, and even uses the same software for programming the Command Module.

Make sure to download the source code.

Code Example

This example will demonstrate how to write a simple control program to drive the Create in a straight line. After completing this exercise you will be able to write, compile, and download programs to the Command Module.

This workbook provides a Command Module API with a set of functions for programming the Command Module. Read the documentation on the API.

For this example we will demonstrate how to use the Command Module API to drive the Create in a straight line. This is a rudimentary example for demonstration purposes. The following code is available in the sources roboticsprimer-x.x/exercises/intro/command_module. You can download the sources here.

The following is the C code in main.c

// Include the Command Module API
#include <create.h>

// Main function
int main(void)
{
  // Initialize the Create and Command Module
  cr8_init();

  // Loop forever
  while (1)
  {
    // Set the linear and angular speed of the Create to 200mm/s linear and 0 mr/s angular.
    cr8_set_speed(200, 0);
  }
  return 0;
}

Compile this code using the scons program. You will run the scons program from a command prompt, which is typically looks like a dollar sign followed by a cursor. The following is example of how to run the scons program.

$ scons 

At this point there should be an intro.hex file in your current directory. This file was created by the scons prgram, and will be programmed into the Command Module. Check to make sure the file exists by listing the contents of the current directory using the ls program as shown below.

$ ls

Now, plug the USB cable into the Command Module and your PC. Make sure the Command Module is powered on. Once the USB cable is plugged in, press the Reset button on the iRobot Command Module. At this point the Command Module is ready to be programmed. Use the cr8_program program to download the intro.hex file to the Command Module, as shown below. This step writes your program into the memory contained on the microcontroller within the Command Module.

$ cr8_program intro.hex

Remove the USB cable, and press the Reset button again. Every time the Reset button is pressed, the code in the Command Module will restart. The Create will now keep running in a straight line. Be prepared to run after it, and lift it off the ground to make it stop!

Retrieved from "http://roboticsprimer.sourceforge.net/workbook/Introduction:iRobot_Create_and_Command_Module"

This page has been accessed 2,704 times. This page was last modified 01:48, 4 April 2007. Content is available under GNU Free Documentation License 1.2.


Browse
Main Page
Glossary
Sections
Prerequisites
Introduction
Robot Components
Locomotion
Sensors
Feedback Control
Deliberative Control
Reactive Control
Hybrid Control
Behavior-based Control
Emergent Behavior
Navigation
Group Robotics
Learning


Log in / create account