Skip to content

Commit 1e28666

Browse files
brkay54xmfcx
authored andcommitted
feat: change function name publish() -> publish_if_subscribed()
Signed-off-by: Berkay Karaman <brkay54@gmail.com>
1 parent 0b0d2d7 commit 1e28666

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

common/tier4_autoware_utils/test/src/ros/test_published_time_publisher.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ TEST_F(PublishedTimePublisherTest, PublishMsgWithHeader)
9191
std_msgs::msg::Header header;
9292
header.stamp = rclcpp::Time(1234);
9393

94-
// Use Published Time Publisher .publish() with a header
95-
published_time_publisher_->publish(first_test_publisher_, header);
94+
// Use Published Time Publisher .publish_if_subscribed() with a header
95+
published_time_publisher_->publish_if_subscribed(first_test_publisher_, header);
9696
rclcpp::spin_some(node_);
9797

9898
// Check if the published_time_ is created
@@ -110,8 +110,8 @@ TEST_F(PublishedTimePublisherTest, PublishMsgWithTimestamp)
110110
std_msgs::msg::Header header;
111111
header.stamp = rclcpp::Time(4321);
112112

113-
// Use Published Time Publisher .publish() with a timestamp
114-
published_time_publisher_->publish(first_test_publisher_, header.stamp);
113+
// Use Published Time Publisher .publish_if_subscribed() with a timestamp
114+
published_time_publisher_->publish_if_subscribed(first_test_publisher_, header.stamp);
115115
rclcpp::spin_some(node_);
116116

117117
// Check if the published_time_ is created
@@ -129,9 +129,9 @@ TEST_F(PublishedTimePublisherTest, MultiplePublishMsgWithHeader)
129129
std_msgs::msg::Header header;
130130
header.stamp = rclcpp::Time(12345);
131131

132-
// Use Published Time Publisher .publish() with a header for multiple publishers
133-
published_time_publisher_->publish(first_test_publisher_, header);
134-
published_time_publisher_->publish(second_test_publisher_, header);
132+
// Use Published Time Publisher .publish_if_subscribed() with a header for multiple publishers
133+
published_time_publisher_->publish_if_subscribed(first_test_publisher_, header);
134+
published_time_publisher_->publish_if_subscribed(second_test_publisher_, header);
135135
rclcpp::spin_some(node_);
136136

137137
// Check if the published_time_ is created
@@ -151,9 +151,9 @@ TEST_F(PublishedTimePublisherTest, MultiplePublishMsgWithTimestamp)
151151
std_msgs::msg::Header header;
152152
header.stamp = rclcpp::Time(12345);
153153

154-
// Use Published Time Publisher .publish() with a timestamp for multiple publishers
155-
published_time_publisher_->publish(first_test_publisher_, header.stamp);
156-
published_time_publisher_->publish(second_test_publisher_, header.stamp);
154+
// Use Published Time Publisher .publish_if_subscribed() with a timestamp for multiple publishers
155+
published_time_publisher_->publish_if_subscribed(first_test_publisher_, header.stamp);
156+
published_time_publisher_->publish_if_subscribed(second_test_publisher_, header.stamp);
157157
rclcpp::spin_some(node_);
158158

159159
// Check if the published_time_ is created

0 commit comments

Comments
 (0)