-
Notifications
You must be signed in to change notification settings - Fork 392
Implement realtime-safe stall detection for parallel gripper controller #1855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Implement realtime-safe stall detection for parallel gripper controller #1855
Conversation
Convert last_movement_time_ from direct rclcpp::Time to RealtimeThreadSafeBox to ensure thread-safe communication between realtime and non-realtime contexts. Changes: - Replace rclcpp::Time last_movement_time_ with RealtimeThreadSafeBox<rclcpp::Time> - Initialize RealtimeThreadSafeBox in on_activate() method Fixes potential realtime violations in gripper stall timeout mechanism.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this, some comments below
...r_controller/include/parallel_gripper_controller/parallel_gripper_action_controller_impl.hpp
Outdated
Show resolved
Hide resolved
...r_controller/include/parallel_gripper_controller/parallel_gripper_action_controller_impl.hpp
Outdated
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1855 +/- ##
==========================================
- Coverage 85.98% 85.97% -0.02%
==========================================
Files 129 129
Lines 13112 13116 +4
Branches 1144 1144
==========================================
+ Hits 11275 11276 +1
- Misses 1469 1472 +3
Partials 368 368
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
...r_controller/include/parallel_gripper_controller/parallel_gripper_action_controller_impl.hpp
Show resolved
Hide resolved
...r_controller/include/parallel_gripper_controller/parallel_gripper_action_controller_impl.hpp
Show resolved
Hide resolved
Replace blocking set() with non-blocking try_set() for last_movement_time_ initialization in on_activate() method, as this lifecycle callback can be executed from the realtime thread in some ROS2 control implementations.
Use try_get/try_set for rt_active_goal_ operations in check_for_success() since this method runs in the realtime control loop. Prevents potential blocking during goal completion and stall detection.
...r_controller/include/parallel_gripper_controller/parallel_gripper_action_controller_impl.hpp
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest looks good to me
@@ -378,6 +385,8 @@ controller_interface::CallbackReturn GripperActionController::on_activate( | |||
pre_alloc_result_->reached_goal = false; | |||
pre_alloc_result_->stalled = false; | |||
|
|||
last_movement_time_.try_set(rclcpp::Time(0, 0, RCL_ROS_TIME)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last_movement_time_.try_set(rclcpp::Time(0, 0, RCL_ROS_TIME)); | |
last_movement_time_.try_set(rclcpp::Time(0, 0, RCL_CLOCK_UNINITIALIZED)); |
Sorry, it's just this one. Initializing with ROS time is still a valid time, better set an invalid type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@saikishor Of course! No worries. I'll commit this suggestion real quick.
May I ask what’s the main reason for this change? You don’t want the time to be valid in on_activate()
? It doesn’t really matter here since in accepted_callback()
we set it with last_movement_time_.set(get_node()->now());
.
Convert last_movement_time_ from direct rclcpp::Time to RealtimeThreadSafeBox to ensure thread-safe communication between realtime and non-realtime contexts.
Changes:
Fixes potential realtime violations in gripper stall timeout mechanism.
closes #1853