# Connection and Initialization ## Constructor ```python URCtrl( robot_ip="10.170.10.56", arm_name="Arm", instance_name="Ctrl", logger=None, log_level=None, config=None, ) ``` On initialization, `URCtrl` connects SDU Robotics `ur_rtde` RTDEControl, RTDEReceive, and RTDEIO. Dashboard is connected only when enabled in the configuration. ## config Representative configuration settings are listed below. | Setting | Meaning | |---|---| | `ROBOT_IP` / `UR_IP` | UR controller IP address | | `ROBOT_VAR_FILE` / `UR_VAR_FILE` | Virtual-variable storage file | | `UR_USE_DASHBOARD` | Enable DashboardClient | | `UR_MAX_LINEAR_SPEED` | Maximum linear speed | | `UR_MAX_LINEAR_ACCELERATION` | Maximum linear acceleration | | `UR_MAX_JOINT_SPEED` | Maximum joint speed | | `UR_MAX_JOINT_ACCELERATION` | Maximum joint acceleration | | `UR_DEFAULT_BLEND_RADIUS` | Blend radius for `@P` | | `UR_ALLOW_RESTART_SAFETY` | Allow safety restart | ## Dashboard `turn_on_motor()`, `turn_off_motor()`, and some `reset_error()` operations require Dashboard. ```python class Config: ROBOT_IP = "10.170.10.56" UR_USE_DASHBOARD = True robot = URCtrl(config=Config) ``` Without Dashboard, these operations return `False` and record the reason in the error information. ## connect() ```python robot.connect() ``` Connect SDU Robotics `ur_rtde` `RTDEControlInterface`, `RTDEReceiveInterface`, and `RTDEIOInterface`. ## disconnect() ```python robot.disconnect() ``` Save virtual variables, then disconnect Dashboard, RTDEIO, RTDEReceive, and RTDEControl in that order. ## Context Manager (`with`) ```python with URCtrl(ROBOT_IP) as robot: ... ``` Using `with` calls `disconnect()` when leaving the context.