simbad.sim
Class SimpleAgent

java.lang.Object
  extended bysimbad.sim.BaseObject
      extended bysimbad.sim.SimpleAgent
Direct Known Subclasses:
Agent, BallAgent, CherryAgent

public class SimpleAgent
extends simbad.sim.BaseObject

This is the base class for all kinds of physical agents.
Implementation note : the agent doesnt have synchronized methods. All thread refering to the agent should do explicit synchronization with synchronized(agent){...}..


Constructor Summary
SimpleAgent(javax.vecmath.Vector3d pos, java.lang.String name)
          Constructs a SimpleAgent.
 
Method Summary
 boolean anOtherAgentIsVeryNear()
          Returns true if this agent is in physical contact with an other SimpleAgent.
 java.lang.String asString()
          Returns printable description of the agent.
 void attach()
          Re-add object to the scenegraph.
 boolean collisionDetected()
          Returns the state of the geometric collision indicator.
 void detach()
          Removes object from the scenegraph.
 ActuatorDevice getActuatorDevice(int num)
          Returns the actuator device designated by num.
 java.util.ArrayList getActuatorList()
           
 boolean getCanBeTraversed()
          Gets the canBeTraversed Flag.
 void getCoords(javax.vecmath.Point3d coord)
          Return agents coordinates.
 int getCounter()
          Returns the agent counter.
 float getHeight()
          Returns the agent's height in meters.
 double getLifeTime()
          Returns the agent total lifetime since last reset (in seconds).
 float getMass()
          Gets the agent's mass.
 java.lang.String getName()
          Returns the agent's name.
 float getRadius()
          Returns the agent's radius in meters.
 void getRotationTransform(javax.media.j3d.Transform3D t)
          Obtain rotation transform.
 SensorDevice getSensorDevice(int num)
          Returns the sensor device designated by num.
 java.util.ArrayList getSensorList()
           
 void getTranslationTransform(javax.media.j3d.Transform3D t)
          Obtain translation transform.
 SimpleAgent getVeryNearAgent()
          Returns the currently touched agent - null if no agent near.
 boolean interactionDetected()
          Returns true if an interaction has been detected.
 void moveToStartPosition()
          Go to the start position of the agent.
 void rotateY(double angle)
          Rotates (relative to current rotation) the object about Y axis.
 void setCanBeTraversed(boolean canbetraversed)
          Sets the canBeTraversed Flag.
 void setColor(javax.vecmath.Color3f color)
          Change the color while the simulation is running.
 void translateTo(javax.vecmath.Vector3d t)
          Translates (relative to current pos) the object to given position.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleAgent

public SimpleAgent(javax.vecmath.Vector3d pos,
                   java.lang.String name)
Constructs a SimpleAgent.

Parameters:
pos - the starting position.
name - the name of the agent.
Method Detail

collisionDetected

public boolean collisionDetected()
Returns the state of the geometric collision indicator.

Returns:
collision indicator.

interactionDetected

public boolean interactionDetected()
Returns true if an interaction has been detected.

Returns:
interaction indicator.

moveToStartPosition

public void moveToStartPosition()
Go to the start position of the agent.


asString

public java.lang.String asString()
Returns printable description of the agent. This may be multiline and complex in subclasses.

Returns:
agent description as string.

getSensorList

public java.util.ArrayList getSensorList()

getActuatorList

public java.util.ArrayList getActuatorList()

getLifeTime

public double getLifeTime()
Returns the agent total lifetime since last reset (in seconds).

Returns:
lifetime in seconds.

getCoords

public void getCoords(javax.vecmath.Point3d coord)
Return agents coordinates.

Returns:
agent point3d .

getCounter

public int getCounter()
Returns the agent counter. Counter is incrementented at each simulation step.

Returns:
agent step counter.

getName

public java.lang.String getName()
Returns the agent's name.

Returns:
agent's name .

getMass

public float getMass()
Gets the agent's mass.


getRadius

public float getRadius()
Returns the agent's radius in meters.

Returns:
the agent radius in meters.

getHeight

public float getHeight()
Returns the agent's height in meters.

Returns:
the agent height in meters.

getSensorDevice

public SensorDevice getSensorDevice(int num)
Returns the sensor device designated by num. User will have to cast to the appropriate class.

Returns:
a SensorDevice Object.

getActuatorDevice

public ActuatorDevice getActuatorDevice(int num)
Returns the actuator device designated by num. User will have to cast to the appropriate class.

Returns:
a ActuatorDevice Object.

anOtherAgentIsVeryNear

public boolean anOtherAgentIsVeryNear()
Returns true if this agent is in physical contact with an other SimpleAgent.


getVeryNearAgent

public SimpleAgent getVeryNearAgent()
Returns the currently touched agent - null if no agent near.


translateTo

public void translateTo(javax.vecmath.Vector3d t)
Translates (relative to current pos) the object to given position.


rotateY

public void rotateY(double angle)
Rotates (relative to current rotation) the object about Y axis.


getTranslationTransform

public void getTranslationTransform(javax.media.j3d.Transform3D t)
Obtain translation transform.


getRotationTransform

public void getRotationTransform(javax.media.j3d.Transform3D t)
Obtain rotation transform.


detach

public void detach()
Removes object from the scenegraph.


attach

public void attach()
Re-add object to the scenegraph.


setCanBeTraversed

public void setCanBeTraversed(boolean canbetraversed)
Sets the canBeTraversed Flag.


getCanBeTraversed

public boolean getCanBeTraversed()
Gets the canBeTraversed Flag.


setColor

public void setColor(javax.vecmath.Color3f color)
Change the color while the simulation is running.