|CSC 161||Grinnell College||Fall, 2011|
|Imperative Problem Solving and Data Structures|
The Scribbler 2 robot has three wheels. The small wheel below the fluke dongle is purely for balance. The two large wheels each have their own motor, which can be adjusted to move at separate speeds to turn the robot to the left or right. The speed of the motors ranges from -1 (backwards at full speed) to 1 (forwards at full speed). It is important to note that there is no built-in time limit for how long the motor can run, so if you call a command to move without specifying a time limit or commanding the robot to stop, the motors will keep running until the Scribbler 2 battery dies.
A second important feature of the Scribbler 2 robot is that it can have the
"front" set as either direction. When the robot has it's forwardness set as
"scribbler-forward", the front of the robot is the direction without a
wheel. When the forwardness is "fluke-forward", the front is the direction
with the small wheel (below the green card-like fluke dongle). The command
to change the forwardness of the robot is:
rSetForwardnessTxt(char * direction);
and the options are "scribbler-forward" or "fluke-forward". By default, you should have any program incorporating motion set the forwardness to "fluke-forward".
Timed motion commands are commands that include time as a variable, so the robot performs the motion for the specified time. These commands are blocking; that is, while the Scribbler 2 is performing these commands, it cannot perform other actions (such as beeping). Also, remember that speed ranges from 0 (no movement) to 1 (full speed), and the unit of time is seconds.
rTurnLeft (double speed, double time);
rTurnRight (double speed, double time);
rTurn (double direction, double time);
rTurnSpeed (char * direction, double speed, double time);
rForward (double speed, double time);
rForward (0.5, 3.7);
This command tells the robot to move forward at half speed for 3.7 seconds.
rBackward (double speed, double time);
Continuous commands are commands that do not include time as a variable. The robot executes these commands until a command to stop is issued. These commands are non-blocking; that is, while the Scribbler 2 is performing these commands, it can perform other actions (such as beeping).
rMotors (double leftSpeed, double rightSpeed);
rMotors (0.3, 0.7);
The robot moves with the left wheel at 30% of full speed, and the right wheel at 70% of full speed, so the robot moves in a circular motion.
rMove (double translate, double rotate);
rMove (0.6, 1);
The robot moves forward at 60% of full speed, while turning at full speed.
rRotate (double amount);
Sets the robot's turn speed.
rTranslate (double amount);
Sets the robot's forward speed.
Can you think of a way to calculate the size of a circle, based on the rotation and tranlation speed of the robot, or how to get the robot to turn at a specific angle?
These commands stop the continuous commands after they have been issued.
This document is available on the World Wide Web as
Created 20 July 2011 by April O'Neill
Last revised 27 July 2011 by April O'Neill
|For more information, please contact Henry M. Walker at firstname.lastname@example.org.|