Difference between revisions of "Roomba"
(Started writting things) |
|||
Line 12: | Line 12: | ||
===Run your first program=== | ===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. | ||
+ | |||
+ | {{CodeBlock | ||
+ | |Code=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=== | ===Trouble shooting=== | ||
+ | |||
==== Problem tab ==== | ==== Problem tab ==== | ||
+ | |||
==== Ports ==== | ==== Ports ==== | ||
+ | |||
==The roombacom object== | ==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 | ||
+ | |||
+ | {{CodeBlock | ||
+ | |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 === | === Basic Movement === |
Revision as of 21:55, 3 April 2012
COMP 1010 Home > Back to Extra Labs
IntroductionWelcome 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,,,,,