simworldobjects
Class SimSensor

java.lang.Object
  |
  +--simworldobjects.SimSensor
All Implemented Interfaces:
SimObject
Direct Known Subclasses:
SimLightSensor, SimTouchSensor

public abstract class SimSensor
extends java.lang.Object
implements SimObject

Abstract class for SimSensors. A SimSensor is a different sort of object to a BasicSimObject. It has single 'owning' SimObject (normally a SimRCX) and all of its parameters are derived from this object. Many of its methods therefore do nothing - they are simply included here to fulfill the requirements of a SimObject.

Author:
Graham Ritchie
See Also:
SimObject

Constructor Summary
SimSensor()
           
 
Method Summary
 double getActualBearingVelocityXY()
          Returns this objects actual bearing velocity in the XY plane
 double getActualBearingVelocityXZ()
          Returns this objects actual bearing velocity in the XZ plane
 double getActualBearingXY()
          Returns this objects actual bearing in the XY plane
 double getActualBearingXZ()
          Returns this sensor's XZ bearing (the same as the owning SimObject's bearing)
 double getActualVelocity()
          Returns this objects actual velocity.
 double getDesiredBearingVelocityXY()
          Returns this objects desired bearing velocity in the XY plane
 double getDesiredBearingVelocityXZ()
          Returns this objects desired bearing velocity in the XZ plane
 double getDesiredVelocity()
          Returns this objects desired velocity.
 double getHeight()
          Returns this object's height
 double getLength()
          Returns this object's length
 java.lang.String getType()
          Returns a string describing this object's type
abstract  int getValue()
          Returns this sensor's current value
 double getWidth()
          Returns this object's width
 double getXCoord()
          Returns this sensor's X coordinate - derived from its owning SimObject
 double getYCoord()
          Returns this sensor's X coordinate
 double getZCoord()
          Returns this sensor's Z coordinate - derived from its owning SimObject
 void initSimSensor(SimObject object, double xOffset, double zOffset, double height, double width, double length, java.lang.String type)
          Initialises this SimSensor
 void setActualBearingVelocityXY(double b)
          Sets the actual 'bearing velocity' of this object in the XY plane.
 void setActualBearingVelocityXZ(double b)
          Sets the actual 'bearing velocity' of this object in the XZ plane.
 void setActualBearingXY(double b)
          Sets the actual bearing of this object in the XY plane
 void setActualBearingXZ(double b)
          Sets the actual bearing of this object in the XZ plane
 void setActualVelocity(double v)
          Sets the actual velocity of this object.
 void setDesiredBearingVelocityXY(double v)
          Sets the desired 'bearing velocity' of this object in the XY plane.
 void setDesiredBearingVelocityXZ(double v)
          Sets the desired 'bearing velocity' of this object in the XZ plane - a bearing velocity is the rate at which the object wants to turn.
 void setDesiredVelocity(double v)
          Sets the desired velocity of this object - the SimWorld will then set its actual velocity accordingly (depending on wheher the object is colliding with another object etc.) Positive values mean the objet wants to move forward, and negative values mean the object wants to move backward.
 void setXCoord(double x)
          Sets this objects X coordinate
 void setYCoord(double y)
          Sets this objects Y coordinate
 void setZCoord(double z)
          Sets this objects Z coordinate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimSensor

public SimSensor()
Method Detail

initSimSensor

public void initSimSensor(SimObject object,
                          double xOffset,
                          double zOffset,
                          double height,
                          double width,
                          double length,
                          java.lang.String type)
Initialises this SimSensor

getValue

public abstract int getValue()
Returns this sensor's current value
Returns:
the current value of this sensor as an int

setDesiredVelocity

public void setDesiredVelocity(double v)
Description copied from interface: SimObject
Sets the desired velocity of this object - the SimWorld will then set its actual velocity accordingly (depending on wheher the object is colliding with another object etc.) Positive values mean the objet wants to move forward, and negative values mean the object wants to move backward. A velocity of 0 means the object wants to stop.
Specified by:
setDesiredVelocity in interface SimObject
Following copied from interface: interfaces.SimObject
Parameters:
v - the desired velocity

setActualVelocity

public void setActualVelocity(double v)
Description copied from interface: SimObject
Sets the actual velocity of this object.
Specified by:
setActualVelocity in interface SimObject
Following copied from interface: interfaces.SimObject
Parameters:
v - the actual velocity

setXCoord

public void setXCoord(double x)
Description copied from interface: SimObject
Sets this objects X coordinate
Specified by:
setXCoord in interface SimObject
Following copied from interface: interfaces.SimObject
Parameters:
x - the X coordinate

setYCoord

public void setYCoord(double y)
Description copied from interface: SimObject
Sets this objects Y coordinate
Specified by:
setYCoord in interface SimObject
Following copied from interface: interfaces.SimObject
Parameters:
y - the Y coordinate

setZCoord

public void setZCoord(double z)
Description copied from interface: SimObject
Sets this objects Z coordinate
Specified by:
setZCoord in interface SimObject
Following copied from interface: interfaces.SimObject
Parameters:
z - the Z coordinate

getDesiredVelocity

public double getDesiredVelocity()
Description copied from interface: SimObject
Returns this objects desired velocity. This may not be equal to its actual velocity.
Specified by:
getDesiredVelocity in interface SimObject
Following copied from interface: interfaces.SimObject
Returns:
the desired velocity as a double

getActualVelocity

public double getActualVelocity()
Description copied from interface: SimObject
Returns this objects actual velocity.
Specified by:
getActualVelocity in interface SimObject
Following copied from interface: interfaces.SimObject
Returns:
the actual velocity as a double

