Gripper Set Force
SUMMARY
Set Force configures the default gripping force. Call set_force only when a different session-level default is needed.
UNITS
force in the configured force unit (default percent for Robotiq, N for OnRobot).
The Skill
python
actual_force = gripper.set_force(force=60.0)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 setting the default grip force of a parallel gripper.
Supports OnRobot and Robotiq grippers, and Isaac Sim.
Usage:
python set_force.py --ip <GRIPPER_IP>
python set_force.py --prim_path <PRIM_PATH>
Note:
The simulation does not model grip force, so in Isaac Sim this call is
accepted but has no effect on the motion.
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:
"""Sets the default grip force of an OnRobot gripper to 50 N."""
#===================== 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 ====================================
actual = gripper.set_force(force=50.0)
logger.success(f"Default force set; effective: {actual}")
except (ConnectionError, OSError) as e:
logger.error(f"Error occurred: {e}")
finally:
gripper.disconnect()
if __name__ == "__main__":
p = argparse.ArgumentParser(description="OnRobot gripper set force")
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 set_force.py --ip 192.168.1.100bash
python set_force.py --prim_path /World/onrobot_rg6For all options:
bash
python set_force.py --helpParameter Configuration
Robotiq 2F-85
| Parameter | Type | Default | Description |
|---|---|---|---|
force | float | required | Desired force in percent (0-100). Pass -1.0 to use the backend's current preset. |
OnRobot RG2 / RG6
| Parameter | Type | Default | Description |
|---|---|---|---|
force | float | required | Desired force in Newtons. RG2 max 40 N, RG6 max 120 N. Pass -1.0 to use the backend's current preset. |
Returns
| Type | Description |
|---|---|
float | The actual force value accepted by the backend. |
Raises
Robotiq 2F-85
| Exception | Condition |
|---|---|
RuntimeError | The gripper is not connected |
OnRobot RG2 / RG6
| Exception | Condition |
|---|---|
TypeError | force is not numeric |
How to Tune the Parameters
Start with a low force (20-30% for Robotiq, or ~10 N for OnRobot) for lightweight or fragile parts and increase until the grasp is secure without risking damage.
Where to Use the Skill
- Session baseline - Set once after connecting so individual
move/open/closecalls can passforce=-1.0 - Force profile switching - Re-call mid-session when switching between object types that need different gripping forces
When Not to Use the Skill
Do not call set_force when:
- Force is passed per-call - if every
move/open/closealready includes an explicitforceargument, this call is redundant - The gripper is not connected - always call
connectbefore issuing configuration commands