Control your gripper with the gripper API | Component APIs
Control your gripper with the gripper API
The gripper API allows you to give commands to your gripper components for opening and closing a device.
The gripper component supports the following methods:
| Method Name | Description |
|---|---|
Open |
Opens the gripper. |
Grab |
Closes the gripper until it grabs something or closes completely, and returns whether it grabbed something or not. |
IsMoving |
Returns whether the gripper is actively moving (or attempting to move) under its own power. |
IsHoldingSomething |
Return if the gripper is holding something. |
Stop |
Stops the gripper. |
GetGeometries |
Get all the geometries associated with the gripper in its current configuration, in the frame of the gripper. |
GetCurrentInputs |
Get the current joint input values of the gripper. |
GoToInputs |
Move the gripper to the specified joint input values. |
Reconfigure |
Reconfigure this resource. |
DoCommand |
Execute model-specific commands that are not otherwise defined by the component API. |
GetKinematics |
Get the kinematics information associated with the gripper as the format and byte contents of the kinematics file. |
GetResourceName |
Get the ResourceName for this gripper. |
Close |
Safely shut down the resource and prevent further use. |
API
Open
Opens the gripper.
Parameters:
extra(Mapping[ str, Any]) (optional): Extra options to pass to the underlying RPC call.timeout( float) (optional): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.
Returns:
- None.
Example:
For more information, see the Python SDK Docs.
Grab
Closes the gripper until it grabs something or closes completely, and returns whether it grabbed something or not.
Parameters:
Returns:
- ( bool): : Indicates if the gripper grabbed something.
Example:
For more information, see the Python SDK Docs.
IsMoving
Returns whether the gripper is actively moving (or attempting to move) under its own power.
Parameters:
timeout( float) (optional): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.
Returns:
- ( bool): : Whether the gripper is moving.
IsHoldingSomething
Return if the gripper is holding something.
Parameters:
Returns:
- ( viam.components.gripper.gripper.Gripper.HoldingStatus): : see documentation on HoldingStatus for more information.
Stop
Stops the gripper.
It is assumed that the gripper stops immediately, so IsMoving will return false after calling Stop.
Parameters:
Returns:
- None.
GetGeometries
Get all the geometries associated with the gripper in its current configuration, in the frame of the gripper. The motion and navigation services use the relative position of inherent geometries to configured geometries representing obstacles for collision detection and obstacle avoidance while motion planning.
Parameters:
Returns:
- ( List[viam.proto.common.Geometry]): : The geometries associated with the Component.
GetCurrentInputs
Get the current joint input values of the gripper.
This method is part of the frame system’s InputEnabled interface and is relevant for grippers with non-zero degrees of freedom that participate in motion planning.
Parameters:
Returns:
- ( List[float]): The current input values of the gripper.
GoToInputs
Move the gripper to the specified joint input values.
This method is part of the frame system’s InputEnabled interface and is relevant for grippers with non-zero degrees of freedom that participate in motion planning.
Parameters:
values( List[float]) (required): The input values to move the gripper to.extra(Mapping[ str, Any]) (optional): Extra options to pass to the underlying RPC call.timeout( float) (optional): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.
Returns:
- None.
Reconfigure
Reconfigure this resource. Reconfigure must reconfigure the resource atomically and in place.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.deps(Dependencies): The resource dependencies.conf(Config): The resource configuration.
Returns:
- (error): An error, if one occurred.
DoCommand
Execute model-specific commands that are not otherwise defined by the component API.
Most models do not implement DoCommand.
Any available model-specific commands should be covered in the model’s documentation.
If you are implementing your own gripper and want to add features that have no corresponding built-in API method, you can implement them with DoCommand.
Parameters:
command(Mapping[ str, ValueTypes]) (required): The command to execute.timeout( float) (optional): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.
Returns:
- (Mapping[ str, viam.utils.ValueTypes]): : Result of the executed command.
GetKinematics
Get the kinematics information associated with the gripper as the format and byte contents of the kinematics file.
Parameters:
Returns:
- ( viam.components.KinematicsReturn): : A tuple containing two values; the first [0] value represents the format of the file, either in URDF format (
KinematicsFileFormat.KINEMATICS_FILE_FORMAT_URDF) or Viam’s kinematic parameter format (spatial vector algebra) (KinematicsFileFormat.KINEMATICS_FILE_FORMAT_SVA), and the second [1] value represents the byte contents of the file.
GetResourceName
Get the ResourceName for this gripper.
Parameters:
name( str) (required): The name of the Resource.
Returns:
- ( viam.proto.common.ResourceName): : The ResourceName of this Resource.
Close
Safely shut down the resource and prevent further use.
Parameters:
- None.
Returns:
- None.