Primitives



These are some high-level functions we've created to allow easy programming of the robots to even those who have little understanding of and no experience with the robots. The functions are simple, but provide much functionality, including movement, sonar, speaker, gripper, and camera functions.

Initialization


initialize(port number) - initializes robot communication through port

Movement


forward() - moves robot forward 10 cm
reverse() - moves robot backward 10 cm
stop() - stops robot
left() - turns robot left by one radian
miniLeft() - turns robot left by 1/4 radian
right() - turns robot right by one radian
miniRight() - turns robot right by 1/4 radian
inPlaceLeft() - rotates robot counterclockwise in-place by one radian
miniInPlaceLeft() - rotates robot counterclockwise in-place by 1/4 radian
inPlaceRight() - rotates robot clockwise in-place by one radian
miniInPlaceRight() - rotates robot clockwise in-place by 1/4 radian

Sonar


leftSonar() - returns true if object is dangerously close to left side of robot
rightSonar() - returns true if object is dangerously close to right side of robot
frontSonar() - returns true if object is dangerously close to front of the robot
distLeftSonar() - returns the distance in millimeters of the closest object to the left of robot
distRightSonar() - returns the distance in millimeters of the closest object to the right of robot
distFrontSonar() - returns the distance in millimeters of the closest object to the front of robot

Vision


trainColor() - trains vision system on the target color in the center of robot's field of view
isColorFound() - returns true if target color is in robot's field of view
getXCoord() - returns the X coordinate of the centroid of target (if target is in field of view)
getYCoord() - returns the Y coordinate of the centroid of target (if target is in field of view)

Status


crash() - returns true if the robot has collided head-on with an object
stalled() - returns true if the robot's wheels are stalled

Grippers


openJaws() - open's the robot's gripper
closeJaws() - closes the robot's gripper
nibble() - returns true if an object is between the tips of the gripper paddles
chomp() - returns true if an object is between the backs of the gripper paddles

Dead Reckoning


currentXLocation() - returns the current X location of robot
currentYLocation() - returns the current Y location of robot
currentHeading() - returns the current heading of robot

Misc


rPause(seconds) - pauses program for specified number of seconds
beep1() - beep short and high pitched
beep2() - beeps twice as long as beep(1) and at a lower pitch
beep3() - beeps twice as long as beep(2) and at an even lower pitch


Robotics Group
Last modified: Sun Nov 15 22:54:49 PST 1998