> ## Documentation Index
> Fetch the complete documentation index at: https://docs.generalrobotics.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# RobotiqGripper

## RobotiqGripper

Inherits from: `object`

Communicates with the gripper directly, via socket with string commands, leveraging string names for variables.

Attributes:
ACT (str): Activate (1 while activated, can be reset to clear fault status)
GTO (str): Go to (will perform go to with the actions set in pos, for, spe)
ATR (str): Auto-release (emergency slow move)
ADR (str): Auto-release direction (open(1) or close(0) during auto-release)
FOR (str): Force (0-255)
SPE (str): Speed (0-255)
POS (str): Position (0-255), 0 = open
STA (str): Status (0 = is reset, 1 = activating, 3 = active)
PRE (str): Position request (echo of last commanded position)
OBJ (str): Object detection (0 = moving, 1 = outer grip, 2 = inner grip, 3 = no object at rest)
FLT (str): Fault (0=ok, see manual for errors if not zero)

### **init**

```python theme={null}
RobotiqGripper.__init__()
```

Initialize a new RobotiqGripper instance.

### connect

```python theme={null}
RobotiqGripper.connect(hostname: str, port: int, socket_timeout: float = 2.0) -> None
```

Connect to a gripper at the given address.

<ResponseField name="Arguments">
  <ParamField query="hostname (str)" type="str" required>
    Hostname or ip.
  </ParamField>

  <ParamField query="port (int)" type="int" required>
    Port.
  </ParamField>

  <ParamField query="socket_timeout (float)" type="float">
    Timeout for blocking socket operations.
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="None" />
</ResponseField>

### disconnect

```python theme={null}
RobotiqGripper.disconnect() -> None
```

Close the connection with the gripper.

<ResponseField name="Returns">
  <ResponseField name="returns" type="None" />
</ResponseField>

### activate

```python theme={null}
RobotiqGripper.activate(auto_calibrate: bool = True)
```

Reset activation flag and reactivate gripper, clearing previous fault flags.

<ResponseField name="Arguments">
  <ParamField query="auto_calibrate (bool)" type="bool">
    Whether to calibrate the minimum and maximum positions based on actual motion.
  </ParamField>
</ResponseField>

### is\_active

```python theme={null}
RobotiqGripper.is_active()
```

Check if the gripper is active.

<ResponseField name="Returns">
  <ResponseField name="bool" type="">
    True if gripper is active.
  </ResponseField>
</ResponseField>

### get\_min\_position

```python theme={null}
RobotiqGripper.get_min_position() -> int
```

Get the minimum position the gripper can reach (open position).

<ResponseField name="Returns">
  <ResponseField name="int" type="int">
    Minimum position value.
  </ResponseField>
</ResponseField>

### get\_max\_position

```python theme={null}
RobotiqGripper.get_max_position() -> int
```

Get the maximum position the gripper can reach (closed position).

<ResponseField name="Returns">
  <ResponseField name="int" type="int">
    Maximum position value.
  </ResponseField>
</ResponseField>

### get\_open\_position

```python theme={null}
RobotiqGripper.get_open_position() -> int
```

Get what is considered the open position for gripper (minimum position value).

<ResponseField name="Returns">
  <ResponseField name="int" type="int">
    Open position value.
  </ResponseField>
</ResponseField>

### get\_closed\_position

```python theme={null}
RobotiqGripper.get_closed_position() -> int
```

Get what is considered the closed position for gripper (maximum position value).

<ResponseField name="Returns">
  <ResponseField name="int" type="int">
    Closed position value.
  </ResponseField>
</ResponseField>

### is\_open

```python theme={null}
RobotiqGripper.is_open()
```

Check if the current position is considered as being fully open.

<ResponseField name="Returns">
  <ResponseField name="bool" type="">
    True if gripper is fully open.
  </ResponseField>
</ResponseField>

### is\_closed

```python theme={null}
RobotiqGripper.is_closed()
```

Check if the current position is considered as being fully closed.

<ResponseField name="Returns">
  <ResponseField name="bool" type="">
    True if gripper is fully closed.
  </ResponseField>
</ResponseField>

### get\_current\_position

```python theme={null}
RobotiqGripper.get_current_position() -> int
```

Get the current position as returned by the physical hardware.

<ResponseField name="Returns">
  <ResponseField name="int" type="int">
    Current position value.
  </ResponseField>
</ResponseField>

### get\_grip\_detected

```python theme={null}
RobotiqGripper.get_grip_detected() -> bool
```

Get the current object status as returned by the physical hardware.

<ResponseField name="Returns">
  <ResponseField name="ObjectStatus" type="bool">
    Current object status.
  </ResponseField>
</ResponseField>

### auto\_calibrate

```python theme={null}
RobotiqGripper.auto_calibrate(log: bool = True) -> None
```

Attempt to calibrate the open and closed positions by slowly closing and opening the gripper.

<ResponseField name="Arguments">
  <ParamField query="log (bool)" type="bool">
    Whether to print the results to log.
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="None" />
</ResponseField>

<ResponseField name="Raises">
  <ParamField query="RuntimeError" type="">
    If calibration fails due to an object or other error.
  </ParamField>
</ResponseField>

### move

```python theme={null}
RobotiqGripper.move(position: int, speed: int, force: int) -> Tuple[bool, int]
```

Send commands to start moving towards the given position, with specified speed and force.

<ResponseField name="Arguments">
  <ParamField query="position (int)" type="int" required>
    Position to move to \[min\_position, max\_position]
  </ParamField>

  <ParamField query="speed (int)" type="int" required>
    Speed to move at \[min\_speed, max\_speed]
  </ParamField>

  <ParamField query="force (int)" type="int" required>
    Force to use \[min\_force, max\_force]
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="Tuple[bool, int]" />
</ResponseField>

### move\_and\_wait\_for\_pos

```python theme={null}
RobotiqGripper.move_and_wait_for_pos(position: int, speed: int, force: int) -> Tuple[int, ObjectStatus]
```

Send commands to move to position with specified speed and force, then wait for completion.

<ResponseField name="Arguments">
  <ParamField query="position (int)" type="int" required>
    Position to move to \[min\_position, max\_position]
  </ParamField>

  <ParamField query="speed (int)" type="int" required>
    Speed to move at \[min\_speed, max\_speed]
  </ParamField>

  <ParamField query="force (int)" type="int" required>
    Force to use \[min\_force, max\_force]
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="Tuple[int, ObjectStatus]" />
</ResponseField>

<ResponseField name="Raises">
  <ParamField query="RuntimeError" type="">
    If failed to set variables for move.
  </ParamField>
</ResponseField>

### open

```python theme={null}
RobotiqGripper.open()
```

Open the gripper to minimum position with maximum speed and force.

### close

```python theme={null}
RobotiqGripper.close()
```

Close the gripper to maximum position with maximum speed and force.

### get\_tool\_center\_wrt\_arm

```python theme={null}
RobotiqGripper.get_tool_center_wrt_arm()
```

*No docstring provided.*
