Skip to content

Set Cartesian Speed ​

SUMMARY

Set Cartesian Speed sets the default TCP speed used by motions that are called without an explicit speed. The initial value is 1.05 m/s.

UNITS

speed is in m/s (Tool Center Point linear).

The Skill ​

python
robot.set_cartesian_speed(0.25)

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.

python
"""
Set the default Cartesian speed, then make a Cartesian move that uses it.

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

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

import argparse

from loguru import logger

from telekinesis.synapse.robots.manipulators import universal_robots


def main(ip: str | None, prim_path: str | None) -> None:
    """Set the default Cartesian speed and move with it."""

    #===================== 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)

        # ==================== Run Skill ============================================
        # TCP linear speed [m/s] for Cartesian moves called without one
        robot.set_cartesian_speed(speed=0.1)
        logger.info("Default Cartesian speed set to 0.1 m/s.")

        #===================== Move With Defaults ==========================================
        target_cartesian_pose = robot.get_cartesian_pose().copy()
        target_cartesian_pose[2] += 0.1  # Move 10 cm up in Z

        # Called without speed/acceleration, so the defaults set above are used
        robot.set_cartesian_pose(cartesian_pose=target_cartesian_pose)
        logger.success(f"Moved to target Cartesian pose: {target_cartesian_pose}")
    except (ConnectionError, OSError) as e:
        logger.error(f"Error occurred: {e}")
    finally:
        robot.disconnect()
        robot.shutdown()


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Set the default Cartesian speed and move with it.")
    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 set_cartesian_speed.py
bash
python set_cartesian_speed.py --prim_path /World/ur10e
bash
python set_cartesian_speed.py --ip 192.168.1.100

For all options:

bash
python set_cartesian_speed.py --help

Parameter Configuration ​

ParameterTypeDefaultDescription
speedfloatrequiredNew default TCP speed in m/s. Must be finite and positive.

Returns ​

TypeDescription
NoneThe default is stored on the robot and used by Set Cartesian Pose and Set Joint Position in Cartesian Space.

Raises ​

ExceptionCondition
TypeErrorspeed is not a number
ValueErrorspeed is not finite and positive

How to Tune the Parameters ​

Applies to Set Cartesian Pose and Set Joint Position in Cartesian Space when they are called without an explicit speed; an explicit value passed to the motion still wins. Start conservatively while validating a new path, then raise the default once the motion is confirmed clear.

Where to Use the Skill ​

  • Program-wide defaults - Set the speed once instead of passing it to every move.
  • Commissioning - Slow everything down while testing a new cell.

When Not to Use the Skill ​