Skip to content

In Joint Limits

SUMMARY

In Joint Limits checks whether a candidate joint configuration is strictly inside the robot's configured per-joint lower and upper bounds. Use it as a guard before sending a joint target to the controller or before running motion planning.

UNITS

Input joint configuration q in degrees. Returns a boolean.

The Skill

python
ok = robot.in_joint_limits(q=q, verbose=False)

The Code

Example: Check Joint Configurations Against Limits

Check the robot's current joint configuration and an out-of-range configuration.

python
"""
Checks whether joint configurations lie within the limits derived from the robot's URDF.

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

Usage:
    python in_joint_limits.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:
    """Check the robot's current joint configuration and an out-of-range one."""

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

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

        # ==================== Run Skill ============================================
        current_joint_positions = robot.get_joint_positions()
        logger.success(
            f"Current joint positions within limits: "
            f"{robot.in_joint_limits(q=current_joint_positions, verbose=True)}"
        )

        out_of_range = robot.joint_limits[:, 1] + 10.0  # 10 deg past every upper limit
        logger.info(
            f"Configuration past the upper limits within limits: "
            f"{robot.in_joint_limits(q=out_of_range, verbose=True)}"
        )
    except (ConnectionError, OSError, RuntimeError, TypeError, ValueError) as e:
        logger.error(f"Error occurred: {e}")
    finally:
        robot.disconnect()
        robot.shutdown()


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Check whether joint configurations lie within limits")
    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 in_joint_limits.py
bash
python in_joint_limits.py --prim_path /World/ur10e
bash
python in_joint_limits.py --ip 192.168.1.100

For all options:

bash
python in_joint_limits.py --help

Parameter Configuration

ParameterTypeDefaultDescription
qnp.ndarray-1D joint configuration in degrees. Length must match the number of joints on the robot.
verboseboolFalseIf True, log a warning for each joint value that violates its limit.

Returns

TypeDescription
boolTrue if every joint value is strictly inside its configured [lower, upper] bounds, False otherwise.

Raises

ExceptionCondition
ValueErrorq is not a 1D vector, or its length does not match the number of configured joints

How to Tune the Parameters

in_joint_limits returns True only when every value in q is strictly between its configured bounds (lower < q < upper) - a value exactly at the lower or upper bound is reported as out-of-limit, so the check errs on the side of rejecting configurations right at the edge of the motion envelope.

Set verbose=True when diagnosing why an IK solution or planned waypoint is being rejected: it logs a warning per offending joint with its name, index, and configured lower/upper bound, rather than just the aggregate bool.

Where to Use the Skill

  • Pre-flight validation - Reject joint targets that would violate the configured limits before sending them to the controller
  • IK post-processing - Filter IK solutions to keep only configurations inside the joint envelope
  • Motion planning - Validate sampled or interpolated waypoints during planning
  • Diagnostics - Use verbose=True to surface which joint is the offender when a target is rejected

When Not to Use the Skill

Do not use In Joint Limits when: