Is Joints Within Safety Limits
SUMMARY
Is Joints Within Safety Limits checks a joint configuration vector against the robot's active safety configuration and returns True if all joints are within their permitted ranges.
UNITS
Input joint configuration q in degrees. Returns a boolean.
The Skill
python
within_limits = robot.is_joints_within_safety_limits(q)The Code
Example: Check Whether a Joint Configuration Is Within Safety Limits
Verify that a computed joint configuration is safe before commanding motion.
python
"""
Checks joint limits, safety plane limits, and TCP orientation deviation limits for a joint configuration.
Supports Universal Robots (UR).
Usage:
python is_joints_within_safety_limits.py [--ip <ROBOT_IP>]
"""
import argparse
from loguru import logger
from telekinesis.synapse.robots.manipulators import universal_robots
def main(ip: str | None) -> None:
"""Check the robot's current joint configuration against the controller's safety limits."""
#===================== Create Robot ==========================================
robot = universal_robots.UniversalRobotsUR10E(name='UR10e')
try:
#===================== Connect Robot ==========================================
if ip:
robot.connect(ip=ip)
# ==================== Run Skill ============================================
current_joint_positions = robot.get_joint_positions()
logger.success(
f"is_joints_within_safety_limits({current_joint_positions}): "
f"{robot.is_joints_within_safety_limits(current_joint_positions)}"
)
except (ConnectionError, OSError) as e:
logger.error(f"Error occurred: {e}")
finally:
robot.disconnect()
robot.shutdown()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Check joint configuration against safety limits Synapse example")
parser.add_argument("--ip", type=str, default=None,
help="UR robot IP address for real hardware, e.g. 192.168.1.100")
args = parser.parse_args()
main(ip=args.ip)Running the Example
bash
python is_joints_within_safety_limits.py --ip 192.168.1.100For all options:
bash
python is_joints_within_safety_limits.py --helpParameter Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
q | list[float] | - | Joint configuration in degrees to check, one value per joint. |
Returns
| Field | Type | Description |
|---|---|---|
within_limits | bool | True if all joints are within safety limits, False otherwise. |
Raises
| Exception | Condition |
|---|---|
RuntimeError | The robot is not connected (connect() was not called, or the connection has been lost) |
TypeError | q is not a list or np.ndarray |
Where to Use the Skill
- Validate IK solutions before commanding motion.
- Pre-flight checks for joint-space waypoints in a trajectory.
When Not to Use the Skill
Use a different skill when:
- You have a Cartesian target instead of a joint configuration - use Is Pose Within Safety Limits instead.