NimbRo ROS Soccer Package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
behaviourcontrol::Sensor< T > Class Template Reference

Implements a single sensor of a given data type. More...

#include <behaviour_sensors.h>

Inheritance diagram for behaviourcontrol::Sensor< T >:
behaviourcontrol::SensorBase

Public Member Functions

 Sensor (SensorManager *SMBase, const std::string &signalName)
 Default constructor. More...
 
virtual ~Sensor ()
 Destructor.
 
virtual const std::type_info * getTypeInfo () const
 Abstract callback that should be overridden to return the type information of the sensor (i.e. a std::type_info object). Refer to the default override Sensor::getTypeInfo().
 
virtual bool isCompatibleWith (const ActuatorBase *ABase) const
 Abstract callback that should evaluate whether the current sensor is compatible the actuator ABase (can bind to it). Refer to the default override Sensor::isCompatibleWith().
 
virtual bool isBound () const
 Return whether this sensor has successfully been bound to an actuator.
 
bool wasWrittenTo () const
 Valid after every call to getLatestData() (called by SensorManager::updateSensors() during the update phase of a global step).
 
const T & read () const
 Get the data from the last sensor update (i.e. get the data that was most recently copied from the source actuator).
 
- Public Member Functions inherited from behaviourcontrol::SensorBase
 SensorBase (SensorManager *SMBase, const std::string &signalName)
 Default constructor. More...
 
virtual ~SensorBase ()
 SensorBase object destructor.
 
SensorBasegetBasePtr ()
 Return a pointer to the underlying SensorBase object in the case of a derived sensor class.
 

Public Attributes

const std::type_info *const typeInfo
 
- Public Attributes inherited from behaviourcontrol::SensorBase
BehaviourManager *const MBase
 Pointer to the parent behaviour manager.
 
BehaviourLayer *const LBase
 Pointer to the parent behaviour layer.
 
SensorManager *const SMBase
 Pointer to the parent sensor manager.
 
const std::string signalName
 The name of the actuator that this sensor should bind to. This name is used as the lookup key for the BehaviourManager::findActuator() function.
 

Protected Member Functions

virtual ret_t bindTo (const ActuatorBase *ABase)
 Bind to the actuator ABase. This must be called with an ABase that is actually pointing to an Actuator<T>, or no binding happens.
 
virtual void getLatestData ()
 Get the latest data from the source actuator.
 

Detailed Description

template<class T>
class behaviourcontrol::Sensor< T >

Implements a single sensor of a given data type.

This class is used to define the sensors of a SensorManager. The template parameter specifies the desired data type of the sensor.

Constructor & Destructor Documentation

template<class T >
behaviourcontrol::Sensor< T >::Sensor ( SensorManager SMBase,
const std::string &  signalName 
)

Default constructor.

Parameters
SMBaseA pointer to the sensor manager that the sensor belongs to.
signalNameThe unique human-friendly name of the actuator to bind the sensor to. Lookup of the actuator occurs using this name as the key. The name can be completely arbitrary, with the only restriction being that it can't be the null string, but recommended sample names include "OtherLayer/ActuatorName" and "Layer1/TargetX", where OtherLayer and Layer1 are the names of the layers in which the ActuatorName and TargetX actuators are defined respectively.
See Also
Default Actuator constructor

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