Skip to content

Weld Gun Move

SUMMARY

Weld Gun Move commands the electrode of a simulated spot-welding gun to a specific normalized joint position.

This skill is used when a position other than fully open or fully closed is required, such as staging the electrode close to a panel before a weld.

UNITS

position is a normalized joint position from 0.0 (open) to 1.0 (closed). The gun's calibrated weld point, reached by Weld Gun Close, is not 1.0 - it is wherever the electrodes contact the panel for the model in use.

The Skill

python
status = gun.move(position=0.12, asynchronous=False)

The Code

python
"""
Demonstrates moving a simulated spot-welding gun's electrode to a normalized position.

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

import argparse
from loguru import logger

from telekinesis.synapse.tools import welding_gun


def main(prim_path: str) -> None:
    """Moves a simulated spot-welding gun's electrode to its calibrated closed position."""

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

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

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


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

For all options:

bash
python move.py --help

Parameter Configuration

ParameterTypeDefaultDescription
positionfloat-Normalized electrode position from 0.0 to 1.0.
asynchronousboolFalseIf True, returns "MOVING" immediately without waiting.

Returns

StatusDescription
"MOVING"Returned when asynchronous=True
"AT_DEST"Electrode reached the target position
"STOPPED_OUTER_OBJECT"Stopped against an object outside the closing path
"STOPPED_INNER_OBJECT"Stopped by contact along the closing path, e.g. the panel at the weld point
"UNKNOWN_STATUS_<code>"Unexpected backend status

Raises

ExceptionCondition
TypeErrorposition is not numeric, or asynchronous is not a bool
ValueErrorposition is outside 0.0 to 1.0
RuntimeErrorThe gun is not connected, or motion fails

Where to Use the Skill

  • Custom electrode staging - Move to an intermediate position before or after a weld
  • Overlapping motion - Use asynchronous=True to move the electrode concurrently with robot motion

When Not to Use the Skill

Do not use Weld Gun Move 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