|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Ship
A Ship class to simulate a basic ship using the lego robot. The model assumes that the robot is driven with a differential drive system powered by Motors A and C. It is also assumed that there is a mechanism that measures the difference in rotation between the two wheels and drives the rotation sensor on input 2 of the RCX. The Ship class should probably be a singleton object because it only makes sense to instantiate a single Ship object. The behaviour of the robot is undefined if you try to control it from two ship objects.
Constructor Summary | |
Ship()
Constructs the Ship object effectively setting its initial heading to 0 degrees. |
Method Summary | |
int |
getHeading()
Returns the current heading of the robot in degrees. |
static void |
main(java.lang.String[] args)
A main method should you wish to test the class without writing your own code. |
void |
move()
Moves the robot forwards by appying the same power to both motors. |
void |
moveStraight()
Moves the robot forwards in a straight line. |
static void |
pause(int millis)
Lets the robot do nothing for the specified number of milli seconds. |
void |
setCourse(int course)
Causes the robot to turn to point in the direction specified by course. |
void |
setSpeed(int speed)
Sets the speed of the robot. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Ship()
Method Detail |
public static void main(java.lang.String[] args)
public void setSpeed(int speed)
public void setCourse(int course)
public int getHeading()
public void move()
public void moveStraight()
public static void pause(int millis)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |