@@ -452,7 +452,7 @@ void MqttClient::loadParameters() {
452
452
ros2mqtt.ros .queue_size = queue_size_param.as_int ();
453
453
454
454
rclcpp::Parameter durability_param;
455
- if (get_parameter (fmt::format (" bridge.ros2mqtt.{}.advanced.ros.qos.durability" , mqtt_topic ), durability_param)) {
455
+ if (get_parameter (fmt::format (" bridge.ros2mqtt.{}.advanced.ros.qos.durability" , ros_topic ), durability_param)) {
456
456
const auto p = durability_param.as_string ();
457
457
if (p == " system_default" ) {
458
458
ros2mqtt.ros .qos .durability = rclcpp::DurabilityPolicy::SystemDefault;
@@ -469,7 +469,7 @@ void MqttClient::loadParameters() {
469
469
}
470
470
471
471
rclcpp::Parameter reliability_param;
472
- if (get_parameter (fmt::format (" bridge.ros2mqtt.{}.advanced.ros.qos.reliability" , mqtt_topic ), reliability_param)) {
472
+ if (get_parameter (fmt::format (" bridge.ros2mqtt.{}.advanced.ros.qos.reliability" , ros_topic ), reliability_param)) {
473
473
const auto p = reliability_param.as_string ();
474
474
if (p == " system_default" ) {
475
475
ros2mqtt.ros .qos .reliability = rclcpp::ReliabilityPolicy::SystemDefault;
@@ -778,8 +778,12 @@ void MqttClient::setupSubscriptions() {
778
778
if (ros2mqtt.ros .subscriber )
779
779
continue ;
780
780
781
+ auto const qos = rclcpp::QoS (ros2mqtt.ros .queue_size )
782
+ .reliability (*ros2mqtt.ros .qos .reliability )
783
+ .durability (*ros2mqtt.ros .qos .durability );
784
+
781
785
ros2mqtt.ros .subscriber = create_generic_subscription (
782
- ros_topic, ros2mqtt.ros .msg_type , ros2mqtt. ros . queue_size , bound_callback_func);
786
+ ros_topic, ros2mqtt.ros .msg_type , qos , bound_callback_func);
783
787
ros2mqtt.ros .is_stale = false ;
784
788
RCLCPP_INFO (get_logger (), " Subscribed ROS topic '%s' of type '%s'" ,
785
789
ros_topic.c_str (), ros2mqtt.ros .msg_type .c_str ());
0 commit comments