55import math
66from time import sleep as _sleep
77
8+
89class UniversalRobots (SCT , Commands ):
910 def _check_rtde (self ):
1011 try :
@@ -33,12 +34,12 @@ def __init__(self, ip: str, port: int | tuple[int, int] = 30_002):
3334 self ._check_rtde ()
3435 super ().__init__ (ip , port )
3536 self .JOINT_RANGES = [
36- (- math .pi , math .pi ),
37- (- math .pi , math .pi ),
38- (- math .pi , math .pi ),
39- (- math .pi , math .pi ),
40- (- math .pi , math .pi ),
41- (- math .pi , math .pi ),
37+ (- 2 * math .pi , 2 * math .pi ),
38+ (- 2 * math .pi , 2 * math .pi ),
39+ (- 2 * math .pi , 2 * math .pi ),
40+ (- 2 * math .pi , 2 * math .pi ),
41+ (- 2 * math .pi , 2 * math .pi ),
42+ (- 2 * math .pi , 2 * math .pi ),
4243 ]
4344 self .DOF = len (self .JOINT_RANGES )
4445 # Source: https://forum.universal-robots.com/t/maximum-axis-speed-acceleration/13338/2
@@ -49,6 +50,7 @@ def __init__(self, ip: str, port: int | tuple[int, int] = 30_002):
4950 def connect (self ):
5051 super ().connect ()
5152 from .protocols .rtde import RTDE
53+
5254 self .rtde = RTDE (self .ip ) # Initialize RTDE connection
5355
5456 def disconnect (self ):
@@ -156,12 +158,6 @@ def move_cartesian(
156158 "Robot pose must have 6 elements: [x, y, z, rx, ry, rz]"
157159 )
158160
159- for p in pose [3 :]:
160- if not (0 <= p <= math .pi * 2 ):
161- raise ValueError (
162- f"Joint position { p } out of range: 0 ~ { math .pi * 2 } "
163- )
164-
165161 # if self.send_command("is_within_safety_limits({})\n".format(','.join(map(str, pose)))) == "False":
166162 # raise ValueError("Cartesian position out of safety limits")
167163
0 commit comments