sk.robotics.rlcs.agents.robot
Class MoveAgentBase
java.lang.Object
sk.robotics.rlcs.agentspace.Agent
sk.robotics.rlcs.agents.robot.MoveAgentBase
- All Implemented Interfaces:
- java.lang.Runnable
- Direct Known Subclasses:
- ApproachAgent, AvoidAgent
public abstract class MoveAgentBase
- extends Agent
Base class for agents which move with a robot towards destination.
Agents deriving from this class just have to override abstract method
selectMove(actualPos, destination)
, which is called to
determine movement command to send to the robot. Its parameters
are set to values read from corresponding space blocks, and it returns
an object of class Movement.
Both ApproachAgent and AvoidAgent derive from this class.
Method Summary |
protected abstract Movement |
selectMove(Position pos,
java.awt.geom.Point2D dest)
Abstract method for determining next movement command to send to the robot. |
protected void |
senseSelectAct()
Sense-select-act reads relevant data from space (position, destination, collision),
lets derived class decide about movement command, and stores this command in space,
where RobotMovementAgent reads it and sends it to the robot. |
Methods inherited from class sk.robotics.rlcs.agentspace.Agent |
cleanup, exit, getConfig, getIdleTime, getWorkerThreadGroup, isAlive, kill, log, log, log, log, log, run, senseSelectAct, setLogLevel, setPeriodicTrigger, setPeriodicTrigger, sleep, start, startup, toString, trigger, trigger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
cfg
protected final MoveAgentBase.Cfg cfg
MoveAgentBase
protected MoveAgentBase(MoveAgentBase.Cfg cfg)
selectMove
protected abstract Movement selectMove(Position pos,
java.awt.geom.Point2D dest)
- Abstract method for determining next movement command to send to the robot.
It should return Movement object representing the desired command.
Returning null will quit current sense-select-act iteration immediately,
without sending anything to the robot.
Returning Movement.NO_MOVE will delete the movement block from space,
instead of storing it there. The effect on the robot is the same, it
will stop, but the difference is that another agents with lower priority
can reclaim control over the block.
senseSelectAct
protected void senseSelectAct()
- Sense-select-act reads relevant data from space (position, destination, collision),
lets derived class decide about movement command, and stores this command in space,
where RobotMovementAgent reads it and sends it to the robot.
- Overrides:
senseSelectAct
in class Agent