simbad.sim
Class Agent

java.lang.Object
  extended by simbad.sim.BaseObject
      extended by simbad.sim.SimpleAgent
          extended by simbad.sim.Agent
Direct Known Subclasses:
AvoidersDemo.Robot, BaseDemo.Robot, BlinkingLampDemo.Robot, BumpersDemo.Robot, ChaosAgent, DifferentialKinematicDemo.Robot, ErraticGoalAgent, ImagerDemo.DemoRobotImager, KheperaRobot, LightSearchDemo.Robot, NeuralAgent, NeuralAgent, NeuralAgent, NeuralAgentDemo.Robot, PickCherriesDemo.Robot, PushBallsDemo.Robot, Robot, SimplestDemo.Robot, SingleAvoiderDemo.Robot, StraightGoalAgent, StraightGoalLoopAgent, Test.Robot, Test2.Robot, TestBackgroundMode.MyRobot, TestSimbatch.MyRobot

public class Agent
extends SimpleAgent

This is the base class for all robot and is considered to be a heavy agent.
When deriving a new robot's class from this class, one should override the following methods:

* Implementation note : the agent doesnt have synchronized methods. All thread refering to the agent should do explicit synchronization with synchronized(agent){...}.


Field Summary
(package private)  AgentInspector agentInspector
          Link back to agent inspector - can be null
private  java.text.DecimalFormat format
           
protected  FrameMeter frameMeter
          Used for frame rate measure
protected  KinematicModel kinematicModel
          Kinematic model used by the agent
protected  javax.vecmath.Vector3d motorsAngularAcceleration
          Current angular acceleration applied by motors..
protected  javax.vecmath.Vector3d motorsLinearAcceleration
          Current linear acceleration applied by motors.
private  javax.swing.JPanel panel
          panel dedicated to behavior output - can be null.
(package private)  javax.swing.JInternalFrame window
          window dedicated to behavior output - can be null.
 
Fields inherited from class simbad.sim.SimpleAgent
angularAcceleration, angularVelocity, body, collisionDetected, collisionDistance, collisionRadius, dynamicFrictionCoefficient, height, instantRotation, instantTranslation, interactionDetected, linearAcceleration, linearVelocity, mass, name, odometer, positionChanged, radius, staticFrictionCoefficient, t3d1, t3d2, t3d3, v1, veryNearAgent
 
Fields inherited from class simbad.sim.BaseObject
black, branchGroup, canBeTraversed, compilable, detachedFromSceneGraph, group, localBounds, material, rotation, rotationGroup, translation, translationGroup, white, world
 
Constructor Summary
Agent(javax.vecmath.Vector3d pos, java.lang.String name)
          Constructs an Agent.
 
Method Summary
 java.lang.String asString()
          Returns printable description of the agent.
protected  void create3D()
          Create 3D geometry.
(package private)  javax.swing.JInternalFrame createUIWindow()
          Creates the UI that may be associated to the agent.
protected  void dispose()
          Dispose all resources
 AgentInspector getAgentInspector()
           
protected  KinematicModel getKinematicModel()
           
 double getOdometer()
          Returns the agent's odometer in meters.
 double getRotationalVelocity()
          Gets rotational velocity in radians per second
 double getTranslationalVelocity()
          Gets translational velocity in meter per second.
 javax.swing.JPanel getUIPanel()
          Returns the UI panel previously set with setUIPanel
protected  void initBehavior()
          called by simulator.
protected  void initPreBehavior()
          called by simulator.
protected  void performBehavior()
          called by simulator.
protected  void performPreBehavior()
          called by simulator.
protected  void reset()
          Resets agent variables
protected  void resetPosition()
          Resets agent variables and position and kinematic
 void setAgentInspector(AgentInspector ai)
           
protected  void setFrameMeterRate(int rate)
           
protected  void setKinematicModel(KinematicModel kinematicModel)
          Sets the kinematic model for this agent
protected  void setMotorsAcceleration(double dt)
          set acceleration applied by motors .
 void setRotationalVelocity(double rv)
          Sets rotational velocity in radians per second.
 void setTranslationalVelocity(double tv)
          Sets translational velocity in meter per second.
 void setUIPanel(javax.swing.JPanel panel)
          Add a UI panel to the agent.
 
