@@ -144,7 +144,7 @@ class MqttClient : public rclcpp::Node,
144
144
void setup ();
145
145
146
146
/* *
147
- * TODO
147
+ * @brief Checks all active ROS topics in order to set up generic subscribers.
148
148
*/
149
149
void setupSubscriptions ();
150
150
@@ -160,9 +160,16 @@ class MqttClient : public rclcpp::Node,
160
160
void connect ();
161
161
162
162
/* *
163
- * @brief Serializes and publishes a generic ROS message to the MQTT broker.
163
+ * @brief Publishes a generic serialized ROS message to the MQTT broker.
164
164
*
165
- * TODO
165
+ * Before publishing the ROS message to the MQTT broker, the ROS message type
166
+ * is extracted. This type information is also sent to the MQTT broker on a
167
+ * separate topic.
168
+ *
169
+ * The MQTT payload for the actual ROS message carries the following:
170
+ * - 0 or 1 (indicating if timestamp is injected (=1))
171
+ * - serialized timestamp (optional)
172
+ * - serialized ROS message
166
173
*
167
174
* @param serialized_msg generic serialized ROS message
168
175
* @param ros_topic ROS topic where the message was published
@@ -174,9 +181,18 @@ class MqttClient : public rclcpp::Node,
174
181
/* *
175
182
* @brief Publishes a ROS message received via MQTT to ROS.
176
183
*
177
- * TODO
184
+ * This utilizes the generic publisher stored for the MQTT topic on which the
185
+ * message was received. The publisher has to be configured to the ROS message
186
+ * type of the message. If the message carries an injected timestamp, the
187
+ * latency is computed and published.
188
+ *
189
+ * The MQTT payload is expected to carry the following:
190
+ * - 0 or 1 (indicating if timestamp is injected (=1))
191
+ * - serialized timestamp (optional)
192
+ * - serialized ROS message
178
193
*
179
194
* @param mqtt_msg MQTT message
195
+ * @param arrival_stamp arrival timestamp used for latency computation
180
196
*/
181
197
void mqtt2ros (mqtt::const_message_ptr mqtt_msg,
182
198
const rclcpp::Time& arrival_stamp);
@@ -366,7 +382,9 @@ class MqttClient : public rclcpp::Node,
366
382
*/
367
383
static const std::string kLatencyRosTopicPrefix ;
368
384
369
- // TODO
385
+ /* *
386
+ * @brief Timer to repeatedly check active ROS topics for topics to subscribe
387
+ */
370
388
rclcpp::TimerBase::SharedPtr check_subscriptions_timer_;
371
389
372
390
/* *
@@ -410,7 +428,9 @@ class MqttClient : public rclcpp::Node,
410
428
*/
411
429
std::map<std::string, Mqtt2RosInterface> mqtt2ros_;
412
430
413
- // TODO
431
+ /* *
432
+ * Message length of a serialized `builtin_interfaces::msg::Time` message
433
+ */
414
434
uint32_t stamp_length_;
415
435
};
416
436
@@ -440,14 +460,12 @@ bool MqttClient::loadParameter(const std::string& key, T& value,
440
460
441
461
442
462
/* *
443
- * Serializes a ROS message to a buffer.
444
- *
445
- * TODO
463
+ * Serializes a ROS message.
446
464
*
447
- * @tparam T ROS message type
465
+ * @tparam T ROS message type
448
466
*
449
- * @param[in] msg ROS message
450
- * @param[out] buffer buffer to serialize to
467
+ * @param[in] msg ROS message
468
+ * @param[out] serialized_msg serialized message
451
469
*/
452
470
template <typename T>
453
471
void serializeRosMessage (const T& msg,
@@ -459,7 +477,12 @@ void serializeRosMessage(const T& msg,
459
477
460
478
461
479
/* *
462
- * TODO
480
+ * Deserializes a ROS message.
481
+ *
482
+ * @tparam T ROS message type
483
+ *
484
+ * @param[in] serialized_msg serialized message
485
+ * @param[out] msg ROS message
463
486
*/
464
487
template <typename T>
465
488
void deserializeRosMessage (const rclcpp::SerializedMessage& serialized_msg,
0 commit comments