Skip to content

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.

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
from telekinesis.synapse.tools.parallel_grippers import robotiq

gripper = robotiq.Robotiq2F85()
# Connect
gripper.connect(ip="192.168.1.1", protocol="RTDE")
# Set units
gripper.set_unit("position", "mm")
gripper.set_unit("speed", "percent")
gripper.set_unit("force", "percent")
gripper.move(position=42.5, speed=50.0, force=60.0, asynchronous=False)
# Disconnect
gripper.disconnect()

The Explanation of the Code

set_unit declares the unit for a given parameter. The setting persists for the entire session and applies to all subsequent calls to move, open, close, get_current_position, set_speed, and set_force.

Supported units per parameter:

ParameterSupported units
"position""mm", "device" (0–255), "normalized" (0.0–1.0), "percent" (0–100)
"speed""device", "normalized", "percent"
"force""device", "normalized", "percent"

How to Tune the Parameters

Robotiq 2F-85

ParameterTypeDescription
parameterstrThe parameter to configure: "position", "speed", or "force".
unitstrPosition: "mm", "device" (0–255), "normalized" (0.0–1.0), "percent" (0–100). Speed / force: "device", "normalized", "percent".

OnRobot RG2 / RG6

ParameterTypeDescription
parameterstr"position" or "force" only. "speed" is not accepted.
unitstrPosition: "mm" only. Force: "N" only.

TIP

Prefer "mm" for position in production scripts — physical units are self-documenting and easy to validate against the gripper's datasheet.

WARNING

A ValueError is raised if an unsupported parameter or unit value is passed. set_unit requires an active connection — call it after connect.

Where to Use the Skill

  • Session initialization — Call once after connect when 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"

Supported Grippers

GripperSupported
OnRobot RG2✅ (position: "mm", force: "N" only)
OnRobot RG6✅ (position: "mm", force: "N" only)
Robotiq 2F-85✅ (full unit selection)
Schunk EGU-50Coming Soon!