org.simbrain.world.odorworld
Class OdorWorldAgent

java.lang.Object
  extended by org.simbrain.world.odorworld.AbstractEntity
      extended by org.simbrain.world.odorworld.OdorWorldEntity
          extended by org.simbrain.world.odorworld.OdorWorldAgent
All Implemented Interfaces:
Agent

public class OdorWorldAgent
extends OdorWorldEntity
implements Agent

Agent represents in a creature in the world which can react to stimuli and move. Agents are controlled by neural networks, in particular their input and output nodes.


Field Summary
 
Fields inherited from class org.simbrain.world.odorworld.OdorWorldEntity
IMAGENAMES
 
Constructor Summary
OdorWorldAgent()
          Default constructor.
OdorWorldAgent(OdorWorld wr, String nm, String type, int x, int y, double ori)
          Creates an instance of an agent.
 
Method Summary
 void completedInputRound()
          Complicated input round.
 Point getLeftWhisker()
           
 double getMovementIncrement()
           
 double getOrientation()
           
 double getOrientationRad()
           
 World getParentWorld()
          Return the parent world for this agent.
 Point getRightWhisker()
           
 double getStimulus(String[] sensorID)
          Get the stimulus associated with the a given sensory id.
 double getTurnIncrement()
           
 double getWhiskerAngle()
           
 double getWhiskerLength()
           
 void goStraightBackward(double value)
          Moves agent backward.
 void goStraightForward(double value)
          Moves agent forward.
 void setMotorCommand(String[] commandList, double value)
          Actiate a motor command on this agent.
 void setMovementIncrement(double straightFactor)
           
 void setOrientation(double d)
          Set the orienation of the creature.
 void setTurnIncrement(double turnFactor)
           
 void setWhiskerAngle(double whiskerAngle)
           
 void setWhiskerLength(double whiskerLength)
           
 void turnLeft(double value)
          Turn agent left.
 void turnRight(double value)
          Turn agent to the right.
protected  boolean validMove(Point possibleCreatureLocation)
          Check to see if the creature can move to a given new location.
 void wrapAround()
          Implements a "video-game" world or torus, such that when an object leaves on side of the screen it reappears on the other.
 
Methods inherited from class org.simbrain.world.odorworld.OdorWorldEntity
getBites, getBitesToDie, getEdible, getHeight, getImageName, getImageNameIndex, getImageNames, getLocation, getName, getParent, getRectangle, getRectangle, getResurrectionProb, getStimulus, getTheImage, getWidth, getX, getY, imagesRenderer, moveTo, paintThis, reset, setBites, setBitesToDie, setEdible, setImageName, setLocation, setName, setParent, setResurrectionProb, setStimulus, setTheImage, setX, setY, terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.simbrain.world.Agent
getName
 

Constructor Detail

OdorWorldAgent

public OdorWorldAgent()
Default constructor.


OdorWorldAgent

public OdorWorldAgent(OdorWorld wr,
                      String nm,
                      String type,
                      int x,
                      int y,
                      double ori)
Creates an instance of an agent.

Parameters:
wr - Odor world to place agent
nm - Name of agent
type - Type of agent
x - Position
y - Position
ori - Orientation
Method Detail

getOrientation

public double getOrientation()
Returns:
orientation in degrees

getOrientationRad

public double getOrientationRad()
Returns:
orientation in degrees

setOrientation

public void setOrientation(double d)
Set the orienation of the creature.

Parameters:
d - the orientation, in degrees

getLeftWhisker

public Point getLeftWhisker()
Returns:
position of left whisker, given orientation of creature

getRightWhisker

public Point getRightWhisker()
Returns:
position of right whisker, given orientation of creature

turnRight

public void turnRight(double value)
Turn agent to the right.

Parameters:
value - Amount to turn agent

turnLeft

public void turnLeft(double value)
Turn agent left.

Parameters:
value - Amount to turn agent

goStraightForward

public void goStraightForward(double value)
Moves agent forward.

Parameters:
value - Amount to move agent

goStraightBackward

public void goStraightBackward(double value)
Moves agent backward.

Parameters:
value - Amount to move agent

validMove

protected boolean validMove(Point possibleCreatureLocation)
Check to see if the creature can move to a given new location. If it is off screen or on top of a creature, disallow the move.

Parameters:
possibleCreatureLocation - on-screen location to be checked
Returns:
true if the move is valid, false otherwise

wrapAround

public void wrapAround()
Implements a "video-game" world or torus, such that when an object leaves on side of the screen it reappears on the other.


setMotorCommand

public void setMotorCommand(String[] commandList,
                            double value)
Actiate a motor command on this agent.

Specified by:
setMotorCommand in interface Agent
Parameters:
commandList - the command itself
value - the activation level of the output neuron which produced this command

getStimulus

public double getStimulus(String[] sensorID)
Get the stimulus associated with the a given sensory id.

Specified by:
getStimulus in interface Agent
Parameters:
sensorID - the string representing the id
Returns:
the stimulus for the id

getMovementIncrement

public double getMovementIncrement()
Returns:
Returns the straight_factor.

setMovementIncrement

public void setMovementIncrement(double straightFactor)
Parameters:
straightFactor - The straight_factor to set.

getTurnIncrement

public double getTurnIncrement()
Returns:
Returns the turn_factor.

setTurnIncrement

public void setTurnIncrement(double turnFactor)
Parameters:
turnFactor - The turnFactor to set.

getWhiskerAngle

public double getWhiskerAngle()
Returns:
Returns the whiskerAngle.

setWhiskerAngle

public void setWhiskerAngle(double whiskerAngle)
Parameters:
whiskerAngle - The whiskerAngle to set.

getWhiskerLength

public double getWhiskerLength()
Returns:
Returns the whiskerLength.

setWhiskerLength

public void setWhiskerLength(double whiskerLength)
Parameters:
whiskerLength - The whiskerLength to set.

getParentWorld

public World getParentWorld()
Description copied from interface: Agent
Return the parent world for this agent.

Specified by:
getParentWorld in interface Agent
Returns:
this.getParent() world

completedInputRound

public void completedInputRound()
Complicated input round.

Specified by:
completedInputRound in interface Agent