sk.robotics.rlcs.agents.robot
Class MoveAgentBase

java.lang.Object
  extended by sk.robotics.rlcs.agentspace.Agent
      extended by 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.


Nested Class Summary
static class MoveAgentBase.Cfg
           
 
Nested classes/interfaces inherited from class sk.robotics.rlcs.agentspace.Agent
Agent.AgentThread, Agent.Hidden, Agent.ThreadCreator, Agent.WorkerThreadGroup
 
Field Summary
protected  MoveAgentBase.Cfg cfg
           
 
Fields inherited from class sk.robotics.rlcs.agentspace.Agent
logTimeFormat, space, thread, workerThreads
 
Constructor Summary
protected MoveAgentBase(MoveAgentBase.Cfg cfg)
           
 
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
 

Field Detail

cfg

protected final MoveAgentBase.Cfg cfg
Constructor Detail

MoveAgentBase

protected MoveAgentBase(MoveAgentBase.Cfg cfg)
Method Detail

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