Skip to content

Commit

Permalink
fix(tier4_autoware_utils): clang-tidy errors for published_time_publi…
Browse files Browse the repository at this point in the history
…sher.hpp

Signed-off-by: M. Fatih Cırıt <[email protected]>
  • Loading branch information
M. Fatih Cırıt committed Mar 18, 2024
1 parent 413514b commit d90b377
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <functional>
#include <map>
#include <string>
#include <utility>

namespace tier4_autoware_utils
{
Expand All @@ -32,9 +33,9 @@ class PublishedTimePublisher
{
public:
explicit PublishedTimePublisher(
rclcpp::Node * node, const std::string & publisher_topic_suffix = "/debug/published_time",
rclcpp::Node * node, std::string publisher_topic_suffix = "/debug/published_time",
const rclcpp::QoS & qos = rclcpp::QoS(1))
: node_(node), publisher_topic_suffix_(publisher_topic_suffix), qos_(qos)
: node_(node), publisher_topic_suffix_(std::move(publisher_topic_suffix)), qos_(qos)
{
}

Expand All @@ -46,16 +47,16 @@ class PublishedTimePublisher
// if the publisher is not in the map, create a new publisher for published time
ensure_publisher_exists(gid_key, publisher->get_topic_name());

const auto & pub_published_time_ = publishers_[gid_key];
const auto & pub_published_time = publishers_[gid_key];

// Check if there are any subscribers, otherwise don't do anything
if (pub_published_time_->get_subscription_count() > 0) {
if (pub_published_time->get_subscription_count() > 0) {
PublishedTime published_time;

published_time.header.stamp = stamp;
published_time.published_stamp = rclcpp::Clock().now();

pub_published_time_->publish(published_time);
pub_published_time->publish(published_time);
}
}

Expand All @@ -67,16 +68,16 @@ class PublishedTimePublisher
// if the publisher is not in the map, create a new publisher for published time
ensure_publisher_exists(gid_key, publisher->get_topic_name());

const auto & pub_published_time_ = publishers_[gid_key];
const auto & pub_published_time = publishers_[gid_key];

// Check if there are any subscribers, otherwise don't do anything
if (pub_published_time_->get_subscription_count() > 0) {
if (pub_published_time->get_subscription_count() > 0) {
PublishedTime published_time;

published_time.header = header;
published_time.published_stamp = rclcpp::Clock().now();

pub_published_time_->publish(published_time);
pub_published_time->publish(published_time);
}
}

Expand Down

0 comments on commit d90b377

Please sign in to comment.