getXCoord

public double getXCoord()
Returns this sensor's X coordinate - derived from its owning SimObject
Specified by:
getXCoord in interface SimObject
Following copied from interface: interfaces.SimObject
Returns:
the X coordinate as a double

getYCoord

public double getYCoord()
Returns this sensor's X coordinate
Specified by:
getYCoord in interface SimObject
Following copied from interface: interfaces.SimObject
Returns:
the Y coordinate as a double

getZCoord

public double getZCoord()
Returns this sensor's Z coordinate - derived from its owning SimObject
Specified by:
getZCoord in interface SimObject
Following copied from interface: interfaces.SimObject
Returns:
the Z coordinate as a double

setDesiredBearingVelocityXZ

public void setDesiredBearingVelocityXZ(double v)
Description copied from interface: SimObject
Sets the desired 'bearing velocity' of this object in the XZ plane - a bearing velocity is the rate at which the object wants to turn. Positive values mean the object wants to turn clockwise, negative values mean the object wants to turn antoclockwise and a deisred bearing velocity of 0 means the object does not want to turn at all.
Specified by:
setDesiredBearingVelocityXZ in interface SimObject
Following copied from interface: interfaces.SimObject
Parameters:
v - the desired bearing velocity in the XZ plane

setDesiredBearingVelocityXY

public void setDesiredBearingVelocityXY(double v)
Description copied from interface: SimObject
Sets the desired 'bearing velocity' of this object in the XY plane.
Specified by:
setDesiredBearingVelocityXY in interface SimObject
Following copied from interface: interfaces.SimObject
Parameters:
v - the desired bearing velocity in the XY plane

setActualBearingVelocityXZ

public void setActualBearingVelocityXZ(double b)
Description copied from interface: SimObject
Sets the actual 'bearing velocity' of this object in the XZ plane.
Specified by:
setActualBearingVelocityXZ in interface SimObject
Following copied from interface: interfaces.SimObject
Parameters:
b - the actual bearing velocity in the XZ plane

setActualBearingVelocityXY

public void setActualBearingVelocityXY(double b)
Description copied from interface: SimObject
Sets the actual 'bearing velocity' of this object in the XY plane.
Specified by:
setActualBearingVelocityXY in interface SimObject
Following copied from interface: interfaces.SimObject
Parameters:
b - the actual bearing velocity in the XY plane

setActualBearingXZ

public void setActualBearingXZ(double b)
Description copied from interface: SimObject
Sets the actual bearing of this object in the XZ plane
Specified by:
setActualBearingXZ in interface SimObject
Following copied from interface: interfaces.SimObject
Parameters:
b - the bearing

setActualBearingXY

public void setActualBearingXY(double b)
Description copied from interface: SimObject
Sets the actual bearing of this object in the XY plane
Specified by:
setActualBearingXY in interface SimObject
Following copied from interface: interfaces.SimObject
Parameters:
b - the bearing

getDesiredBearingVelocityXZ

public double getDesiredBearingVelocityXZ()
Description copied from interface: SimObject
Returns this objects desired bearing velocity in the XZ plane
Specified by:
getDesiredBearingVelocityXZ in interface SimObject
Following copied from interface: interfaces.SimObject
Returns:
the desired bearing velocity as a double

getDesiredBearingVelocityXY

public double getDesiredBearingVelocityXY()
Description copied from interface: SimObject
Returns this objects desired bearing velocity in the XY plane
Specified by:
getDesiredBearingVelocityXY in interface SimObject
Following copied from interface: interfaces.SimObject
Returns:
the desired bearing velocity as a double

getActualBearingVelocityXZ

public double getActualBearingVelocityXZ()
Description copied from interface: SimObject
Returns this objects actual bearing velocity in the XZ plane
Specified by:
getActualBearingVelocityXZ in interface SimObject
Following copied from interface: interfaces.SimObject
Returns:
the actual bearing velocity as a double

getActualBearingVelocityXY

public double getActualBearingVelocityXY()
Description copied from interface: SimObject
Returns this objects actual bearing velocity in the XY plane
Specified by:
getActualBearingVelocityXY in interface SimObject
Following copied from interface: interfaces.SimObject
Returns:
the actual bearing velocity as a double

getActualBearingXZ

public double getActualBearingXZ()
Returns this sensor's XZ bearing (the same as the owning SimObject's bearing)
Specified by:
getActualBearingXZ in interface SimObject
Following copied from interface: interfaces.SimObject
Returns:
the actual bearing as a double

getActualBearingXY

public double getActualBearingXY()
Description copied from interface: SimObject
Returns this objects actual bearing in the XY plane
Specified by:
getActualBearingXY in interface SimObject
Following copied from interface: interfaces.SimObject
Returns:
the actual bearing as a double

getHeight

public double getHeight()
Description copied from interface: SimObject
Returns this object's height
Specified by:
getHeight in interface SimObject
Following copied from interface: interfaces.SimObject
Returns:
the height as a double

getWidth

public double getWidth()
Description copied from interface: SimObject
Returns this object's width
Specified by:
getWidth in interface SimObject
Following copied from interface: interfaces.SimObject
Returns:
the width as a double

getLength

public double getLength()
Description copied from interface: SimObject
Returns this object's length
Specified by:
getLength in interface SimObject
Following copied from interface: interfaces.SimObject
Returns:
the length as a double

getType

public java.lang.String getType()
Description copied from interface: SimObject
Returns a string describing this object's type
Specified by:
getType in interface SimObject
Following copied from interface: interfaces.SimObject
Returns:
the type as a string