Skip to content

Weld Gun Close

SUMMARY

Weld Gun Close moves the electrode of a simulated spot-welding gun to its configured closed position, the calibrated point where the electrodes contact the panel.

This skill is the first half of a manual weld cycle. Pair it with a visibility call to show sparks and a reopen, or call Weld Gun Weld to run the whole cycle in one call.

The Skill

python
status = gun.close(asynchronous=False)

The Code

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

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

import argparse
from loguru import logger

from telekinesis.synapse.tools import welding_gun


def main(prim_path: str) -> None:
    """Closes 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.close(asynchronous=False)
        logger.success(f"close() status: {status}")
    finally:
        gun.disconnect()


if __name__ == "__main__":
    p = argparse.ArgumentParser(description="Spot-welding gun close")
    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 close.py --prim_path /World/spot_welding_gun

For all options:

bash
python close.py --help

Parameter Configuration

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

Returns

Same canonical motion status values as Weld Gun Move. A synchronous call normally returns "STOPPED_INNER_OBJECT" once the electrodes contact the panel, since the closed position is calibrated below the gun's unobstructed fully-closed pose.

Raises

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

Where to Use the Skill

  • Manual weld sequencing - Close the gun, show sparks with a visibility call, then reopen, when finer control than Weld Gun Weld is needed

When Not to Use the Skill

Do not use Weld Gun Close when:

  • A full weld cycle is all that is needed - use Weld Gun Weld, which closes, sparks, and reopens the gun in one call
  • The gun is not connected - always call connect before issuing motion commands