sk.robotics.rlcs.agents.robot
Class AvoidAgent

java.lang.Object
  extended by sk.robotics.rlcs.agentspace.Agent
      extended by sk.robotics.rlcs.agents.robot.MoveAgentBase
          extended by sk.robotics.rlcs.agents.robot.AvoidAgent
All Implemented Interfaces:
java.lang.Runnable

public class AvoidAgent
extends MoveAgentBase

Agent for avoiding an obstacle. This agent detects situations when robot is not moving, because of an imminent collision. It then tries to avoid the collision, so that the robot can continue to it's destination. It should be configured with greater priority of writing movement commands than MoveAgent, otherwise they could interfere in an unwanted way.

Once this agent detects an avoid situation, it starts moving the robot. By writing first value to the desired movement block, it effectively disables associated MoveAgent, because if higher write priority. The MoveAgent starts working again only once this agent deletes the block, and it does that only once there is again free path to destination.


Nested Class Summary
static class AvoidAgent.Cfg
           
 
Nested classes/interfaces inherited from class sk.robotics.rlcs.agentspace.Agent
Agent.AgentThread, Agent.Hidden, Agent.ThreadCreator, Agent.WorkerThreadGroup
 
Field Summary
 
Fields inherited from class sk.robotics.rlcs.agentspace.Agent
logTimeFormat, space, thread, workerThreads
 
Constructor Summary
AvoidAgent(AvoidAgent.Cfg cfg)
           
 
Method Summary
protected  Movement selectMove(Position pos, java.awt.geom.Point2D dest)
          Abstract method for determining next movement command to send to the robot.
 
Methods inherited from class sk.robotics.rlcs.agents.robot.MoveAgentBase
senseSelectAct
 
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
 

Constructor Detail

AvoidAgent

public AvoidAgent(AvoidAgent.Cfg cfg)
Method Detail

selectMove

protected Movement selectMove(Position pos,
                              java.awt.geom.Point2D dest)
Description copied from class: MoveAgentBase
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.

Specified by:
selectMove in class MoveAgentBase