Skip to content

Weld Gun Open

SUMMARY

Weld Gun Open moves the electrode of a simulated spot-welding gun to its configured open position.

This skill is used to clear the electrode from a panel before or after a weld, or to reset the gun to a known state.

The Skill

python
status = gun.open(asynchronous=False)

The Code

python
"""
Demonstrates opening a simulated spot-welding gun.

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

import argparse
from loguru import logger

from telekinesis.synapse.tools import welding_gun


def main(prim_path: str) -> None:
    """Opens a simulated spot-welding gun."""

    #===================== Create Gun ======================================
    gun = welding_gun.SpotWeldingGun()

    try:
        #===================== Connect Gun =================================
        gun.connect(simulation_prim_path=prim_path)

        #===================== Run Skill ====================================
        status = gun.open(asynchronous=False)
        logger.success(f"open() status: {status}")
    finally:
        gun.disconnect()


if __name__ == "__main__":
    p = argparse.ArgumentParser(description="Spot-welding gun open")
    p.add_argument("--prim_path", type=str, default="/World/spot_welding_gun",
                   help='Isaac Sim gun prim path, e.g. "/World/spot_welding_gun"')
    args = p.parse_args()

    main(prim_path=args.prim_path)

Running the Example

bash
python open.py --prim_path /World/spot_welding_gun

For all options:

bash
python open.py --help

Parameter Configuration

ParameterTypeDefaultDescription
asynchronousboolFalseIf True, returns "MOVING" immediately without waiting.

Returns

Same canonical motion status values as Weld Gun Move.

Raises

ExceptionCondition
TypeErrorasynchronous is not a bool
RuntimeErrorThe gun is not connected, or motion fails

Where to Use the Skill

  • Clearing the panel - Retract the electrode after a weld or before repositioning the robot
  • Known starting state - Open the gun at the start of a script before the first weld

When Not to Use the Skill

Do not use Weld Gun Open when:

  • An intermediate position is needed - use Weld Gun Move instead
  • The gun is not connected - always call connect before issuing motion commands