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) |
Namespace for the mqtt_client package.
void mqtt_client::deserializeRosMessage | ( | const rclcpp::SerializedMessage & | serialized_msg, |
T & | msg | ||
) |
Deserializes a ROS message.
T | ROS message type |
[in] | serialized_msg | serialized message |
[out] | msg | ROS message |
Definition at line 553 of file MqttClient.ros2.hpp.
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.
[in] | serialized_msg | generic serialized ROS message |
[in] | msg_type | ROS message type, e.g. std_msgs/msg/String |
[out] | primitive | string representation of primitive message data |
Definition at line 78 of file MqttClient.ros2.cpp.
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
[in] | msg | generic ShapeShifter ROS message |
[out] | primitive | string representation of primitive message data |
Definition at line 95 of file MqttClient.cpp.
void mqtt_client::serializeRosMessage | ( | const T & | msg, |
rclcpp::SerializedMessage & | serialized_msg | ||
) |
Serializes a ROS message.
T | ROS message type |
[in] | msg | ROS message |
[out] | serialized_msg | serialized message |
Definition at line 536 of file MqttClient.ros2.hpp.
void mqtt_client::serializeRosMessage | ( | const T & | msg, |
std::vector< uint8_t > & | buffer | ||
) |
Serializes a ROS message to a buffer.
T | ROS message type |
[in] | msg | ROS message |
[out] | buffer | buffer to serialize to |
Definition at line 541 of file MqttClient.h.