Methods inherited from class simbad.sim.SimpleAgent
addActuatorDevice, addSensorDevice, anOtherAgentIsVeryNear, checkCollision, clearVeryNear, collisionDetected, create, distanceToGround, getActuatorDevice, getActuatorList, getCoords, getCoords, getCounter, getHeight, getLifeTime, getMass, getName, getRadius, getSensorDevice, getSensorList, getVeryNearAgent, integratesPositionChange, integratesVelocities, interactionDetected, moveToPosition, moveToPosition, moveToStartPosition, resetDevices, resetPositionAt, setSimulator, updateActuators, updateCounters, updatePosition, updateSensors, veryNear
 
Methods inherited from class simbad.sim.BaseObject
addChild, addChild, attach, compile, create3D, detach, getBounds, getCanBeTraversed, getGroup, getNode, getRotationTransform, getRotationTransformGroup, getTranslation, getTranslationTransform, getTranslationTransform, resetTransforms, rotateY, setBounds, setCanBeTraversed, setColor, setWorld, translateTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

panel

private javax.swing.JPanel panel
panel dedicated to behavior output - can be null.


window

javax.swing.JInternalFrame window
window dedicated to behavior output - can be null.


agentInspector

AgentInspector agentInspector
Link back to agent inspector - can be null


kinematicModel

protected KinematicModel kinematicModel
Kinematic model used by the agent


motorsLinearAcceleration

protected javax.vecmath.Vector3d motorsLinearAcceleration
Current linear acceleration applied by motors.


motorsAngularAcceleration

protected javax.vecmath.Vector3d motorsAngularAcceleration
Current angular acceleration applied by motors..


format

private java.text.DecimalFormat format

frameMeter

protected FrameMeter frameMeter
Used for frame rate measure

Constructor Detail

Agent

public Agent(javax.vecmath.Vector3d pos,
             java.lang.String name)
Constructs an Agent.

Parameters:
pos - start position in 3D world.
name - name of the agent.
Method Detail

reset

protected void reset()
Resets agent variables

Overrides:
reset in class SimpleAgent

resetPosition

protected void resetPosition()
Resets agent variables and position and kinematic

Overrides:
resetPosition in class SimpleAgent

create3D

protected void create3D()
Create 3D geometry.

Overrides:
create3D in class SimpleAgent

setMotorsAcceleration

protected void setMotorsAcceleration(double dt)
set acceleration applied by motors .

Overrides:
setMotorsAcceleration in class SimpleAgent

initPreBehavior

protected void initPreBehavior()
called by simulator.

Overrides:
initPreBehavior in class SimpleAgent

initBehavior

protected void initBehavior()
called by simulator.

Overrides:
initBehavior in class SimpleAgent

performPreBehavior

protected void performPreBehavior()
called by simulator.

Overrides:
performPreBehavior in class SimpleAgent

performBehavior

protected void performBehavior()
called by simulator.

Overrides:
performBehavior in class SimpleAgent

getOdometer

public double getOdometer()
Returns the agent's odometer in meters.

Returns:
the agent odometer in meters.

setRotationalVelocity

public final void setRotationalVelocity(double rv)
Sets rotational velocity in radians per second.


setTranslationalVelocity

public final void setTranslationalVelocity(double tv)
Sets translational velocity in meter per second.


getRotationalVelocity

public final double getRotationalVelocity()
Gets rotational velocity in radians per second


getTranslationalVelocity

public final double getTranslationalVelocity()
Gets translational velocity in meter per second.


setKinematicModel

protected void setKinematicModel(KinematicModel kinematicModel)
Sets the kinematic model for this agent


getKinematicModel

protected KinematicModel getKinematicModel()

setFrameMeterRate

protected void setFrameMeterRate(int rate)

setUIPanel

public void setUIPanel(javax.swing.JPanel panel)
Add a UI panel to the agent. Typically used for displaying behavior outputs. A call to this method will have for consequence the creation of a dedicated window.

Parameters:
panel -

getUIPanel

public javax.swing.JPanel getUIPanel()
Returns the UI panel previously set with setUIPanel

Returns:
the panel

createUIWindow

javax.swing.JInternalFrame createUIWindow()
Creates the UI that may be associated to the agent. If the agent has set a Panel with setUIPanel a window is created containing the panel.


getAgentInspector

public AgentInspector getAgentInspector()

setAgentInspector

public void setAgentInspector(AgentInspector ai)

dispose

protected void dispose()
Dispose all resources

Overrides:
dispose in class SimpleAgent

asString

public java.lang.String asString()
Returns printable description of the agent.

Overrides:
asString in class SimpleAgent
Returns:
agent description as string.