simbad.sim
Class Device

java.lang.Object
  extended by simbad.sim.BaseObject
      extended by simbad.sim.Device
Direct Known Subclasses:
ActuatorDevice, SensorDevice

public abstract class Device
extends BaseObject

A abstract device, base class for sensorDevice and ActuatorDevice. The class manages an update rate which will be used by the simulator.


Field Summary
private  double elapsedSinceUpdate
           
private  boolean firstUpdate
           
private  java.lang.String name
           
private  SimpleAgent owner
           
private  boolean updateOnEachFrame
           
private  double updatePerSecond
           
 
Fields inherited from class simbad.sim.BaseObject
black, branchGroup, canBeTraversed, compilable, detachedFromSceneGraph, group, localBounds, material, rotation, rotationGroup, translation, translationGroup, white, world
 
Constructor Summary
Device()
           
 
Method Summary
 javax.swing.JPanel createInspectorPanel()
          Creates the panel associated to the device.
 java.lang.String getName()
           
protected  SimpleAgent getOwner()
          Get the agent owner of this device
 double getUpdatePerSecond()
          Returns the number of updates per second requested for this sensor.
protected  void reset()
          to be overriden
protected  void setName(java.lang.String name)
           
protected  void setOwner(SimpleAgent agent)
          Set the agent owner of this device
 void setUpdateOnEachFrame(boolean on)
          Sets if update happens on each frame .
 void setUpdatePerSecond(double ups)
          Sets the number of update per seconds for this sensor.
protected  void update()
          to be overriden
protected  void update(double elapsedSeconds)
          Called by the simulator loop
 
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

owner

private SimpleAgent owner

name

private java.lang.String name

updatePerSecond

private double updatePerSecond

elapsedSinceUpdate

private double elapsedSinceUpdate

firstUpdate

private boolean firstUpdate

updateOnEachFrame

private boolean updateOnEachFrame
Constructor Detail

Device

Device()
Method Detail

getName

public java.lang.String getName()
Returns:
device's name .

setName

protected void setName(java.lang.String name)

setOwner

protected void setOwner(SimpleAgent agent)
Set the agent owner of this device


getOwner

protected SimpleAgent getOwner()
Get the agent owner of this device


createInspectorPanel

public javax.swing.JPanel createInspectorPanel()
Creates the panel associated to the device. This panel can be inserted in the inspector window for monitoring.

Returns:
the JPanel. null if no panel can be associated

setUpdatePerSecond

public void setUpdatePerSecond(double ups)
Sets the number of update per seconds for this sensor.


setUpdateOnEachFrame

public void setUpdateOnEachFrame(boolean on)
Sets if update happens on each frame .


getUpdatePerSecond

public double getUpdatePerSecond()
Returns the number of updates per second requested for this sensor.

Returns:
requested number of update per second (in virtual time).

update

protected void update()
to be overriden


reset

protected void reset()
to be overriden


update

protected void update(double elapsedSeconds)
Called by the simulator loop