Repository navigation
feat: add thread-safe release api for ending a grasp - #58
Merged
Merged
Conversation
grasp() with hold_s = 0 holds until a fault, which leaves no way to end the grip short of a disconnect. release() and request_release() close that gap, ported from the Python SDK so the two agree: - ReleaseCoordinator hands a request between threads without ever touching the bus: the grasp thread checks it before every frame and performs the opening, the caller waits for the published result. - The opening starts from the hand-over pose, not from where the set force pressed the jaws to, and runs on the same bounded ramp. - abort = true drops the torque and sends no opening move; it also overrides a normal release that is still queued. - With no grasp running, release() opens in the calling thread. Tests cover the cross-thread hold, a release during the approach, the abort form, the no-grasp form, the request queue rules, a timeout, and the argument checks. Both READMEs document the new API.
|
🎉 This PR is included in version 1.1.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
grasp(force_n, hold_s = 0)holds until a fault, so there was no way to end a grip from another thread short of a disconnect. This adds the release API the Python SDK already has, so both SDKs behave the same.release(clearance_mm = 10.0, abort = false, timeout_s = nullopt) -> ReleaseResultrequest_release(clearance_mm = 10.0, abort = false) -> bool(queue only, never sends a frame)GraspResult::released,ReleaseResult,MotionConfig::release_wait_sAlso two unrelated packaging fixes found while preparing the repo for publishing.
Changes
ReleaseCoordinator: cross-thread request/result hand-off. The mutex guards only its own fields and never the bus. The grasp thread checks for a request before every frame (5 ms); the caller waits on the condition variable and receives the published result.grasp()ends on a release request: during the force-carrying approach it aborts the leg before hand-over, during the hold it drops the setpoint, and both perform the opening. The hand-over pose and the pending request are read in one critical section so a request landing at the hand-over cannot be missed.max(current, hand-over pose) + clearance_mm, clamped to the calibrated open stop and run on the existing bounded ramp.abort = trueis the E-stop form: one zero-gain frame, no opening move. An abort overrides a normal release that is still queued (never the reverse).release()opens in the calling thread; a non-finitetimeout_sor a negative/non-finite clearance throwsCommandErrorbefore anything is sent.release(pos, source)todrop_torqueso it cannot be confused with the public API.hold_s = 0grip, release during the approach, abort form, no-grasp form, request-queue rules, timeout and negative timeout, argument validation.ReleaseResult,release_wait_s, an "Ending a grip" section, a troubleshooting row and the layers-table entry.package.xml: license was MIT whileLICENSEis Apache-2.0; the maintainer was aTODOplaceholder.test/generate_golden.py:SDK_ROOTpointed at a non-existent../litegrip_driver, so the regeneration command documented in the README could not run. It now prefers a siblinglitegrip-python/srccheckout and falls back to an installed package.Testing
test/generate_golden.pywas run against the current Python SDK; the regeneratedgolden_generated.hppis byte-identical (no diff).No hardware was used: every test runs against the fake plant.
Issues
None.