# Control your gripper with the gripper API

The gripper API allows you to give commands to your [gripper components](https://docs.viam.com/reference/components/gripper/) for opening and closing a device.

The gripper component supports the following methods:

| Method Name | Description |
| --- | --- |
| [`Open`](https://docs.viam.com/reference/apis/components/gripper/#open) | Opens the gripper. |
| [`Grab`](https://docs.viam.com/reference/apis/components/gripper/#grab) | Closes the gripper until it grabs something or closes completely, and returns whether it grabbed something or not. |
| [`IsMoving`](https://docs.viam.com/reference/apis/components/gripper/#ismoving) | Returns whether the gripper is actively moving (or attempting to move) under its own power. |
| [`IsHoldingSomething`](https://docs.viam.com/reference/apis/components/gripper/#isholdingsomething) | Return if the gripper is holding something. |
| [`Stop`](https://docs.viam.com/reference/apis/components/gripper/#stop) | Stops the gripper. |
| [`GetGeometries`](https://docs.viam.com/reference/apis/components/gripper/#getgeometries) | Get all the geometries associated with the gripper in its current configuration, in the frame of the gripper. |
| [`GetCurrentInputs`](https://docs.viam.com/reference/apis/components/gripper/#getcurrentinputs) | Get the current joint input values of the gripper. |
| [`GoToInputs`](https://docs.viam.com/reference/apis/components/gripper/#gotoinputs) | Move the gripper to the specified joint input values. |
| [`Reconfigure`](https://docs.viam.com/reference/apis/components/gripper/#reconfigure) | Reconfigure this resource. |
| [`DoCommand`](https://docs.viam.com/reference/apis/components/gripper/#docommand) | Execute model-specific commands that are not otherwise defined by the component API. |
| [`GetKinematics`](https://docs.viam.com/reference/apis/components/gripper/#getkinematics) | Get the kinematics information associated with the gripper as the format and byte contents of the kinematics file. |
| [`GetResourceName`](https://docs.viam.com/reference/apis/components/gripper/#getresourcename) | Get the `ResourceName` for this gripper. |
| [`Close`](https://docs.viam.com/reference/apis/components/gripper/#close) | Safely shut down the resource and prevent further use. |

## API

### Open

Opens the gripper.

- [Python](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-1-0)
- [Go](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-1-1)
- [TypeScript](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-1-2)
- [Flutter](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-1-3)

**Parameters:**

- `extra` (Mapping[ [str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str), Any]) (optional): Extra options to pass to the underlying RPC call.
- `timeout` ( [float](https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex)) (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:**

```python

```

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/components/gripper/client/index.html#viam.components.gripper.client.GripperClient.open).

### Grab

Closes the gripper until it grabs something or closes completely, and returns whether it grabbed something or not.

- [Python](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-2-0)
- [Go](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-2-1)
- [TypeScript](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-2-2)
- [Flutter](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-2-3)

**Parameters:**

**Returns:**

- ( [bool](https://docs.python.org/3/library/stdtypes.html#boolean-type-bool)): : Indicates if the gripper grabbed something.

**Example:**

```python

```

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/components/gripper/client/index.html#viam.components.gripper.client.GripperClient.grab).

### IsMoving

Returns whether the gripper is actively moving (or attempting to move) under its own power.

- [Python](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-3-0)
- [Go](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-3-1)
- [TypeScript](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-3-2)
- [Flutter](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-3-3)

**Parameters:**

- `timeout` ( [float](https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex)) (optional): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.

**Returns:**

- ( [bool](https://docs.python.org/3/library/stdtypes.html#boolean-type-bool)): : Whether the gripper is moving.

### IsHoldingSomething

Return if the gripper is holding something.

- [Python](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-4-0)
- [Go](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-4-1)
- [Flutter](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-4-2)

**Parameters:**

**Returns:**

- ( [viam.components.gripper.gripper.Gripper.HoldingStatus](https://python.viam.dev/autoapi/viam/components/gripper/gripper/index.html#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`.

- [Python](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-5-0)
- [Go](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-5-1)
- [TypeScript](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-5-2)
- [Flutter](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-5-3)

**Parameters:**

**Returns:**

- None.

### GetGeometries

Get all the geometries associated with the gripper in its current configuration, in the [frame](https://docs.viam.com/reference/services/frame-system/) of the gripper.
The [motion](https://docs.viam.com/reference/services/motion/) and [navigation](https://docs.viam.com/reference/services/navigation/) services use the relative position of inherent geometries to configured geometries representing obstacles for collision detection and obstacle avoidance while motion planning.

- [Python](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-6-0)
- [Go](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-6-1)
- [TypeScript](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-6-2)

**Parameters:**

**Returns:**

- ( [List[viam.proto.common.Geometry]](https://python.viam.dev/autoapi/viam/proto/common/index.html#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.

- [Python](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-7-0)
- [Go](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-7-1)
- [TypeScript](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-7-2)

**Parameters:**

**Returns:**

- ( [List[float]](https://docs.python.org/3/library/stdtypes.html#list)): 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.

- [Python](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-8-0)
- [Go](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-8-1)
- [TypeScript](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-8-2)

**Parameters:**

- `values` ( [List[float]](https://docs.python.org/3/library/stdtypes.html#list)) (required): The input values to move the gripper to.
- `extra` (Mapping[ [str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str), Any]) (optional): Extra options to pass to the underlying RPC call.
- `timeout` ( [float](https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex)) (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.

- [Go](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-9-0)

**Parameters:**

- `ctx` [(Context)](https://pkg.go.dev/context#Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.
- `deps` [(Dependencies)](https://pkg.go.dev/go.viam.com/rdk/resource#Dependencies): The resource dependencies.
- `conf` [(Config)](https://pkg.go.dev/go.viam.com/rdk/resource#Config): The resource configuration.

**Returns:**

- [(error)](https://pkg.go.dev/builtin#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`](https://docs.viam.com/reference/sdks/docommand/).

- [Python](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-10-0)
- [Go](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-10-1)
- [TypeScript](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-10-2)
- [Flutter](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-10-3)

**Parameters:**

- `command` (Mapping[ [str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str), ValueTypes]) (required): The command to execute.
- `timeout` ( [float](https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex)) (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](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-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](https://docs.viam.com/motion-planning/frame-system/overview/).

- [Python](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-11-0)
- [Go](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-11-1)
- [Flutter](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-11-2)

**Parameters:**

**Returns:**

- ( [viam.components.KinematicsReturn](https://python.viam.dev/autoapi/viam/components/index.html#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.

- [Python](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-12-0)
- [Go](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-12-1)
- [TypeScript](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-12-2)
- [Flutter](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-12-3)

**Parameters:**

- `name` ( [str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)) (required): The name of the Resource.

**Returns:**

- ( [viam.proto.common.ResourceName](https://python.viam.dev/autoapi/viam/proto/common/index.html#viam.proto.common.ResourceName)): : The ResourceName of this Resource.

### Close

Safely shut down the resource and prevent further use.

- [Python](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-13-0)
- [Go](https://docs.viam.com/reference/apis/components/gripper/#tabset-referenceapiscomponentsgripper-13-1)

**Parameters:**

- None.

**Returns:**

- None.
