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 authored and xmfcx committed Mar 18, 2024
1 parent bd568e8 commit 52e6515
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)

Check warning on line 38 in common/tier4_autoware_utils/include/tier4_autoware_utils/ros/published_time_publisher.hpp

View check run for this annotation

Codecov / codecov/patch

common/tier4_autoware_utils/include/tier4_autoware_utils/ros/published_time_publisher.hpp#L38

Added line #L38 was not covered by tests
{
}

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 warning on line 50 in common/tier4_autoware_utils/include/tier4_autoware_utils/ros/published_time_publisher.hpp

View check run for this annotation

Codecov / codecov/patch

common/tier4_autoware_utils/include/tier4_autoware_utils/ros/published_time_publisher.hpp#L50

Added line #L50 was not covered by tests

// 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) {

Check warning on line 53 in common/tier4_autoware_utils/include/tier4_autoware_utils/ros/published_time_publisher.hpp

View check run for this annotation

Codecov / codecov/patch

common/tier4_autoware_utils/include/tier4_autoware_utils/ros/published_time_publisher.hpp#L53

Added line #L53 was not covered by tests
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);

Check warning on line 59 in common/tier4_autoware_utils/include/tier4_autoware_utils/ros/published_time_publisher.hpp

View check run for this annotation

Codecov / codecov/patch

common/tier4_autoware_utils/include/tier4_autoware_utils/ros/published_time_publisher.hpp#L59

Added line #L59 was not covered by tests
}
}

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 warning on line 71 in common/tier4_autoware_utils/include/tier4_autoware_utils/ros/published_time_publisher.hpp

View check run for this annotation

Codecov / codecov/patch

common/tier4_autoware_utils/include/tier4_autoware_utils/ros/published_time_publisher.hpp#L71

Added line #L71 was not covered by tests

// 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) {

Check warning on line 74 in common/tier4_autoware_utils/include/tier4_autoware_utils/ros/published_time_publisher.hpp

View check run for this annotation

Codecov / codecov/patch

common/tier4_autoware_utils/include/tier4_autoware_utils/ros/published_time_publisher.hpp#L74

Added line #L74 was not covered by tests
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);

Check warning on line 80 in common/tier4_autoware_utils/include/tier4_autoware_utils/ros/published_time_publisher.hpp

View check run for this annotation

Codecov / codecov/patch

common/tier4_autoware_utils/include/tier4_autoware_utils/ros/published_time_publisher.hpp#L80

Added line #L80 was not covered by tests
}
}

Expand Down

0 comments on commit 52e6515

Please sign in to comment.