argos::CLightDefaultSensor Class Reference

#include <light_default_sensor.h>

Inheritance diagram for argos::CLightDefaultSensor:
Collaboration diagram for argos::CLightDefaultSensor:

Public Member Functions

 CLightDefaultSensor ()
 
virtual ~CLightDefaultSensor ()
 
virtual void SetRobot (CComposableEntity &c_entity)
 Sets the entity associated to this sensor. More...
 
virtual void Init (TConfigurationNode &t_tree)
 Initializes the sensor from the XML configuration tree. More...
 
virtual void Update ()
 Updates the state of the entity associated to this sensor, if the sensor is currently enabled. More...
 
virtual void Reset ()
 Resets the sensor to the state it had just after Init(). More...
 
virtual Real CalculateReading (Real f_distance, Real f_intensity)
 Calculates the light reading resulting from a light source at the given distance. More...
 
bool IsShowRays ()
 Returns true if the rays must be shown in the GUI. More...
 
void SetShowRays (bool b_show_rays)
 Sets whether or not the rays must be shown in the GUI. More...
 
- Public Member Functions inherited from argos::CSimulatedSensor
virtual ~CSimulatedSensor ()
 Class destructor. More...
 
- Public Member Functions inherited from argos::CCI_LightSensor
virtual ~CCI_LightSensor ()
 
const std::vector< Real > & GetReadings () const
 
- Public Member Functions inherited from argos::CCI_Sensor
virtual ~CCI_Sensor ()
 Class destructor. More...
 
virtual void Destroy ()
 Destroys the sensor. More...
 
virtual void Enable ()
 Enables updating of sensor information in the event loop. More...
 
virtual void Disable ()
 Disables updating of sensor information in the event loop. More...
 
bool IsEnabled () const
 
bool IsDisabled () const
 
- Public Member Functions inherited from argos::CBaseConfigurableResource
virtual ~CBaseConfigurableResource ()
 Class destructor. More...
 

Protected Attributes

CLightSensorEquippedEntitym_pcLightEntity
 Reference to light sensor equipped entity associated to this sensor. More...
 
CControllableEntitym_pcControllableEntity
 Reference to controllable entity associated to this sensor. More...
 
bool m_bShowRays
 Flag to show rays in the simulator. More...
 
CRandom::CRNGm_pcRNG
 Random number generator. More...
 
bool m_bAddNoise
 Whether to add noise or not. More...
 
CRange< Realm_cNoiseRange
 Noise range. More...
 
CSpacem_cSpace
 Reference to the space. More...
 
- Protected Attributes inherited from argos::CCI_LightSensor
std::vector< Realm_tReadings
 

Additional Inherited Members

- Public Types inherited from argos::CCI_Sensor
typedef std::map< std::string, CCI_Sensor *, std::less< std::string > > TMap
 

Detailed Description

Definition at line 26 of file light_default_sensor.h.

Constructor & Destructor Documentation

◆ CLightDefaultSensor()

argos::CLightDefaultSensor::CLightDefaultSensor ( )

Definition at line 25 of file light_default_sensor.cpp.

◆ ~CLightDefaultSensor()

virtual argos::CLightDefaultSensor::~CLightDefaultSensor ( )
inlinevirtual

Definition at line 33 of file light_default_sensor.h.

Member Function Documentation

◆ CalculateReading()

Real argos::CLightDefaultSensor::CalculateReading ( Real  f_distance,
Real  f_intensity 
)
virtual

Calculates the light reading resulting from a light source at the given distance.

Denoting the intensity with i and the distance x, this function calculates i = (I / x)^2. I is the reference intensity of the light, that is, the distance at which the light reading saturates. It is dependent on the light entity being considered.

Parameters
f_distanceThe distance of the considered light source.
f_intensityThe reference intensity of the considered light source.
Returns
A value in the range [0:1], where 0 means that the light is too far to be sensed, and 1 means the light is so close that it saturates the sensor.

Definition at line 165 of file light_default_sensor.cpp.

◆ Init()

void argos::CLightDefaultSensor::Init ( TConfigurationNode t_node)
virtual

Initializes the sensor from the XML configuration tree.

The default implementation of this method does nothing.

Parameters
t_nodeThe XML configuration tree relative to this sensor.
See also
Reset()
Destroy()

Reimplemented from argos::CCI_Sensor.

Definition at line 48 of file light_default_sensor.cpp.

◆ IsShowRays()

bool argos::CLightDefaultSensor::IsShowRays ( )
inline

Returns true if the rays must be shown in the GUI.

Returns
true if the rays must be shown in the GUI.

Definition at line 58 of file light_default_sensor.h.

◆ Reset()

void argos::CLightDefaultSensor::Reset ( )
virtual

Resets the sensor to the state it had just after Init().

The default implementation of this method does nothing.

See also
Init()
Destroy()

Reimplemented from argos::CCI_Sensor.

Definition at line 156 of file light_default_sensor.cpp.

◆ SetRobot()

void argos::CLightDefaultSensor::SetRobot ( CComposableEntity c_entity)
virtual

Sets the entity associated to this sensor.

When a controller is created, all the sensors and actuators are created, too. This function is called right before the Init() method of the sensor is called.

Parameters
c_entityThe entity to associate to this sensor.
See also
CComposableEntity
CControllableEntity::SetController()
CCI_Sensor::Init()

Implements argos::CSimulatedSensor.

Definition at line 34 of file light_default_sensor.cpp.

◆ SetShowRays()

void argos::CLightDefaultSensor::SetShowRays ( bool  b_show_rays)
inline

Sets whether or not the rays must be shown in the GUI.

Parameters
b_show_raystrue if the rays must be shown, false otherwise

Definition at line 66 of file light_default_sensor.h.

◆ Update()

void argos::CLightDefaultSensor::Update ( )
virtual

Updates the state of the entity associated to this sensor, if the sensor is currently enabled.

If it is disabled, then this function should do nothing.

Implements argos::CSimulatedSensor.

Definition at line 76 of file light_default_sensor.cpp.

Member Data Documentation

◆ m_bAddNoise

bool argos::CLightDefaultSensor::m_bAddNoise
protected

Whether to add noise or not.

Definition at line 85 of file light_default_sensor.h.

◆ m_bShowRays

bool argos::CLightDefaultSensor::m_bShowRays
protected

Flag to show rays in the simulator.

Definition at line 79 of file light_default_sensor.h.

◆ m_cNoiseRange

CRange<Real> argos::CLightDefaultSensor::m_cNoiseRange
protected

Noise range.

Definition at line 88 of file light_default_sensor.h.

◆ m_cSpace

CSpace& argos::CLightDefaultSensor::m_cSpace
protected

Reference to the space.

Definition at line 91 of file light_default_sensor.h.

◆ m_pcControllableEntity

CControllableEntity* argos::CLightDefaultSensor::m_pcControllableEntity
protected

Reference to controllable entity associated to this sensor.

Definition at line 76 of file light_default_sensor.h.

◆ m_pcLightEntity

CLightSensorEquippedEntity* argos::CLightDefaultSensor::m_pcLightEntity
protected

Reference to light sensor equipped entity associated to this sensor.

Definition at line 73 of file light_default_sensor.h.

◆ m_pcRNG

CRandom::CRNG* argos::CLightDefaultSensor::m_pcRNG
protected

Random number generator.

Definition at line 82 of file light_default_sensor.h.