Skip to content

Stop Cartesian Motion

SUMMARY

Stop Cartesian Motion decelerates the robot and brings any active Cartesian (TCP-linear) motion to a complete stop.

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

UNITS

stopping_speed in m/s² (deceleration magnitude).

The Skill

python
robot.stop_cartesian_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 Cartesian Motion Mid-Move

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

python
"""
Commands an asynchronous Cartesian move and interrupts it mid-trajectory with stop_cartesian_motion.

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

Usage:
    python stop_cartesian_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 Cartesian move and interrupt it with stop_cartesian_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 Cartesian pose [x, y, z, rx, ry, rz] (m, deg)
        actual_pose = robot.get_cartesian_pose()
        target_pose = list(actual_pose)
        target_pose[2] += 0.15  # Asynchronous +15 cm move along Z

        # ==================== Run Skill ============================================
        robot.set_cartesian_pose(
            cartesian_pose=target_pose,
            speed=0.25,
            acceleration=0.5,
            asynchronous=True,
        )

        # Let the move run briefly, then interrupt it
        time.sleep(0.3)
        robot.stop_cartesian_motion(stopping_speed=0.25)
        logger.info("Stopped Cartesian 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 Cartesian move with stop_cartesian_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_cartesian_motion.py --prim_path /World/ur10e
bash
python stop_cartesian_motion.py --ip 192.168.1.100

For all options:

bash
python stop_cartesian_motion.py --help

Parameter Configuration

ParameterTypeDefaultDescription
stopping_speedfloat0.5Deceleration target speed in m/s. Lower values produce gentler stops.

Returns

TypeDescription
NoneReturns after the stop command is sent.

Raises

ExceptionCondition
RuntimeErrorThe robot is not connected

Where to Use the Skill

  • Interrupt asynchronous Cartesian moves - Stop a set_cartesian_pose or set_joint_position_in_cartesian_space call launched with asynchronous=True
  • Emergency path abort - Halt TCP motion immediately when a sensor or vision system detects an obstacle

When Not to Use the Skill

Do not use Stop Cartesian Motion when:

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