simulo.GripperState
State a gripper actuator REPORTS — what it is currently doing.
Read back with get_state() (one value per instance) after
update(dt). This is the observation half of the gripper vocabulary;
GripperCommand is the intent half. They are deliberately two
enums, not one — see the warning below.
State Interface:
OPEN(-1): Not grasping.CLOSING(0): Commanded closed, the grasp has not completed.CLOSED(1): Grasping.
Example:
gripper.update(dt)if gripper.get_state()[0] is simulo.GripperState.CLOSED: ... # the grasp landedWarning:
GripperState.CLOSING and GripperCommand.IDLE are both the
integer 0, and they mean different things. A 0 you read out of
get_state() (or out of a log line, or an MCAP channel) is a state:
the gripper is mid-close. A 0 you pass into set_command() is
an intent: hold whatever you are already doing. The two enums exist
precisely so the two zeros never have to be told apart by eye —
repr() prints GripperState.CLOSING vs. GripperCommand.IDLE,
so name them in logs (f"{state!r}") rather than printing
state.value.
Collapsing them into one enum would force one of the two zeros to
change value, and both are load-bearing: -1/0/1 is the state the
engine reports for a surface gripper, and -1/0/1 is what falls in
the natural open/idle/close bands of the float command channel.
class GripperState(IntEnum)| Member | Value | Meaning |
|---|---|---|
OPEN |
-1 |
|
CLOSING |
0 |
|
CLOSED |
1 |