sim2bot.Robot.gripper¶
gripper(fraction: float, robot: int = 0) -> None
¶
Set normalized gripper openness for one robot.
Parameters:
-
fraction(float) –0.0fully closed through1.0fully open. -
robot(int, default:0) –Robot index returned by
describe.
Returns:
-
None–Unsupported grippers may ignore the command.
Raises:
-
TypeError–If
fractioncannot be converted tofloat. -
ValueError–If
fractionis not a numeric value. -
RuntimeError–If the client is not connected.
-
ConnectionClosed–If the WebSocket closes while sending the command.
-
OSError–If the selected transport cannot send the command.
Notes
Robots without a supported gripper ignore the command. Discover
RobotInfo.has_gripper before relying on it.
Source code in sim2bot/client.py
Practical examples¶
Examples use objects discovered from the current scene rather than hard-coded robot metadata.
Guidance¶
Usage tip
Check RobotInfo.has_gripper before presenting gripper controls in a generic application.
Common error
Robots without a supported gripper silently ignore this command.