Gripper Set Unit
SUMMARY
Set Unit configures the measurement unit used for position, speed, and force parameters in subsequent gripper commands.
Robotiq automatically sets default units after connect ("mm" for position, "percent" for speed and force). Call set_unit only when a different unit is needed.
SUPPORTED GRIPPERS
Available on Robotiq (full unit selection: device, normalized, percent, mm) and OnRobot grippers (only position=mm and force=N accepted).
The Skill
python
gripper.set_unit("position", "mm")
gripper.set_unit("speed", "percent")
gripper.set_unit("force", "percent")The Code
Example: Confirm Default Units After Connecting
Robotiq sets these units automatically on connect. Calling them explicitly improves readability.
python
"""
Robotiq 2F-85 set position unit example for the Synapse SDK.
Switches the gripper position unit between normalized (0..1) and mm.
Usage:
python set_unit.py --ip <ROBOT_IP>
"""
import argparse
from loguru import logger
from telekinesis.synapse.tools.parallel_grippers import robotiq
def main(ip: str):
"""Switch the gripper position unit to normalized (0..1)."""
# Create and connect to the gripper
gripper = robotiq.Robotiq2F85()
gripper.connect(ip=ip)
try:
gripper.set_unit(parameter='position', unit='normalized')
logger.success("Position unit set to 'normalized'.")
finally:
gripper.disconnect()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Robotiq gripper set_unit example")
parser.add_argument("--ip", type=str, required=True, help="UR robot IP address")
args = parser.parse_args()
main(ip=args.ip)Parameter Configuration
Robotiq 2F-85
| Parameter | Type | Default | Description |
|---|---|---|---|
parameter | str | required | The parameter to configure: "position", "speed", or "force". |
unit | str | required | Position: "mm", "device" (0-255), "normalized" (0.0-1.0), "percent" (0-100). Speed / force: "device", "normalized", "percent". |
OnRobot RG2 / RG6
| Parameter | Type | Default | Description |
|---|---|---|---|
parameter | str | required | "position" or "force" only. "speed" is not accepted. |
unit | str | required | Position: "mm" only. Force: "N" only. |
Returns
This skill returns nothing (None).
Raises
Robotiq 2F-85
| Exception | Condition |
|---|---|
ValueError | parameter is not "position", "speed", or "force"; or unit is not supported for the given parameter |
RuntimeError | The gripper is not connected |
OnRobot RG2 / RG6
| Exception | Condition |
|---|---|
TypeError | parameter or unit is not a string |
ValueError | The (parameter, unit) combination is not supported |
How to Tune the Parameters
Prefer "mm" for position in production scripts - physical units are self-documenting and easy to validate against the gripper's datasheet.
Where to Use the Skill
- Session initialization - Call once after
connectwhen a non-default unit is needed - Unit switching - Re-call mid-session to switch between units for a specific subroutine
When Not to Use the Skill
Do not call set_unit when:
- The default units are sufficient - after
connect, position is already"mm"and speed/force are already"percent"

