# Chapter 4: RTDEControlInterface ## About This Chapter This chapter explains the motion-control APIs provided by `RTDEControlInterface` in SDU Robotics' `ur_rtde` library. This is the class most frequently used when controlling a UR robot from Python. By the end of this chapter, you will understand the differences among: - `moveJ` - `moveL` - `moveP` - `speedJ` - `speedL` - `servoJ` - `servoL` - Stop commands --- # 4.1 What Is RTDEControlInterface? `RTDEControlInterface` is a **PC-side motion-control interface** provided by SDU Robotics' `ur_rtde`. It is not a motion API belonging to Universal Robots' native RTDE protocol. For example, when you call: ```python rtde_c.moveJ(...) ``` The PC-side `RTDEControlInterface` uses registers in Universal Robots' official RTDE interface to pass commands and parameters to the controller. On the robot side, SDU's control URScript reads these values and executes the corresponding URScript motion command, such as `movej`. URControl executes that command and connects it to actual robot control. Thus, `RTDEControlInterface` does not directly invoke the Servo Controller through the official RTDE protocol. `RTDEReceiveInterface` handles state acquisition. --- # 4.2 Categories of Motion Commands Representative RTDEControl commands can be classified as follows. | Category | API | Purpose | |---|---|---| | Joint interpolation | moveJ | Most common motion | | Linear interpolation | moveL | Processing and measurement | | Circular interpolation | moveC | Circular trajectories | | Combined interpolation | moveP | Trajectories using blending | | Velocity control | speedJ | Joint velocity | | Velocity control | speedL | TCP velocity | | Servo control | servoJ | Real-time control | | Servo control | servoL | Real-time control | Understanding `moveJ` and `moveL` first is particularly important. --- # 4.3 moveJ `moveJ` means **Joint Move**. The robot moves toward specified **joint angles**. ```text Initial configuration ↓ All joints rotate simultaneously ↓ Target configuration ``` The intermediate TCP trajectory is not guaranteed. --- ## Arguments ```python moveJ( q, speed, acceleration, asynchronous ) ``` Example: ```python q = [ 0.0, -1.57, 1.57, 0.0, 1.57, 0.0, ] rtde_c.moveJ(q) ``` --- ## Advantages - Fast - Does not require inverse kinematics - Most stable - Suitable for moving between taught positions --- ## Disadvantages The TCP follows a curved trajectory. It is not suitable for machining operations. --- # 4.4 moveL `moveL` means **Linear Move**. The TCP moves along a **straight line**. ```text A ──────────── B ``` The TCP path is guaranteed. --- Applications: - Machining - Dispensing - Laser processing - Measurement - Pick and place --- ## Arguments ```python pose = [x,y,z,rx,ry,rz] ``` ```python rtde_c.moveL(pose) ``` Orientation is represented using a **Rodrigues vector**. --- # 4.5 Difference Between moveJ and moveL ```text moveJ TCP ○ ╲ ╱ ○ moveL TCP ○────────○ ``` `moveJ` performs joint interpolation. `moveL` performs TCP interpolation. --- # 4.6 moveP `moveP` means **Process Move**. It smoothly connects multiple points using **blending**. ```text ○────○────○ ↓ Smooth trajectory ``` Use it when you want to reduce the time spent stopping at intermediate points. --- # 4.7 Acceleration Both `moveJ` and `moveL` allow you to specify: ```python acceleration ``` Units are: ```text rad/s² or m/s² ``` The units depend on the API. --- # 4.8 Speed ```python speed ``` specifies the target speed. Even if you specify a large value, the controller automatically applies limits based on factors such as: - Safety restrictions - Payload - Joint limits --- # 4.9 Asynchronous Execution When you specify: ```python moveJ(..., asynchronous=True) ``` the function returns immediately without waiting for the motion to finish. ```text moveJ() ↓ Returns immediately ↓ Robot continues moving ``` With synchronous execution: ```text moveJ() ↓ Motion completes ↓ Returns ``` --- # 4.10 Stop Commands Representative stop commands include: ```python stopJ() ``` Stops joint motion. ```python stopL() ``` Stops TCP motion. These commands perform a **decelerated stop**, not an abrupt stop. They are different from an Emergency Stop. --- # 4.11 Return Values Commands such as `moveJ` and `moveL` normally return: ```python True ``` or: ```python False ``` `False` can indicate: - Communication failure - Control failure However, conditions such as a Protective Stop may also raise an exception. Therefore, you must handle exceptions as well as check return values. --- # 4.12 Recommended Pattern ```python try: ok = rtde_c.moveJ(q) if not ok: print("Move failed") except RuntimeError as e: print(e) ``` This pattern is recommended. --- # 4.13 Usage in ur_ctrl.py In this library, calls are automatically dispatched as follows: ```text move() ↓ moveJ() or moveL() ``` Users do not need to work with `RTDEControlInterface` directly. --- # Summary `RTDEControlInterface` is the class that sends motion commands to the robot. The most important commands are: - `moveJ` - `moveL` Understanding these two commands is enough to build most applications. The next chapter explains `RTDEReceiveInterface`.