# Quick Start ## Minimal connection ```python from ur.ur_ctrl import UrCtrl ROBOT_IP = "10.170.10.56" with UrCtrl(ROBOT_IP) as robot: print(robot.current_position) ``` `URCtrl` starts connecting in its constructor. Using a `with` statement calls `disconnect()` on exit. ## Current position and joint angles ```python with URCtrl(ROBOT_IP) as robot: p = robot.current_position j = robot.current_angle print("P =", p) print("J =", j) ``` `current_position` returns P coordinates in mm / degree rotation-vector representation. `current_angle` returns J coordinates in degrees. ## Move Z +10 mm from the current position ```python from ur.ur_ctrl import UrCtrl, MotionMode with UrCtrl(ROBOT_IP) as robot: current = robot.current_position if current is not False: target = list(current) target[2] += 10.0 robot.move( target, motion_mode=MotionMode.LINE, speed=20, accel=20, is_async=False, ) ``` ## Create taught point P1 ```python with URCtrl(ROBOT_IP) as robot: robot.teach("P1") print(robot.P1) ``` `P1` is not stored inside the UR Controller. `RobotVarManager` saves it to JSON. ## Move to P1 ```python with URCtrl(ROBOT_IP) as robot: robot.move("P1", motion_mode=MotionMode.PTP, speed=30, accel=30) ``` When moving to a P pose using PTP, `moveJ_IK()` is used internally. ## Move to P1 using LINE ```python with URCtrl(ROBOT_IP) as robot: robot.move("P1", motion_mode=MotionMode.LINE, speed=20, accel=20) ``` `moveL()` is used internally. ## Set IO outputs ```python with URCtrl(ROBOT_IP) as robot: robot.set_IO(0, True) robot.set_IO(0, False) ``` ## Inspect errors ```python with URCtrl(ROBOT_IP) as robot: ok = robot.move("P999") if not ok: print(robot.error_code) print(robot.error_description) print(robot.get_current_error_info()) ```