|
dLife Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdlife.robot.Controller
dlife.models.simpleworld.SimpleWorldRobotController
public abstract class SimpleWorldRobotController
Abstract base class for controllers for SimpleWorldRobots. See
the documentation for the dlife.models.simpleworld package for
information about the use of this class.
Typically a concrete implementation of this class will contain only the
step(SimpleWorldRobot robot) method. This method will accesses
the robot's sensors using the following methods in the
SimpleWorldRobot class:
SimpleWorldRobot.getSmell()
SimpleWorldRobot.getLeftColor()
SimpleWorldRobot.getFrontColor()
SimpleWorldRobot.getRightColor()
Base on the sensors the step method will invoke the following
methods to take actions in the world:
SimpleWorldRobotControllers can be found in
the examples.dlife.models.simpleworld package.
SimpleWorld,
SimpleWorldRobot,
examples.dlife.models.simpleworld| Field Summary | |
|---|---|
static int |
GUI_DELAY
Delay (in ms) used between calls to step when the GUI is displayed. |
static int |
NO_GUI_DELAY
Delay (in ms) used between calls to step when the GUI is not displayed. |
| Constructor Summary | |
|---|---|
SimpleWorldRobotController()
|
|
| Method Summary | |
|---|---|
void |
startUp()
Invoked when this Controller is started in the ControlCenter. |
void |
startUp(Robot robot)
Implementation of the startUp method required by Controller. |
void |
step()
Implementation of the step method required by Controller. |
abstract void |
step(SimpleWorldRobot robot)
Invoked once for each control opportunity provided to the robot. |
| Methods inherited from class dlife.robot.Controller |
|---|
shutDown |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int GUI_DELAY
public static final int NO_GUI_DELAY
| Constructor Detail |
|---|
public SimpleWorldRobotController()
| Method Detail |
|---|
public final void startUp(Robot robot)
startUp in class Controllerrobot - the Robot that this Controller will be controlling.public final void step()
step in class Controllerpublic void startUp()
public abstract void step(SimpleWorldRobot robot)
SimpleWorldRobot class to read sensors
or move the robot. The robot's life force is decreased by one unit each
time step is called. In addition, each movement of the robot caused by
the code in step costs one unit of life force (e.g. rotating right and
then moving forward costs 2 units).
robot - The robot being controlled.
|
dLife Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||