opal::InclineSensor Class Reference

#include <InclineSensor.h>

Inheritance diagram for opal::InclineSensor:

opal::Sensor List of all members.

Public Member Functions

 InclineSensor ()
virtual ~InclineSensor ()
virtual void OPAL_CALL init (const InclineSensorData &data)
virtual const InclineSensorData
&OPAL_CALL 
getData () const
virtual real OPAL_CALL getAngle ()
virtual void OPAL_CALL setEnabled (bool e)
virtual bool OPAL_CALL isEnabled () const
virtual void OPAL_CALL setAxis (const Vec3r &axis)
virtual const Vec3r &OPAL_CALL getAxis ()
virtual void OPAL_CALL setTransform (const Matrix44r &t)
virtual const Matrix44r &OPAL_CALL getTransform () const
virtual SensorType OPAL_CALL getType () const
virtual void OPAL_CALL setName (const std::string &name)
virtual const std::string
&OPAL_CALL 
getName () const
virtual void OPAL_CALL internal_update ()
virtual bool OPAL_CALL internal_dependsOnSolid (Solid *s)

Protected Member Functions

void setupInternalVectors ()

Protected Attributes

InclineSensorData mData
Vec3r mLocalReferenceVec
Vec3r mInitGlobalReferenceVec

Detailed Description

A Sensor that measures a Solid's "tilt." This is similar to a real inclinometer that monitors how an object is oriented with respect to gravity. This Sensor takes a rotation axis (defined relative to the attached Solid's transform) and returns an angle describing how far the Solid has rotated around that axis. The rotation of the Solid is defined as zero degrees when the Sensor is initialized or when the rotation axis is redefined. This Sensor does nothing if it is not attached to a Solid (i.e. its returned values are always zero).

Definition at line 48 of file InclineSensor.h.


Constructor & Destructor Documentation

opal::InclineSensor::InclineSensor  ) 
 

Definition at line 33 of file InclineSensor.cpp.

opal::InclineSensor::~InclineSensor  )  [virtual]
 

Definition at line 40 of file InclineSensor.cpp.


Member Function Documentation

real opal::InclineSensor::getAngle  )  [virtual]
 

Returns the angle of rotation about the local rotation axis relative to the initial angle of rotation.

Definition at line 58 of file InclineSensor.cpp.

References opal::angleBetween(), opal::areCollinear(), opal::InclineSensorData::axis, opal::cross(), opal::SensorData::enabled, opal::Solid::getTransform(), mData, mInitGlobalReferenceVec, mLocalReferenceVec, opal::project(), and opal::SensorData::solid.

const Vec3r & opal::InclineSensor::getAxis  )  [virtual]
 

Returns the local rotation axis.

Definition at line 129 of file InclineSensor.cpp.

References opal::InclineSensorData::axis, and mData.

const InclineSensorData & opal::InclineSensor::getData  )  const [virtual]
 

Returns all data describing the Sensor.

Definition at line 53 of file InclineSensor.cpp.

References mData.

const std::string & opal::InclineSensor::getName  )  const [virtual]
 

Returns the Sensor's name.

Implements opal::Sensor.

Definition at line 154 of file InclineSensor.cpp.

References mData, and opal::SensorData::name.

const Matrix44r & opal::InclineSensor::getTransform  )  const [virtual]
 

Returns the Sensor's transform.

Implements opal::Sensor.

Definition at line 144 of file InclineSensor.cpp.

References mData, and opal::SensorData::transform.

SensorType opal::InclineSensor::getType  )  const [virtual]
 

Returns the Sensor type.

Implements opal::Sensor.

Definition at line 134 of file InclineSensor.cpp.

References opal::SensorData::getType(), and mData.

void opal::InclineSensor::init const InclineSensorData data  )  [virtual]
 

Initializes the Sensor with the given data structure. This will define the rotation angle as zero degrees when called. The Solid pointer should be valid because this Sensor only works when attached to something. This does nothing if the Sensor's Solid pointer is NULL.

Definition at line 44 of file InclineSensor.cpp.

References opal::Sensor::init(), mData, and setupInternalVectors().

bool opal::InclineSensor::internal_dependsOnSolid Solid s  )  [virtual]
 

Returns true if this Sensor depends on the given Solid.

Reimplemented from opal::Sensor.

Definition at line 167 of file InclineSensor.cpp.

References mData, and opal::SensorData::solid.

void opal::InclineSensor::internal_update  )  [virtual]
 

Called regularly to update the Sensor. This does nothing if the Sensor is disabled.

Implements opal::Sensor.

Definition at line 159 of file InclineSensor.cpp.

References opal::SensorData::enabled, mData, and opal::SensorData::solid.

bool opal::InclineSensor::isEnabled  )  const [virtual]
 

Returns true if the Sensor is enabled.

Implements opal::Sensor.

Definition at line 111 of file InclineSensor.cpp.

References opal::SensorData::enabled, and mData.

void opal::InclineSensor::setAxis const Vec3r axis  )  [virtual]
 

Sets the local rotation axis around which the angle of rotation will be measured. This will redefine the rotation angle as zero degrees when called. This does nothing if the Sensor's Solid pointer is NULL.

Definition at line 116 of file InclineSensor.cpp.

References opal::defaults::sensor::incline::axis, opal::InclineSensorData::axis, mData, setupInternalVectors(), and opal::SensorData::solid.

void opal::InclineSensor::setEnabled bool  e  )  [virtual]
 

Sets whether the Sensor can update its measurements.

Implements opal::Sensor.

Definition at line 101 of file InclineSensor.cpp.

References opal::SensorData::enabled, and mData.

void opal::InclineSensor::setName const std::string &  name  )  [virtual]
 

Sets the Sensor's name.

Implements opal::Sensor.

Definition at line 149 of file InclineSensor.cpp.

References mData, and opal::SensorData::name.

void opal::InclineSensor::setTransform const Matrix44r t  )  [virtual]
 

Sets the Sensor's transform.

Implements opal::Sensor.

Definition at line 139 of file InclineSensor.cpp.

References mData, and opal::SensorData::transform.

void opal::InclineSensor::setupInternalVectors  )  [protected]
 

A helper function that sets up all internal vectors used when calculating the angle of rotation.

Definition at line 179 of file InclineSensor.cpp.

References opal::areCollinear(), opal::InclineSensorData::axis, opal::cross(), opal::Solid::getTransform(), mData, mInitGlobalReferenceVec, mLocalReferenceVec, opal::Vec3r::set(), and opal::SensorData::solid.

Referenced by init(), and setAxis().


Member Data Documentation

InclineSensorData opal::InclineSensor::mData [protected]
 

Stores data describing the Sensor.

Definition at line 102 of file InclineSensor.h.

Referenced by getAngle(), getAxis(), getData(), getName(), getTransform(), getType(), init(), internal_dependsOnSolid(), internal_update(), isEnabled(), setAxis(), setEnabled(), setName(), setTransform(), and setupInternalVectors().

Vec3r opal::InclineSensor::mInitGlobalReferenceVec [protected]
 

A vector used to measure the angle of rotation.

Definition at line 108 of file InclineSensor.h.

Referenced by getAngle(), and setupInternalVectors().

Vec3r opal::InclineSensor::mLocalReferenceVec [protected]
 

A vector used to measure the angle of rotation.

Definition at line 105 of file InclineSensor.h.

Referenced by getAngle(), and setupInternalVectors().


The documentation for this class was generated from the following files:
Generated on Tue May 16 17:49:56 2006 for OPAL by  doxygen 1.4.6-NO