@@ -40,13 +40,13 @@ SOFTWARE.
40
40
41
41
42
42
/* *
43
- * Namespace for the mqtt_client package
43
+ * @brief Namespace for the mqtt_client package
44
44
*/
45
45
namespace mqtt_client {
46
46
47
47
48
48
/* *
49
- * ROS Nodelet for sending and receiving ROS messages via MQTT
49
+ * @brief ROS Nodelet for sending and receiving ROS messages via MQTT
50
50
*
51
51
* The MqttClient enables connected ROS-based devices or robots to
52
52
* exchange ROS messages via an MQTT broker using the MQTT protocol.
@@ -60,19 +60,19 @@ class MqttClient : public nodelet::Nodelet,
60
60
61
61
protected:
62
62
/* *
63
- * Initializes nodelet when nodelet is loaded.
63
+ * @brief Initializes nodelet when nodelet is loaded.
64
64
*
65
65
* Overrides nodelet::Nodelet::onInit().
66
66
*/
67
67
virtual void onInit () override ;
68
68
69
69
/* *
70
- * Loads ROS parameters from parameter server.
70
+ * @brief Loads ROS parameters from parameter server.
71
71
*/
72
72
void loadParameters ();
73
73
74
74
/* *
75
- * Loads requested ROS parameter from parameter server.
75
+ * @brief Loads requested ROS parameter from parameter server.
76
76
*
77
77
* @param[in] key parameter name
78
78
* @param[out] value variable where to store the retrieved parameter
@@ -83,7 +83,8 @@ class MqttClient : public nodelet::Nodelet,
83
83
bool loadParameter (const std::string& key, std::string& value);
84
84
85
85
/* *
86
- * Loads requested ROS parameter from parameter server, allows default value.
86
+ * @brief Loads requested ROS parameter from parameter server, allows default
87
+ * value.
87
88
*
88
89
* @param[in] key parameter name
89
90
* @param[out] value variable where to store the retrieved parameter
@@ -96,7 +97,7 @@ class MqttClient : public nodelet::Nodelet,
96
97
const std::string& default_value);
97
98
98
99
/* *
99
- * Loads requested ROS parameter from parameter server.
100
+ * @brief Loads requested ROS parameter from parameter server.
100
101
*
101
102
* @tparam T type (one of int, double, bool)
102
103
*
@@ -110,7 +111,8 @@ class MqttClient : public nodelet::Nodelet,
110
111
bool loadParameter (const std::string& key, T& value);
111
112
112
113
/* *
113
- * Loads requested ROS parameter from parameter server, allows default value.
114
+ * @brief Loads requested ROS parameter from parameter server, allows default
115
+ * value.
114
116
*
115
117
* @tparam T type (one of int, double, bool)
116
118
*
@@ -125,7 +127,8 @@ class MqttClient : public nodelet::Nodelet,
125
127
bool loadParameter (const std::string& key, T& value, const T& default_value);
126
128
127
129
/* *
128
- * Converts a string to a path object resolving paths relative to ROS_HOME.
130
+ * @brief Converts a string to a path object resolving paths relative to
131
+ * ROS_HOME.
129
132
*
130
133
* Resolves relative to CWD, if ROS_HOME is not set.
131
134
* Returns empty path, if argument is empty.
@@ -137,22 +140,23 @@ class MqttClient : public nodelet::Nodelet,
137
140
std::filesystem::path resolvePath (const std::string& path_string);
138
141
139
142
/* *
140
- * Initializes broker connection and subscriptions.
143
+ * @brief Initializes broker connection and subscriptions.
141
144
*/
142
145
void setup ();
143
146
144
147
/* *
145
- * Sets up the client connection options and initializes the client object.
148
+ * @brief Sets up the client connection options and initializes the client
149
+ * object.
146
150
*/
147
151
void setupClient ();
148
152
149
153
/* *
150
- * Connects to the broker using the member client and options.
154
+ * @brief Connects to the broker using the member client and options.
151
155
*/
152
156
void connect ();
153
157
154
158
/* *
155
- * Serializes and publishes a generic ROS message to the MQTT broker.
159
+ * @brief Serializes and publishes a generic ROS message to the MQTT broker.
156
160
*
157
161
* Before serializing the ROS message and publishing it to the MQTT broker,
158
162
* metadata on the ROS message type is extracted. This type information is
@@ -170,7 +174,7 @@ class MqttClient : public nodelet::Nodelet,
170
174
const std::string& ros_topic);
171
175
172
176
/* *
173
- * Publishes a ROS message received via MQTT to ROS.
177
+ * @brief Publishes a ROS message received via MQTT to ROS.
174
178
*
175
179
* This utilizes the ShapeShifter stored for the MQTT topic on which the
176
180
* message was received. The ShapeShifter has to be configured to the ROS
@@ -189,7 +193,8 @@ class MqttClient : public nodelet::Nodelet,
189
193
void mqtt2ros (mqtt::const_message_ptr mqtt_msg);
190
194
191
195
/* *
192
- * Callback for when the client has successfully connected to the broker.
196
+ * @brief Callback for when the client has successfully connected to the
197
+ * broker.
193
198
*
194
199
* Overrides mqtt::callback::connected(const std::string&).
195
200
*
@@ -198,7 +203,7 @@ class MqttClient : public nodelet::Nodelet,
198
203
void connected (const std::string& cause) override ;
199
204
200
205
/* *
201
- * Callback for when the client has lost connection to the broker.
206
+ * @brief Callback for when the client has lost connection to the broker.
202
207
*
203
208
* Overrides mqtt::callback::connection_lost(const std::string&).
204
209
*
@@ -227,7 +232,8 @@ class MqttClient : public nodelet::Nodelet,
227
232
IsConnected::Response& response);
228
233
229
234
/* *
230
- * Callback for when the client receives a MQTT message from the broker.
235
+ * @brief Callback for when the client receives a MQTT message from the
236
+ * broker.
231
237
*
232
238
* Overrides mqtt::callback::message_arrived(mqtt::const_message_ptr).
233
239
* If the received MQTT message contains information about a ROS message type,
@@ -239,7 +245,7 @@ class MqttClient : public nodelet::Nodelet,
239
245
void message_arrived (mqtt::const_message_ptr mqtt_msg) override ;
240
246
241
247
/* *
242
- * Callback for when delivery for a MQTT message has been completed.
248
+ * @brief Callback for when delivery for a MQTT message has been completed.
243
249
*
244
250
* Overrides mqtt::callback::delivery_complete(mqtt::delivery_token_ptr).
245
251
*
@@ -248,7 +254,7 @@ class MqttClient : public nodelet::Nodelet,
248
254
void delivery_complete (mqtt::delivery_token_ptr token) override ;
249
255
250
256
/* *
251
- * Callback for when a MQTT action succeeds.
257
+ * @brief Callback for when a MQTT action succeeds.
252
258
*
253
259
* Overrides mqtt::iaction_listener::on_success(const mqtt::token&).
254
260
* Does nothing.
@@ -258,7 +264,7 @@ class MqttClient : public nodelet::Nodelet,
258
264
void on_success (const mqtt::token& token) override ;
259
265
260
266
/* *
261
- * Callback for when a MQTT action fails.
267
+ * @brief Callback for when a MQTT action fails.
262
268
*
263
269
* Overrides mqtt::iaction_listener::on_failure(const mqtt::token&).
264
270
* Logs error.
@@ -269,7 +275,7 @@ class MqttClient : public nodelet::Nodelet,
269
275
270
276
protected:
271
277
/* *
272
- * Struct containing broker parameters
278
+ * @brief Struct containing broker parameters
273
279
*/
274
280
struct BrokerConfig {
275
281
std::string host; // /< broker host
@@ -284,7 +290,7 @@ class MqttClient : public nodelet::Nodelet,
284
290
};
285
291
286
292
/* *
287
- * Struct containing client parameters
293
+ * @brief Struct containing client parameters
288
294
*/
289
295
struct ClientConfig {
290
296
std::string id; // /< client unique ID
@@ -310,7 +316,7 @@ class MqttClient : public nodelet::Nodelet,
310
316
};
311
317
312
318
/* *
313
- * Struct containing variables related to a ROS2MQTT connection.
319
+ * @brief Struct containing variables related to a ROS2MQTT connection.
314
320
*/
315
321
struct Ros2MqttInterface {
316
322
struct {
@@ -326,7 +332,7 @@ class MqttClient : public nodelet::Nodelet,
326
332
};
327
333
328
334
/* *
329
- * Struct containing variables related to a MQTT2ROS connection.
335
+ * @brief Struct containing variables related to a MQTT2ROS connection.
330
336
*/
331
337
struct Mqtt2RosInterface {
332
338
struct {
@@ -344,66 +350,67 @@ class MqttClient : public nodelet::Nodelet,
344
350
345
351
protected:
346
352
/* *
347
- * MQTT topic prefix under which ROS message type information is published
353
+ * @brief MQTT topic prefix under which ROS message type information is
354
+ * published
348
355
*
349
356
* Must contain trailing '/'.
350
357
*/
351
358
static const std::string kRosMsgTypeMqttTopicPrefix ;
352
359
353
360
/* *
354
- * ROS topic prefix under which ROS2MQTT2ROS latencies are published
361
+ * @brief ROS topic prefix under which ROS2MQTT2ROS latencies are published
355
362
*
356
363
* Must contain trailing '/'.
357
364
*/
358
365
static const std::string kLatencyRosTopicPrefix ;
359
366
360
367
/* *
361
- * ROS node handle
368
+ * @brief ROS node handle
362
369
*/
363
370
ros::NodeHandle node_handle_;
364
371
365
372
/* *
366
- * Private ROS node handle
373
+ * @brief Private ROS node handle
367
374
*/
368
375
ros::NodeHandle private_node_handle_;
369
376
370
377
/* *
371
- * ROS Service server for providing connection status
378
+ * @brief ROS Service server for providing connection status
372
379
*/
373
380
ros::ServiceServer is_connected_service_;
374
381
375
382
/* *
376
- * Status variable keeping track of connection status to broker
383
+ * @brief Status variable keeping track of connection status to broker
377
384
*/
378
385
bool is_connected_ = false ;
379
386
380
387
/* *
381
- * Broker parameters
388
+ * @brief Broker parameters
382
389
*/
383
390
BrokerConfig broker_config_;
384
391
385
392
/* *
386
- * Client parameters
393
+ * @brief Client parameters
387
394
*/
388
395
ClientConfig client_config_;
389
396
390
397
/* *
391
- * MQTT client variable
398
+ * @brief MQTT client variable
392
399
*/
393
400
std::shared_ptr<mqtt::async_client> client_;
394
401
395
402
/* *
396
- * MQTT client connection options
403
+ * @brief MQTT client connection options
397
404
*/
398
405
mqtt::connect_options connect_options_;
399
406
400
407
/* *
401
- * ROS2MQTT connection variables sorted by ROS topic
408
+ * @brief ROS2MQTT connection variables sorted by ROS topic
402
409
*/
403
410
std::map<std::string, Ros2MqttInterface> ros2mqtt_;
404
411
405
412
/* *
406
- * MQTT2ROS connection variables sorted by MQTT topic
413
+ * @brief MQTT2ROS connection variables sorted by MQTT topic
407
414
*/
408
415
std::map<std::string, Mqtt2RosInterface> mqtt2ros_;
409
416
};
0 commit comments