IRSensorController Class Reference

The base abstract class of sensor controllers for infrared sensors. More...

Inheritance diagram for IRSensorController:

Public Member Functions

 IRSensorController (World *world, unsigned int numSensors)
 Constructor.
 
virtual ~IRSensorController ()
 Destructor.
 
double activation (int i) const
 Returns the activation of the i-th sensors.
 
int nSensors () const
 Returns the number of sensors.
 
bool sensorIsActive (int i) const
 Returns whether the i-th sensor is active or not.
 
virtual void setSensorActive (int i, bool active)
 Sets whether the i-th sensor is active or not.
 
- Public Member Functions inherited from SensorController
 SensorController (World *world)
 Constructor.
 
virtual ~SensorController ()
 Destructor.
 
bool isEnabled ()
 Returns true if the sensor is enabled.
 
void setEnabled (bool b)
 Enables/Disables this sensor controller.
 
virtual void update ()=0
 Updates the sensor reading.
 
Worldworld ()
 Returns the world.
 
- Public Member Functions inherited from Ownable
 Ownable ()
 Constructor.
 
virtual ~Ownable ()
 Destructor.
 
const QList< Owned > & owned () const
 Returns the list of objects owned by this one.
 
Ownableowner () const
 Returns the owner of this object.
 
void setOwner (Ownable *owner, bool destroy=true)
 Sets the owner of this object.
 

Protected Attributes

QVector< double > m_activations
 The vector with sensors activations.
 
QVector< bool > m_activeSensor
 The vector storing whether the i-th sensor should be active or not.
 

Additional Inherited Members

- Public Types inherited from Ownable
typedef QList< OwnedOwnedList
 The type for the list of owned objects.
 

Detailed Description

The base abstract class of sensor controllers for infrared sensors.

This is an abstract base class providing an uniform interface for different implementations, use one of its subclasses below. This class only provides a vector of activations (m_activations) which must be filled in the update() function by subclasses

Definition at line 132 of file sensorcontrollers.h.

Constructor & Destructor Documentation

IRSensorController ( World world,
unsigned int  numSensors 
)

Constructor.

Parameters
worldthe world in which we live
numSensorsthe number of proximity IR sensors

Definition at line 43 of file sensorcontrollers.cpp.

~IRSensorController ( )
virtual

Destructor.

Definition at line 50 of file sensorcontrollers.cpp.

Member Function Documentation

double activation ( int  i) const
inline

Returns the activation of the i-th sensors.

Parameters
ithe index of the sensor whose activation value should be returned
Returns
the activation of the i-th sensor

Definition at line 163 of file sensorcontrollers.h.

int nSensors ( ) const
inline

Returns the number of sensors.

Definition at line 151 of file sensorcontrollers.h.

bool sensorIsActive ( int  i) const
inline

Returns whether the i-th sensor is active or not.

Parameters
ithe index of the sensor
Returns
true if the sensor is active, false if it is not

Definition at line 174 of file sensorcontrollers.h.

void setSensorActive ( int  i,
bool  active 
)
virtual

Sets whether the i-th sensor is active or not.

This is virtual to allow subclasses to take actions depending on whether the sensor is active or not

Parameters
ithe index of the sensor
activeif true the sensor is active

Reimplemented in SimulatedIRGroundSensorController, and SimulatedIRProximitySensorController.

Definition at line 55 of file sensorcontrollers.cpp.

References IRSensorController::m_activeSensor.

Referenced by SimulatedIRProximitySensorController::setSensorActive(), and SimulatedIRGroundSensorController::setSensorActive().

Member Data Documentation

QVector<double> m_activations
protected

The vector with sensors activations.

Definition at line 193 of file sensorcontrollers.h.

Referenced by SimulatedIRProximitySensorController::update(), and SimulatedIRGroundSensorController::update().

QVector<bool> m_activeSensor
protected

The vector storing whether the i-th sensor should be active or not.

If m_activeSensor[i] is false the i-th sensor should not be updated by subclasses

Definition at line 202 of file sensorcontrollers.h.

Referenced by SimulatedIRProximitySensorController::setGraphicalProperties(), SimulatedIRGroundSensorController::setGraphicalProperties(), IRSensorController::setSensorActive(), SimulatedIRProximitySensorController::update(), and SimulatedIRGroundSensorController::update().


The documentation for this class was generated from the following files: