You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is part of an effort to contribute RoboStack downstream patches back upstream.
Origin: patch/ros-rolling-moveit-ros-robot-interaction.patch, authored by Daisuke Nishimatsu.
LockedRobotState currently uses std::shared_ptr::unique() to decide whether it can modify the stored state in place. That API was removed in C++20. Comparing use_count() with one preserves the existing copy-on-write behavior while keeping this code compatible with toolchains that build MoveIt with newer C++ standards.
Summary by CodeRabbit
Refactor
Updated how shared state ownership is checked when setting or modifying robot state; behavior remains unchanged.
This upstreams the C++20-compatible part of the RoboStack moveit_ros_robot_interaction build fix.
std::shared_ptr::unique() was removed in C++20. Comparing use_count() with one keeps the existing copy-on-write behavior while avoiding the removed API in toolchains that build MoveIt with newer C++ standards.
Origin: patch/ros-rolling-moveit-ros-robot-interaction.patch, authored by Daisuke Nishimatsu.
Signed-off-by: Tobias Fischer <[email protected]>
FYI @wep21 and @traversaro: I opened this while upstreaming RoboStack patches tracked in RoboStack/robostack#124. This one comes from patch/ros-rolling-moveit-ros-robot-interaction.patch.
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.95%. Comparing base (8c99e52) to head (534ebc3). ⚠️ Report is 1 commits behind head on main.
Reviewing files that changed from the base of the PR and between 2b24033 and 534ebc3.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
The ownership checks in LockedRobotState::setState and modifyState now use state_.use_count() instead of state_.unique(). The copy-on-write conditions remain unchanged.
setState checks whether state_ has one owner. modifyState checks whether it has more than one owner. Both checks now use use_count(). The copy-on-write conditions are unchanged.
This change replaces an API removed in C++20 with an equivalent ownership check. Copy-on-write behavior is unchanged, so merge risk is minimal.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "Use use_count in LockedRobotState" names the primary change. The PR replaces std::shared_ptr::unique() with a use_count() comparison in LockedRobotState::setState and modifyState, so the ti…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "Use use_count in LockedRobotState" names the primary change. The PR replaces std::shared_ptr::unique() with a use_count() comparison in LockedRobotState::setState and modifyState, so the title matches the changeset. It is short and specific. It does not state the reason (C++20 removal of unique()), but that detail is not required for a pass.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.
Queue this pull request once it meets the queue conditions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is part of an effort to contribute RoboStack downstream patches back upstream.
Origin:
patch/ros-rolling-moveit-ros-robot-interaction.patch, authored by Daisuke Nishimatsu.LockedRobotStatecurrently usesstd::shared_ptr::unique()to decide whether it can modify the stored state in place. That API was removed in C++20. Comparinguse_count()with one preserves the existing copy-on-write behavior while keeping this code compatible with toolchains that build MoveIt with newer C++ standards.Summary by CodeRabbit