Template Class SensorData

Inheritance Relationships

Derived Type

Class Documentation

template<typename T>
class SensorData

SensorData object to publish data in a topic.

Template Parameters:

T – Type of the message

Subclassed by as2::sensors::Sensor< T >

Public Functions

inline explicit SensorData(const std::string &topic_name, rclcpp::Node *node_ptr, bool add_sensor_measurements_base = true)

Construct a new GenericSensor object.

Parameters:

node_ptr – Pointer to the node

inline virtual ~SensorData()

Destroy the GenericSensor object.

inline void setData(const T &msg)

Update the message value.

Parameters:

msg – Message

inline void publish()

Publish the data stored in the message.

inline void updateAndPublish(const T &msg)

Update the message value and publish it.

Parameters:

msg – Message

inline const std::string &getTopicName() const

Get the Topic Name object.

Returns:

std::string Topic name

inline const T &getData() const

Get the data stored in the message.

Returns:

T Message

Public Static Functions

static inline std::string processTopicName(const std::string &topic_name, bool add_sensor_measurements_base = true)

Process the topic name with the sensor measurements base.

Parameters:
  • topic_name – Topic name

  • add_sensor_measurements_base – Add “sensor_measurements” to the topic name

Returns:

std::string Processed topic name