Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tier4_autoware_utils): clang-tidy errors for published_time_publisher #6651

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
{
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 @@
// 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 @@
// 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
Loading