Skip to content

Connection and Disconnection (Conveyor)

SUMMARY

Connect links a Conveyor instance to a conveyor prim in the open Isaac Sim stage, and starts the simulation timeline. Disconnect releases that connection. All operations on the belt other than connecting require an active connection, so always pair the two inside a try / finally block.

The Skill

python
belt.connect(simulation_prim_path="/World/ConveyorBelt_A08")
belt.disconnect()

An optional cargo_root narrows which rigid bodies are woken when the belt starts:

python
belt.connect(simulation_prim_path="/World/ConveyorBelt_A08", cargo_root="/World")

The Code

python
"""
Demonstrates connecting to and disconnecting from a conveyor belt in a
running Isaac Sim stage.

Supports Isaac Sim only.

Usage:
    python connection_and_disconnection.py --prim_path <PRIM_PATH>

Note:
    Open Isaac Sim before running this. A stage that does not hold the
    conveyor prim gets the bundled demo belt added to it at
    /World/simple_conveyor, keeping whatever is already in the stage; to
    build a belt of your own instead, follow
    https://docs.isaacsim.omniverse.nvidia.com/6.0.1/digital_twin/warehouse_logistics/ext_isaacsim_asset_gen_conveyor.html
    and name it with --prim_path.
"""

import argparse

from loguru import logger

from telekinesis.medulla.conveyors import isaacsim


def main(prim_path: str, cargo_root: str | None) -> None:
    """Connects to a conveyor belt, then disconnects."""

    # ===================== Create Conveyor ======================================
    belt = isaacsim.Conveyor(name="my_simulated_conveyor")
    belt.set_usd("https://assets.telekinesis.ai/usd/conveyors/simple_conveyor.zip")

    try:
        # ==================== Run Skill ============================================
        belt.connect(simulation_prim_path=prim_path, cargo_root=cargo_root)
        logger.success(f"Connected: {belt.is_connected}.")
    except (ConnectionError, RuntimeError) as e:
        logger.error(f"Error occurred: {e}")
    finally:
        belt.disconnect()


if __name__ == "__main__":
    p = argparse.ArgumentParser(
        description="Connect to and disconnect from a conveyor belt in Isaac Sim")
    p.add_argument("--prim_path", type=str, default="/World/simple_conveyor",
                   help='Isaac Sim conveyor prim path, e.g. "/World/simple_conveyor"')
    p.add_argument("--cargo_root", type=str, default="/World",
                   help="USD path whose rigid bodies are woken when the belt starts")
    args = p.parse_args()

    main(prim_path=args.prim_path, cargo_root=args.cargo_root)

Running the Example

bash
python connection_and_disconnection.py --prim_path /World/simple_conveyor

For all options:

bash
python connection_and_disconnection.py --help

Parameter Configuration

connect

ParameterTypeDefaultDescription
simulation_prim_pathstrrequiredUSD path of a conveyor in the open Isaac Sim stage, e.g. "/World/simple_conveyor". May name the conveyor asset's root, the belt rigid body itself, or any prim in between.
cargo_rootstr | NoneNoneUSD path whose rigid bodies are woken when the belt starts. Narrow this to the prims the belt carries.

disconnect

Takes no parameters.

Returns

MethodTypeDescription
connectNoneReturns nothing.
disconnectNoneReturns nothing.

Raises

MethodExceptionCondition
connectRuntimeErrorThe conveyor is already connected, or the connection fails (Isaac Sim not running with the telekinesis.isaacsim.bridge extension enabled, or the prim not provisioned as a conveyor).
connectTypeErrorsimulation_prim_path is empty or not a string.
disconnect(none)Calling on a conveyor that is not connected logs a warning instead of raising.

Where to Use the Skill

Connect is the first call against a Conveyor, and Disconnect the last. Use Start and Stop in between to drive the belt.