Gripper Close
SUMMARY
Close Gripper commands a parallel gripper to close its fingers to 0 mm and grasp an object.
This skill is used to pick an object after the robot has positioned the gripper around it.
UNITS
speed / force in the configured speed and force units (default percent for Robotiq; OnRobot ignores speed and uses N for force).
The Skill
python
status = gripper.close(speed=100.0, force=100.0, asynchronous=False)The Code
Safety first!
A real robot will faithfully do whatever you ask of it - so please take a moment to clear the workspace, keep an E-Stop within reach, and be ready to disconnect.
Operating real hardware is at your own risk.
python
"""
Demonstrates closing a parallel gripper.
Supports OnRobot and Robotiq grippers, and Isaac Sim.
Usage:
python close.py --ip <GRIPPER_IP>
python close.py --prim_path <PRIM_PATH>
Note:
Experimental gripper support for Isaac Sim: Robotiq 2F85 (USD-based simulation only); Schunk EGP and
PZN+ are.
"""
import argparse
from loguru import logger
from telekinesis.synapse.tools.parallel_grippers import onrobot
def main(ip: str | None,
protocol: str,
prim_path: str | None) -> None:
"""Closes an OnRobot gripper fully at 50 N force."""
#===================== Create Gripper ======================================
gripper = onrobot.OnRobotRG6()
try:
#===================== Connect Gripper =================================
if prim_path:
gripper.connect(simulation_prim_path=prim_path)
else:
gripper.connect(ip=ip, protocol=protocol)
# ==================== Run Skill ====================================
status = gripper.close(force=50.0,
asynchronous=False)
logger.success(f"close() status: {status}, "
f"position: {gripper.get_current_position():.2f}")
except (ConnectionError, OSError) as e:
logger.error(f"Error occurred: {e}")
finally:
gripper.disconnect()
if __name__ == "__main__":
p = argparse.ArgumentParser(description="OnRobot gripper close")
p.add_argument("--protocol",
choices=["MODBUS_TCP"],
default="MODBUS_TCP")
p.add_argument("--ip", default=None, help="IP for OnRobot Gripper")
p.add_argument("--prim_path", type=str, default=None,
help='Isaac Sim gripper prim path, e.g. "/World/onrobot_rg6"')
args = p.parse_args()
main(ip=args.ip,
protocol=args.protocol,
prim_path=args.prim_path)Running the Example
bash
python close.py --ip 192.168.1.100bash
python close.py --prim_path /World/onrobot_rg6For all options:
bash
python close.py --helpParameter Configuration
Robotiq 2F-85
| Parameter | Type | Default | Description |
|---|---|---|---|
speed | float | 100.0 | Motion speed in percent (0-100). Pass -1.0 to use the session default. |
force | float | 100.0 | Gripping force in percent (0-100). Pass -1.0 to use the session default. |
asynchronous | bool | False | If True, returns "MOVING" immediately without waiting. |
OnRobot RG2 / RG6
| Parameter | Type | Default | Description |
|---|---|---|---|
force | float | - | Gripping force in Newtons, clamped to the model's max force. |
asynchronous | bool | False | If True, returns "MOVING" immediately without waiting. |
Returns
| Status | Description |
|---|---|
"MOVING" | Returned when asynchronous=True |
"AT_DEST" | Fingers reached fully closed - no object detected |
"STOPPED_OUTER_OBJECT" | Robotiq only - stopped against an external object (grasp detected). OnRobot hardware cannot distinguish inner from outer grip, so this value is never returned by OnRobot. |
"STOPPED_INNER_OBJECT" | Robotiq: stopped by internal contact (grasp detected). OnRobot: any detected grasp (the hardware does not distinguish inner from outer). |
"UNKNOWN_STATUS_<code>" | Unexpected hardware status |
Raises
Robotiq 2F-85
| Exception | Condition |
|---|---|
TypeError | asynchronous is not a bool |
ValueError | The configured connection protocol is not supported |
RuntimeError | The gripper is not connected |
OnRobot RG2 / RG6
| Exception | Condition |
|---|---|
TypeError | An argument's value does not match its expected type |
RuntimeError | The gripper is not connected, or the underlying Modbus command fails |
How to Tune the Parameters
Check the return value after closing. "STOPPED_OUTER_OBJECT" or "STOPPED_INNER_OBJECT" confirms a successful grasp before transporting the object.
Where to Use the Skill
- Pick operations - Close after the robot is positioned at the pick target
- Grasp verification - Check the return status to confirm a successful grasp before transporting
- Re-grasp - Open and close again if the initial grasp is unsuccessful
When Not to Use the Skill
Do not use Close Gripper when:
- A specific intermediate position is required - use Tool Move to close to a defined width
- The gripper is not connected - always call
connectbefore issuing motion commands