Skip to content

Stop Joint Motion

SUMMARY

Stop Joint Motion decelerates the robot and brings any active joint-space motion to a complete stop.

This skill is the safe and controlled way to interrupt a joint move launched with asynchronous=True.

UNITS

stopping_speed in deg/s² (deceleration magnitude).

The Skill

python
robot.stop_joint_motion(stopping_speed=0.5)

The Code

Safety first!

A real robot will faithfully do whatever you ask of it - so please take a moment to clear the workspace, keep an E-Stop within reach, and be ready to disconnect.

Operating real hardware is at your own risk.

Example: Stop Joint Motion Mid-Move

Launch an asynchronous joint move, wait briefly, then stop the robot before it reaches the target.

python
"""
Commands an asynchronous joint move and interrupts it mid-trajectory with stop_joint_motion.

Supports Universal Robots (UR), Epson, and Isaac Sim.

Usage:
    python stop_joint_motion.py [--ip <ROBOT_IP>] [--prim_path <PRIM_PATH>]
"""

import argparse
import time

from loguru import logger

from telekinesis.synapse.robots.manipulators import universal_robots


def main(ip: str | None, prim_path: str | None) -> None:
    """Start an async joint move and interrupt it with stop_joint_motion."""

    #===================== Create Robot ==========================================
    robot = universal_robots.UniversalRobotsUR10E(name='UR10e')

    # ==================== Visualization (Optional) =============================
    # Live: subscribes to the robot's state topic and redraws as it moves.
    robot.visualize_rerun(live=True)

    try:
        #===================== Connect Robot ==========================================
        if ip:
            robot.connect(ip=ip)
        elif prim_path:
            robot.connect(simulation_prim_path=prim_path)
            robot.set_joint_positions(robot.default_joint_configuration)

        #===================== Prepare Target ==========================================
        # Get initial joint positions [deg]
        initial_joint_positions = robot.get_joint_positions()
        target_joint_positions = list(initial_joint_positions)
        target_joint_positions[0] += 20  # Asynchronous +20 deg move on joint 0

        # ==================== Run Skill ============================================
        robot.set_joint_positions(
            joint_positions=target_joint_positions,
            speed=60,
            acceleration=80,
            asynchronous=True,
        )

        # Let the move run briefly, then interrupt it
        time.sleep(0.3)
        robot.stop_joint_motion(stopping_speed=30)
        logger.info("Stopped joint motion.")
    except (ConnectionError, OSError) as e:
        logger.error(f"Error occurred: {e}")
    finally:
        robot.disconnect()
        robot.shutdown()


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Interrupt an async joint move with stop_joint_motion")
    parser.add_argument("--ip", type=str, default=None,
                         help="UR robot IP address for real hardware, e.g. 192.168.1.100")
    parser.add_argument("--prim_path", type=str, default=None,
                         help='Isaac Sim articulation prim path, e.g. "/World/ur10e"')
    args = parser.parse_args()

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

Running the Example

bash
python stop_joint_motion.py --prim_path /World/ur10e
bash
python stop_joint_motion.py --ip 192.168.1.100

For all options:

bash
python stop_joint_motion.py --help

Parameter Configuration

ParameterTypeDefaultDescription
stopping_speedfloat0.5Deceleration target speed in deg/s.

Returns

TypeDescription
NoneReturns after the stop command is sent.

Raises

ExceptionCondition
RuntimeErrorThe robot is not connected

Where to Use the Skill

  • Interrupt asynchronous joint moves - Stop a set_joint_positions or set_cartesian_pose_in_joint_space call launched with asynchronous=True
  • Safety-triggered halt - Stop joint motion immediately when a safety condition is detected

When Not to Use the Skill

Do not use Stop Joint Motion when:

  • The active motion is Cartesian-linear - use Stop Cartesian Motion instead
  • The motion is already synchronous - synchronous calls block until completion; there is no motion to interrupt