10 #ifndef BEHAVIOUR_SENSORS_H
11 #define BEHAVIOUR_SENSORS_H
17 namespace behaviourcontrol
51 template <
class SClass>
void declareSensor(SClass* sensor);
54 std::vector<SensorBase*> SList;
95 virtual const std::type_info*
getTypeInfo()
const = 0;
103 virtual bool isBound()
const = 0;
122 class Sensor :
public SensorBase
130 const std::type_info*
const typeInfo;
131 virtual const std::type_info*
getTypeInfo()
const {
return typeInfo; }
139 virtual bool isBound()
const {
return (sourceAct != NULL); }
141 const T&
read()
const {
return data; }
147 bool actWasWrittenTo;
BehaviourManager *const MBase
Pointer to the parent behaviour manager.
Definition: behaviour_sensors.h:84
int ret_t
Used to represent an error code/function return value.
Definition: behaviour_common.h:142
virtual ~SensorManager()
Sensor manager object destructor.
Definition: behaviour_sensors.cpp:31
Implements a single behaviour layer.
Definition: behaviour_layer.h:26
Implements a single actuator of a given data type.
Definition: behaviour_actuators.h:131
virtual bool isBound() const =0
Abstract function that should be made to return whether this sensor has been bound to an actuator...
Sensor(SensorManager *SMBase, const std::string &signalName)
Default constructor.
Definition: behaviour_template_defns.h:60
Signals successful execution of a function, with no error conditions encountered. ...
Definition: behaviour_common.h:69
virtual void getLatestData()=0
Abstract function that should be made to retrieve the data from the bound actuator, and store it locally in the sensor.
static const index_t DEF_SLIST_CAPACITY
Default capacity of the list that stores the child sensors of the sensor manager. ...
Definition: behaviour_sensors.h:30
virtual const std::type_info * getTypeInfo() const =0
Abstract callback that should be overridden to return the type information of the sensor (i...
SensorBase(SensorManager *SMBase, const std::string &signalName)
Default constructor.
Definition: behaviour_sensors.cpp:75
bool wasWrittenTo() const
Valid after every call to getLatestData() (called by SensorManager::updateSensors() during the update...
Definition: behaviour_sensors.h:140
SensorBase * getBasePtr()
Return a pointer to the underlying SensorBase object in the case of a derived sensor class...
Definition: behaviour_sensors.h:107
std::size_t index_t
Used to represent an array or vector index (must be an unsigned type)
Definition: behaviour_common.h:140
BehaviourLayer *const LBase
Pointer to the parent behaviour layer.
Definition: behaviour_sensors.h:38
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 Actuato...
Definition: behaviour_template_defns.h:88
SensorManager *const SMBase
Pointer to the parent sensor manager.
Definition: behaviour_sensors.h:86
virtual ret_t bindTo(const ActuatorBase *ABase)=0
Abstract function that should be made to bind the sensor to the ABase actuator.
virtual bool isCompatibleWith(const ActuatorBase *ABase) const =0
Abstract callback that should evaluate whether the current sensor is compatible the actuator ABase (c...
virtual ret_t init()
Initialisation callback for the sensor manager. This function is called from BehaviourLayer::initAll(...
Definition: behaviour_sensors.h:42
virtual ~Sensor()
Destructor.
Definition: behaviour_template_defns.h:71
const T & read() const
Get the data from the last sensor update (i.e. get the data that was most recently copied from the so...
Definition: behaviour_sensors.h:141
virtual const std::type_info * getTypeInfo() const
Abstract callback that should be overridden to return the type information of the sensor (i...
Definition: behaviour_sensors.h:131
virtual bool isBound() const
Return whether this sensor has successfully been bound to an actuator.
Definition: behaviour_sensors.h:139
Implements a single actuator.
Definition: behaviour_actuators.h:76
virtual bool isCompatibleWith(const ActuatorBase *ABase) const
Abstract callback that should evaluate whether the current sensor is compatible the actuator ABase (c...
Definition: behaviour_template_defns.h:77
Implements a single behaviour manager.
Definition: behaviour_manager.h:27
BehaviourManager *const MBase
Pointer to the parent behaviour manager.
Definition: behaviour_sensors.h:37
virtual void getLatestData()
Get the latest data from the source actuator.
Definition: behaviour_template_defns.h:123
BehaviourLayer *const LBase
Pointer to the parent behaviour layer.
Definition: behaviour_sensors.h:85
Implements a single sensor.
Definition: behaviour_sensors.h:76
SensorManager * getBasePtr()
Return a pointer to the underlying SensorManager class object in the case of a derived sensor manager...
Definition: behaviour_sensors.h:61
Implements a manager of a particular group of sensors.
Definition: behaviour_sensors.h:26
virtual void writeExternalData()
Interface layer specific callback that is intended to be overridden by the user to write any availabl...
Definition: behaviour_sensors.h:58
SensorManager(BehaviourLayer *LBase)
Default constructor.
Definition: behaviour_sensors.cpp:19
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...
Definition: behaviour_sensors.h:87
Common definitions include file for the internal Behaviour Control Framework source code...
virtual ~SensorBase()
SensorBase object destructor.
Definition: behaviour_sensors.cpp:86