Skip to content

Commit 8bd1184

Browse files
committed
add parameter for primitive mqtt2ros
1 parent b7aa23f commit 8bd1184

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ bridge:
188188
mqtt2ros: # array specifying which MQTT topics to map to which ROS topics
189189
- mqtt_topic: # MQTT topic on which messages are received from the broker
190190
ros_topic: # ROS topic on which corresponding MQTT messages are published
191+
primitive: # [false] whether to publish as primitive message (if coming from non-ROS MQTT client)
191192
advanced:
192193
mqtt:
193194
qos: # [0] MQTT QoS value

include/mqtt_client/MqttClient.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,8 @@ class MqttClient : public nodelet::Nodelet,
346346
int queue_size = 1; ///< ROS publisher queue size
347347
bool latched = false; ///< whether to latch ROS message
348348
} ros; ///< ROS-related variables
349+
bool primitive = false; ///< whether to publish as primitive message (if
350+
///< coming from non-ROS MQTT client)
349351
};
350352

351353
protected:

src/MqttClient.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ void MqttClient::loadParameters() {
181181
Mqtt2RosInterface& mqtt2ros = mqtt2ros_[mqtt_topic];
182182
mqtt2ros.ros.topic = std::string(mqtt2ros_params[k]["ros_topic"]);
183183

184+
// mqtt2ros[k]/primitive
185+
if (mqtt2ros_params[k].hasMember("primitive"))
186+
mqtt2ros.primitive = mqtt2ros_params[k]["primitive"];
187+
184188
// mqtt2ros[k]/advanced
185189
if (mqtt2ros_params[k].hasMember("advanced")) {
186190
XmlRpc::XmlRpcValue& advanced_params =

0 commit comments

Comments
 (0)