Skip to content

Gripper Get Gripped Objects ​

SUMMARY

Get Gripped Objects returns the USD paths of the prims the gripper currently holds.

The Skill ​

python
objects = gripper.get_gripped_objects()

The Code ​

python
"""
Demonstrates listing the prims a suction gripper currently holds.

Supports Isaac Sim only.

Usage:
    python get_gripped_objects.py --prim_path <PRIM_PATH>
"""

import argparse
from loguru import logger

from telekinesis.synapse.tools.suction_grippers import isaacsim


def main(prim_path: str) -> None:
    """Lists the prims the gripper holds."""

    #===================== Create Gripper ======================================
    gripper = isaacsim.SuctionGripper()

    try:
        #===================== Connect Gripper =================================
        gripper.connect(simulation_prim_path=prim_path)

        # ==================== Run Skill ====================================
        result = gripper.get_gripped_objects()
        logger.success(f"Gripped objects: {result}")
    except (ConnectionError, OSError) as e:
        logger.error(f"Error occurred: {e}")
    finally:
        if gripper.is_connected:
            gripper.disconnect()


if __name__ == "__main__":
    p = argparse.ArgumentParser(description="Suction gripper get_gripped_objects")
    p.add_argument("--prim_path", type=str, required=True,
                   help='Isaac Sim gripper prim path, e.g. "/World/suction_gripper"')
    args = p.parse_args()

    main(prim_path=args.prim_path)

Running the Example ​

bash
python get_gripped_objects.py --prim_path /World/suction_gripper

For all options:

bash
python get_gripped_objects.py --help

Parameter Configuration ​

This skill takes no input parameters.

Returns ​

TypeDescription
listUSD paths of the held prims; empty when nothing is held.

Raises ​

ExceptionCondition
RuntimeErrorThe gripper is not connected or the status request fails

How to Tune the Parameters ​

This skill takes no parameters. Call it after Gripper Grasp to confirm what was picked, and after Gripper Release to confirm it was dropped.

Where to Use the Skill ​

  • Pick verification - Confirm the intended object was grasped.
  • Multi-object scenes - Tell which prim ended up in the gripper.

When Not to Use the Skill ​