Skip to content

Commit 3af19c9

Browse files
authored
Initialize message correctly (#522)
Signed-off-by: Ivan Santiago Paunovic <[email protected]>
1 parent a437435 commit 3af19c9

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

quality_of_service_demo/rclcpp/src/message_lost_talker.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,11 @@ class MessageLostTalker : public rclcpp::Node
8282
message_size_ *= 1024uL;
8383
}
8484
}
85+
msg_.data = std::vector<uint8_t>(message_size_, 0u);
8586
// Timer callback
8687
auto publish_message =
8788
[this]() -> void
8889
{
89-
for (size_t i = 0; i < message_size_; ++i) {
90-
msg_.data.push_back(0);
91-
}
9290
rclcpp::Time now = this->get_clock()->now();
9391
msg_.header.stamp = now;
9492
RCLCPP_INFO(

0 commit comments

Comments
 (0)