ros-controls / realtime_tools

Contains a set of tools that can be used from a hard realtime thread, without breaking the realtime behavior.
https://control.ros.org
BSD 3-Clause "New" or "Revised" License
140 stars 76 forks source link

First step towards modernizing the rt publisher #210

Open firesurfer opened 3 days ago

firesurfer commented 3 days ago

I think the rt publisher is one of the most commonly used tools in this package. When ever I was using it I stumbled upon its "weird" API.

This PR is a first step towards modernizing the RealtimePublisher class, providing a tiny bit of comfort by adding a tryPublish method and providing some typedefs similar to the rclcpp::Publisher.

I plan to add a follow up PR where I refactor the NON_POLLING define into a template parameter.

codecov-commenter commented 3 days ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 72.79%. Comparing base (3ee84c5) to head (4637c73).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #210 +/- ## ========================================== + Coverage 72.72% 72.79% +0.06% ========================================== Files 7 7 Lines 429 430 +1 Branches 71 71 ========================================== + Hits 312 313 +1 Misses 73 73 Partials 44 44 ``` | [Flag](https://app.codecov.io/gh/ros-controls/realtime_tools/pull/210/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ros-controls) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/ros-controls/realtime_tools/pull/210/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ros-controls) | `72.79% <100.00%> (+0.06%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ros-controls#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files with missing lines](https://app.codecov.io/gh/ros-controls/realtime_tools/pull/210?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ros-controls) | Coverage Δ | | |---|---|---| | [include/realtime\_tools/realtime\_publisher.hpp](https://app.codecov.io/gh/ros-controls/realtime_tools/pull/210?src=pr&el=tree&filepath=include%2Frealtime_tools%2Frealtime_publisher.hpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ros-controls#diff-aW5jbHVkZS9yZWFsdGltZV90b29scy9yZWFsdGltZV9wdWJsaXNoZXIuaHBw) | `95.91% <100.00%> (+0.08%)` | :arrow_up: |