-
Notifications
You must be signed in to change notification settings - Fork 66
[RSDK-10924] Add IsHoldingSomething to Gripper API #935
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
Changes from 4 commits
4855be6
243baff
7673791
16df28d
7b9293e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,16 @@ | ||
| import abc | ||
| from dataclasses import dataclass | ||
| from typing import Any, Dict, Final, Optional, Tuple | ||
|
|
||
| from viam.components.component_base import ComponentBase | ||
| from viam.resource.types import API, RESOURCE_NAMESPACE_RDK, RESOURCE_TYPE_COMPONENT | ||
|
|
||
| from . import KinematicsFileFormat | ||
|
|
||
| @dataclass | ||
| class HoldingStatus: | ||
| is_holding_something: bool | ||
| meta: Optional[Dict[str, Any]] = None | ||
|
|
||
| class Gripper(ComponentBase): | ||
| """ | ||
|
|
@@ -73,6 +78,33 @@ async def grab( | |
| """ | ||
| ... | ||
|
|
||
| @abc.abstractmethod | ||
| async def is_holding_something( | ||
| self, | ||
| *, | ||
| extra: Optional[Dict[str, Any]] = None, | ||
| timeout: Optional[float] = None, | ||
| **kwargs, | ||
| ) -> HoldingStatus: | ||
| """ | ||
| Get information about whether the gripper is currently holding onto an object. | ||
|
|
||
| :: | ||
|
|
||
| my_gripper = Gripper.from_robot(robot=machine, name="my_gripper") | ||
|
|
||
| # Grab with the gripper. | ||
| holding_status = await my_gripper.is_holding_something() | ||
| # get the boolean result | ||
| is_holding_something = holding_status.is_holding_something | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (q) naively,
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll add a comment, but it's something eliot specifically asked for here: https://docs.google.com/document/d/1N1TRTOMww_4NUNDVbeeWg9raNpSK0Srb16kG4R2qYks/edit?disco=AAABlaa3cpE
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤷 okay fair enough! |
||
|
|
||
| Returns: | ||
| HoldingStatus: see documentation on `HoldingStatus` for more information | ||
|
|
||
| For more information, see `Gripper component <https://docs.viam.com/dev/reference/apis/components/gripper/#grab>`_. | ||
|
|
||
| """ | ||
|
|
||
| @abc.abstractmethod | ||
| async def stop( | ||
| self, | ||
|
|
||
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.
Can we move this inside of
Gripper? that way this class isGripper.HoldingStatus?I don't think this class makes sense outside the context of a gripper