Classes | Functions
mqtt_client Namespace Reference

Namespace for the mqtt_client package. More...

Classes

class  MqttClient
 ROS Nodelet for sending and receiving ROS messages via MQTT. More...
 

Functions

template<typename T >
void deserializeRosMessage (const rclcpp::SerializedMessage &serialized_msg, T &msg)
 
bool primitiveRosMessageToString (const std::shared_ptr< rclcpp::SerializedMessage > &serialized_msg, const std::string &msg_type, std::string &primitive)
 Extracts string of primitive data types from ROS message. More...
 
bool primitiveRosMessageToString (const topic_tools::ShapeShifter::ConstPtr &msg, std::string &primitive)
 Extracts string of primitive data types from ROS message. More...
 
template<typename T >
void serializeRosMessage (const T &msg, rclcpp::SerializedMessage &serialized_msg)
 
template<typename T >
void serializeRosMessage (const T &msg, std::vector< uint8_t > &buffer)
 

Detailed Description

Namespace for the mqtt_client package.

Function Documentation

◆ deserializeRosMessage()

template<typename T >
void mqtt_client::deserializeRosMessage ( const rclcpp::SerializedMessage &  serialized_msg,
T &  msg 
)

Deserializes a ROS message.

Template Parameters
TROS message type
Parameters
[in]serialized_msgserialized message
[out]msgROS message

Definition at line 553 of file MqttClient.ros2.hpp.

◆ primitiveRosMessageToString() [1/2]

bool mqtt_client::primitiveRosMessageToString ( const std::shared_ptr< rclcpp::SerializedMessage > &  serialized_msg,
const std::string &  msg_type,
std::string &  primitive 
)

Extracts string of primitive data types from ROS message.

This is helpful to extract the actual data payload of a primitive ROS message. If e.g. an std_msgs/msg/String is serialized to a string representation, it also contains the field name 'data'. This function instead returns the underlying value as string.

Parameters
[in]serialized_msggeneric serialized ROS message
[in]msg_typeROS message type, e.g. std_msgs/msg/String
[out]primitivestring representation of primitive message data
Returns
true if primitive ROS message type was found
false if ROS message type is not primitive

Definition at line 78 of file MqttClient.ros2.cpp.

◆ primitiveRosMessageToString() [2/2]

bool mqtt_client::primitiveRosMessageToString ( const topic_tools::ShapeShifter::ConstPtr msg,
std::string &  primitive 
)

Extracts string of primitive data types from ROS message.

This is helpful to extract the actual data payload of a primitive ROS message. If e.g. an std_msgs/String is serialized to a string representation, it also contains the field name 'data'. This function instead returns the underlying value as string.

The following primitive ROS message types are supported: std_msgs/String std_msgs/Bool std_msgs/Char std_msgs/UInt8 std_msgs/UInt16 std_msgs/UInt32 std_msgs/UInt64 std_msgs/Int8 std_msgs/Int16 std_msgs/Int32 std_msgs/Int64 std_msgs/Float32 std_msgs/Float64

Parameters
[in]msggeneric ShapeShifter ROS message
[out]primitivestring representation of primitive message data
Returns
true if primitive ROS message type was found
false if ROS message type is not primitive

Definition at line 95 of file MqttClient.cpp.

◆ serializeRosMessage() [1/2]

template<typename T >
void mqtt_client::serializeRosMessage ( const T &  msg,
rclcpp::SerializedMessage &  serialized_msg 
)

Serializes a ROS message.

Template Parameters
TROS message type
Parameters
[in]msgROS message
[out]serialized_msgserialized message

Definition at line 536 of file MqttClient.ros2.hpp.

◆ serializeRosMessage() [2/2]

template<typename T >
void mqtt_client::serializeRosMessage ( const T &  msg,
std::vector< uint8_t > &  buffer 
)

Serializes a ROS message to a buffer.

Template Parameters
TROS message type
Parameters
[in]msgROS message
[out]bufferbuffer to serialize to

Definition at line 541 of file MqttClient.h.



mqtt_client
Author(s): Lennart Reiher , Bastian Lampe , Christian Wende
autogenerated on Thu Oct 5 2023 02:09:10