Template Class Sensor

Inheritance Relationships

Base Types

Class Documentation

template<typename T>
class Sensor : public as2::sensors::TFStatic, protected as2::sensors::GenericSensor, protected as2::sensors::SensorData<T>

Sensor handler to publish sensor data at a given frequency.

Public Functions

inline Sensor(const std::string &id, as2::Node *node_ptr, float pub_freq = -1.0f, bool add_sensor_measurements_base = true)

Construct a new Sensor object.

Parameters:
  • idSensor ID

  • node_ptr – Pointer to the node

  • pub_freq – Frequency to publish the data (-1 to publish every time updateData is called)

  • add_sensor_measurements_base – Add “sensor_measurements” to the topic name

inline Sensor(const std::string &id, as2::Node *node_ptr, int pub_freq, bool add_sensor_measurements_base = true)

Construct a new Sensor object.

Parameters:
  • idSensor ID

  • node_ptr – Pointer to the node

  • pub_freq – Frequency to publish the data (-1 to publish every time updateData is called)

  • add_sensor_measurements_base – Add “sensor_measurements” to the topic name

inline Sensor(const std::string &id, as2::Node *node_ptr, double pub_freq, bool add_sensor_measurements_base = true)

Construct a new Sensor object.

Parameters:
  • idSensor ID

  • node_ptr – Pointer to the node

  • pub_freq – Frequency to publish the data (-1 to publish every time updateData is called)

  • add_sensor_measurements_base – Add “sensor_measurements” to the topic name

inline virtual ~Sensor()

Destroy the Sensor object.

inline void updateData(const T &msg)

Update the data of the sensor.

If the frequency is set to -1, the data is published immediately Otherwise, the data is stored and published at the given frequency

Parameters:

msg – Message

Protected Functions

inline virtual void publishData() override

Publish the data in a topic.