Skip to content

Fix halt safety: accumulate errors across all joints - #2468

Open
Functionhx wants to merge 2 commits into
ros-controls:masterfrom
Functionhx:fix/halt-safety
Open

Fix halt safety: accumulate errors across all joints#2468
Functionhx wants to merge 2 commits into
ros-controls:masterfrom
Functionhx:fix/halt-safety

Conversation

@Functionhx

Copy link
Copy Markdown

Fixes #2325.

…trols#2326)

PR ros-controls#2326 introduced two regressions in the halt safety fix:

1. mecanum_drive_controller: Using || (logical OR) with blocking set_value
   causes short-circuit evaluation -- if the first wheel's set_value returns
   true (which it will with blocking), the remaining 3 wheels are never
   halted. Fixed by using &= (bitwise AND assignment) which evaluates all
   operands without short-circuit, ensuring all 4 wheels receive the halt
   command.

2. omni_wheel_drive_controller: Changed &= to |= with initial true value.
   Since true | anything = true, error detection was silently broken.
   Restored &= semantics which correctly tracks all-succeed.

3. All three files: Changed std::numeric_limits<unsigned int>::max() to -1
   per maintainer review feedback.

Test Plan:
- Reviewed the logic of all three halt() code paths
- Verified no remaining std::numeric_limits<unsigned int>::max() in set_value calls
- mecanum: all 4 set_value calls execute (no short-circuit), error tracked via &=
- omni: loop ensures all calls execute, error tracked via &=
- steering: unchanged loop structure, only changed max_tries parameter

Signed-off-by: Yuchen Fan <functionhx@gmail.com>

@christophfroehlich christophfroehlich left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This PR has zero diff?

@Functionhx

Copy link
Copy Markdown
Author

Apologies for the empty commit — the patch failed to apply during push. Fix is up now.

Revert -1 back to std::numeric_limits<unsigned int>::max() per maintainer
feedback: both are functionally identical but the latter is the project's
preferred style.

Fix steering_controllers_library halt to use accumulate-and-report pattern
instead of early-return on first failure, matching mecanum and omni fixes.

Signed-off-by: Yuchen Fan <functionhx@gmail.com>
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.

Safety concern with halt in mobile robot controllers

2 participants