Skip to content

Conversation

@mamueluth
Copy link
Member

This PR aims at creating the publisher inside the RealtimePublisher simplifying the creation of RealtimePublisher.

I chose to just add another constructor where you can pass the node and topic as well as qos on which we want to publish. I left the old constructor to give the user the flexibility to create or pass their own publisher if they want to.

If this approach is thought to simple let me know and i can change the implementation in a more desired direction.

@codecov-commenter
Copy link

codecov-commenter commented Dec 3, 2025

Codecov Report

❌ Patch coverage is 86.66667% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.23%. Comparing base (534bfab) to head (fc1f537).

Files with missing lines Patch % Lines
realtime_tools/test/realtime_publisher_tests.cpp 86.84% 2 Missing and 3 partials ⚠️
...ools/include/realtime_tools/realtime_publisher.hpp 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #469      +/-   ##
==========================================
- Coverage   85.33%   85.23%   -0.10%     
==========================================
  Files          17       17              
  Lines        1398     1443      +45     
  Branches      132      137       +5     
==========================================
+ Hits         1193     1230      +37     
- Misses        119      122       +3     
- Partials       86       91       +5     
Flag Coverage Δ
unittests 85.23% <86.66%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ools/include/realtime_tools/realtime_publisher.hpp 89.58% <85.71%> (-0.67%) ⬇️
realtime_tools/test/realtime_publisher_tests.cpp 89.39% <86.84%> (-3.47%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mamueluth mamueluth force-pushed the realtime_tools/publisher_in_rt_publisher branch from a3bd565 to fc1f537 Compare December 3, 2025 13:43
@christophfroehlich christophfroehlich linked an issue Dec 3, 2025 that may be closed by this pull request
Copy link
Member

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you installed pre-commit? ;)

What would be a usecase for still passing a publisher to the constructor, and not deprecating the old API?

}
}

explicit RealtimePublisher(std::shared_ptr<rclcpp::Node> node, const std::string & topic_name,
Copy link
Member

@saikishor saikishor Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
explicit RealtimePublisher(std::shared_ptr<rclcpp::Node> node, const std::string & topic_name,
template <typename NodeT>
explicit RealtimePublisher(NodeT node, const std::string & topic_name,

Comment on lines +94 to +96
publisher_= node->create_publisher<MessageT>(
topic_name,
qos);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about a variadic template to parse these arguments directly. It would be cool?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

realtime_tools API restructure

4 participants