Difference between revisions of "Roomba"

From CompSciWiki
Jump to: navigation, search
(Started writting things)
Line 60: Line 60:
 
=== Sound ===
 
=== Sound ===
  
 +
{| class="wikitable" style="text-align: center; color: green;"
 +
|Orange
 +
|Apple
 +
|12,333.00
 +
|-
 +
|Bread
 +
|Pie
 +
|500.00
 +
|-
 +
|Butter
 +
|Ice cream
 +
|1.00
 +
|}
 
=== Sensor Data ===
 
=== Sensor Data ===
  

Revision as of 22:45, 3 April 2012

COMP 1010 Home > Back to Extra Labs

Introduction

Welcome to the Comp 1010 extra labs. In this lab you will learn the basics about the roomba. We will cover basic movements, How to use the lights, how to make sound and play a simple melody, and how to read sensor data with the roomba.

Getting started

Setting up eclipse

If you are not familiar with eclipse please see the Introduction to Eclipse extra lab.

Run your first program

  • Import the Roomba project placed on your desktop.
  • Connect your computer to your roomba.
  • It should make a noise.

connectToRoomba

This function is given to you as part of the Rommba.java source code. Its purpose is to create a connection between your computer and the roomba.

 PImage img;
    public static RoombaCommSerial connectToRoomba(boolean hackingModel, int port) 

The input parameters are:

  • boolean hackingModel: This value will either be true or false depending on the type of roomba you are using.
  • int port: This is the usb port your roomba will connect to. By default your roomba will be on port 0. If it is not do not worry, the function will print a list of available ports to the console.

Output:

  • RoombaCommSerial: A RoombaCommSerial object will allow you to control the roomba. More on this later.

Trouble shooting

Problem tab

Ports

The roombacom object

The connectToRoomba function will return a RoombaCommSerial object which will be assigned to the variable roombacom. This object will maintain the state and connection to the roomba. With it you can send commands to the roomba and receive information back from the roomba. Now lets see how it works.

Wait a sec

Try running this code

 PImage img;
    roombacomm.goForward();
    roombacomm.stop(); 

You are going to have a bad time. This is because when you run your code,,,,,

Basic Movement

Lights

Sound

{