Skip to content

Gripper Recover From Fault ​

SUMMARY

Recover From Fault resets a Robotiq gripper and runs its activation cycle again, clearing a latched fault and recalibrating the finger range.

The Skill ​

python
gripper.recover_from_fault()

The Code ​

python
"""
Demonstrates clearing a fault on a parallel gripper and reactivating it.

Supports only Robotiq grippers (Modbus RTU), and Isaac Sim.

Usage:
    python recover_from_fault.py --protocol MODBUS_RTU --serial-port COM4
    python recover_from_fault.py --prim_path <PRIM_PATH>

Note:
    The recovery sweeps the fingers fully open and closed, releasing any held
    object. Run it with nothing between the fingers. A simulated gripper has
    no faults, so recover_from_fault() is a no-op when connected to Isaac Sim.
"""

import argparse
from loguru import logger

from telekinesis.synapse.tools.parallel_grippers import robotiq


def main(serial_port: str,
         protocol: str,
         prim_path: str | None) -> None:
    """Resets and reactivates a Robotiq gripper."""

    #===================== Create Gripper ======================================
    gripper = robotiq.Robotiq2F85()

    try:
        #===================== Connect Gripper =================================
        if prim_path:
            gripper.connect(simulation_prim_path=prim_path)
        else:
            gripper.connect(serial_port=serial_port, protocol=protocol)

        # ==================== Run Skill ====================================
        gripper.recover_from_fault()
        logger.success("Gripper reset and reactivated.")
    except (ConnectionError, OSError) as e:
        logger.error(f"Error occurred: {e}")
    finally:
        gripper.disconnect()


if __name__ == "__main__":
    p = argparse.ArgumentParser(description="Robotiq gripper recover from fault")
    p.add_argument("--protocol", choices=["MODBUS_RTU"], default="MODBUS_RTU")
    p.add_argument("--serial-port", dest="serial_port", default="COM4",
                   help="Serial port for MODBUS_RTU")
    p.add_argument("--prim_path", type=str, default=None,
                   help='Isaac Sim gripper prim path, e.g. "/World/robotiq_2f85"')
    args = p.parse_args()

    main(serial_port=args.serial_port,
         protocol=args.protocol,
         prim_path=args.prim_path)

Running the Example ​

bash
python recover_from_fault.py --protocol MODBUS_RTU --serial-port COM4
bash
python recover_from_fault.py --prim_path /World/robotiq_2f85

For all options:

bash
python recover_from_fault.py --help

Parameter Configuration ​

This skill takes no input parameters.

Returns ​

TypeDescription
NoneThe gripper is reset and reactivated.

Raises ​

ExceptionCondition
ValueErrorThe configured protocol does not support recovery (only MODBUS_RTU does)
RuntimeErrorThe gripper is not connected, or activation does not complete in time

How to Tune the Parameters ​

This skill takes no parameters. The activation sweep releases any held object and calibrates "closed" to whatever the fingers touch, so call it with nothing between the fingers and never with a narrow or fragile attachment installed. A simulated gripper has no faults, so on Isaac Sim the call does nothing.

Where to Use the Skill ​

  • Fault recovery - Clear a major fault latched on the gripper.
  • Recalibration - Re-measure the finger range after a collision.

When Not to Use the Skill ​

  • Nothing is wrong - use Gripper Activate; connect already activates when needed.
  • A part is held - the sweep drops it.