Skip to content

Commit 4aa94f1

Browse files
committed
code review fixes.
1 parent 27de0cd commit 4aa94f1

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ client:
258258
259259
#### Bridge Parameters
260260
261-
##### ROS1
261+
##### ROS 1
262262
263263
```yaml
264264
bridge:
@@ -285,7 +285,7 @@ bridge:
285285
latched: # [false] whether to latch ROS message
286286
```
287287
288-
##### ROS2
288+
##### ROS 2
289289
290290
```yaml
291291
bridge:

mqtt_client/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ if(${ROS_VERSION} EQUAL 2)
1515

1616
find_package(ament_cmake REQUIRED)
1717

18+
find_package(fmt REQUIRED)
1819
find_package(mqtt_client_interfaces REQUIRED)
1920
find_package(rclcpp REQUIRED)
2021
find_package(std_msgs REQUIRED)
21-
find_package(fmt REQUIRED)
2222

2323
# Paho MQTT C++ apt package doesn't include CMake config
2424
# find_package(PahoMqttCpp REQUIRED)
@@ -37,10 +37,10 @@ if(${ROS_VERSION} EQUAL 2)
3737
)
3838

3939
ament_target_dependencies(${PROJECT_NAME}
40+
fmt
4041
mqtt_client_interfaces
4142
rclcpp
4243
std_msgs
43-
fmt
4444
)
4545

4646
install(TARGETS

mqtt_client/include/mqtt_client/MqttClient.ros2.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ SOFTWARE.
3131
#include <map>
3232
#include <memory>
3333
#include <string>
34+
3435
#define FMT_HEADER_ONLY
3536
#include <fmt/format.h>
36-
37-
#include <mqtt/async_client.h>
3837
#include <mqtt_client_interfaces/srv/is_connected.hpp>
38+
#include <mqtt/async_client.h>
3939
#include <rclcpp/rclcpp.hpp>
4040
#include <rclcpp/serialization.hpp>
4141
#include <std_msgs/msg/float64.hpp>

mqtt_client/src/MqttClient.ros2.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ void MqttClient::loadParameters() {
210210
}
211211

212212
param_desc.description = "The list of topics to bridge from MQTT to ROS";
213-
auto mqtt2ros_topic_names = declare_parameter<std::vector<std::string>>("bridge.mqtt2ros.topics", std::vector<std::string>(), param_desc);
214-
for (auto topic_name : mqtt2ros_topic_names)
213+
const auto mqtt2ros_topic_names = declare_parameter<std::vector<std::string>>("bridge.mqtt2ros.topics", std::vector<std::string>(), param_desc);
214+
for (const auto topic_name : mqtt2ros_topic_names)
215215
{
216216
param_desc.description = "MQTT topic on which messages are received from the broker";
217217
declare_parameter(fmt::format("bridge.mqtt2ros.{}.mqtt_topic", topic_name), rclcpp::ParameterType::PARAMETER_STRING, param_desc);
@@ -278,6 +278,7 @@ void MqttClient::loadParameters() {
278278

279279
// ros2mqtt
280280
for (const auto& topic_name : ros2mqtt_topic_names) {
281+
281282
rclcpp::Parameter ros_topic_param, mqtt_topic_param;
282283
if (get_parameter(fmt::format("bridge.ros2mqtt.{}.ros_topic", topic_name), ros_topic_param) &&
283284
get_parameter(fmt::format("bridge.ros2mqtt.{}.mqtt_topic", topic_name), mqtt_topic_param)) {

0 commit comments

Comments
 (0)