Skip to content

Weld Gun Weld

SUMMARY

Weld Gun Weld runs a full weld cycle on a simulated spot-welding gun: close the electrode onto the panel, show the weld sparks for a configured duration, and optionally reopen.

This is the primary skill for executing a spot weld once the robot has positioned the gun at the weld point.

UNITS

duration_seconds in seconds. Sparks are only shown for guns whose USD asset declares spark prims; a gun with none welds silently.

The Skill

python
gun.weld(duration_seconds=0.5, reopen=True)

The Code

python
"""
Demonstrates running a full weld cycle on a simulated spot-welding gun.

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

import argparse
from loguru import logger

from telekinesis.synapse.tools import welding_gun


def main(prim_path: str) -> None:
    """Runs one weld cycle on a simulated spot-welding gun."""

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

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

        #===================== Run Skill ====================================
        gun.weld(duration_seconds=0.5, reopen=True)
        logger.success("weld() complete")
    finally:
        gun.disconnect()


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

For all options:

bash
python weld.py --help

Parameter Configuration

ParameterTypeDefaultDescription
duration_secondsfloatNoneSpark duration in seconds. None uses the gun's configured weld_duration_seconds (0.5 by default).
reopenboolTrueWhether to reopen the gun after the weld.

Returns

This skill returns nothing (None).

Raises

ExceptionCondition
TypeErrorduration_seconds is not numeric or None, or reopen is not a bool
ValueErrorduration_seconds is not greater than zero
RuntimeErrorThe gun is not connected, or a bridge call fails

Where to Use the Skill

  • Executing a spot weld - Once the robot has positioned the gun at the weld point, call weld to close, spark, and reopen in one call
  • Batch welding - Loop over a sequence of weld points, calling weld at each one

When Not to Use the Skill

Do not use Weld Gun Weld when:

  • Finer control over the cycle is needed - use Weld Gun Close and Weld Gun Open directly to control timing between steps
  • The gun is not connected - always call connect before issuing motion commands