Skip to content

Gripper Get Part Present

SUMMARY

Get Part Present reports whether a suction gripper currently detects a held part.

This skill is used to verify grasp success immediately after grasp, or to detect a dropped part mid-transit.

The Skill

python
part_present = gripper.get_part_present()

The Code

Safety first!

A real robot will faithfully do whatever you ask of it - so please take a moment to clear the workspace, keep an E-Stop within reach, and be ready to disconnect.

Operating real hardware is at your own risk.

python
"""
Demonstrates reading whether a suction gripper currently holds an object.

Supports Piab grippers on all protocols (URCAP, MODBUS_RTU, ISAACSIM); this
example uses MODBUS_RTU. Also supported for the simulation-only
custom.SuctionGripper.

Usage:
    python get_part_present.py --serial-port COM3
"""

import argparse
from loguru import logger

from telekinesis.synapse.tools.suction_grippers import piab


def main(serial_port: str) -> None:
    """Reads whether a Piab gripper currently holds an object."""

    #===================== Create Gripper ======================================
    gripper = piab.PiabPiCobotElectric()

    # ==================== Run Skill ===========================================
    try:
        gripper.connect(serial_port=serial_port, protocol="MODBUS_RTU")
        logger.success(f"Part present: {gripper.get_part_present()}")
    except (ConnectionError, OSError) as e:
        logger.error(f"Error occurred: {e}")
    finally:
        gripper.disconnect()


if __name__ == "__main__":
    p = argparse.ArgumentParser(description="Piab gripper get part present")
    p.add_argument("--serial-port", dest="serial_port", default="COM3",
                   help="Serial port for MODBUS_RTU")
    args = p.parse_args()

    main(serial_port=args.serial_port)

Parameter Configuration

This skill takes no input parameters.

Returns

TypeDescription
boolTrue if a part is currently detected, False otherwise.

Raises

ExceptionCondition
ConnectionErrorThe backend is not connected
RuntimeErrorThe status request fails, or the gripper is not connected

Where to Use the Skill

  • Grasp verification - Confirm a pick succeeded before moving away from the pick location
  • In-transit monitoring - Poll periodically during a move to detect a dropped part early

When Not to Use the Skill

Do not use Get Part Present when:

  • The gripper is not connected - always call connect before issuing commands
  • Checking immediately after grasp - allow a brief settle time for vacuum to build before checking, or the result may be unreliable