# Chapter 8: moveJ ## About This Chapter The `moveJ()` method discussed in this chapter is a PC-side motion API provided by the SDU Robotics `RTDEControlInterface`. On the robot side, it is connected to the URScript `movej` command through the control URScript. It is one of the most fundamental motion APIs for joint movements. It is used in nearly every program, including movements between taught points and movements to retreat positions. This chapter explains: - The `moveJ` algorithm - Parameters - Internal behavior - Speed - Acceleration - Blending - Return values - Precautions --- # 8.1 What Is moveJ? The `moveJ()` method in this chapter belongs to the SDU Robotics `ur_rtde` API. This does not mean that a `moveJ` command is defined in the official Universal Robots RTDE protocol. The J in `moveJ` stands for: Joint In other words, it is **a command that moves the robot to target joint angles**. Instead of specifying a TCP position, it specifies the angles of all six axes: ``` q1 q2 q3 q4 q5 q6 ``` The robot moves toward these target angles. --- # 8.2 Illustration of the Motion For example: ``` Start Joint 0° 30° 10° ... ↓ End Joint 90° 10° -30° ... ``` Each axis moves simultaneously, eventually reaching its target angle. The TCP trajectory along the way is not guaranteed. --- # 8.3 How Does the TCP Move? The TCP follows a curved path, for example: ``` Start ○ ↓ ) ↓ ○ End ``` Consequently, `moveJ` is not suitable for operations such as: - Machining - Measurement - Laser processing --- # 8.4 Applications `moveJ` is suitable for: - Moving to the home position - Retreating - Moving between taught points - Changing orientation - High-speed movement - Movement through spaces with few obstacles --- # 8.5 Arguments Typical API usage: ```python moveJ( q, speed=1.05, acceleration=1.4, asynchronous=False ) ``` --- # 8.6 q The target joint angles. Example: ```python q = [ 0.0, -1.57, 1.57, 0.0, 1.57, 0.0, ] ``` The unit is: ``` rad ``` Not degrees. --- # 8.7 speed Joint speed. Unit: ``` rad/s ``` Example: ```python speed=0.5 ``` This is the **target speed**, not a safety speed limit. The controller may impose its own limits. --- # 8.8 acceleration Acceleration. Unit: ``` rad/s² ``` Example: ```python acceleration=1.2 ``` Excessive acceleration increases vibration and mechanical shock. --- # 8.9 asynchronous ``` False ↓ Synchronous True ↓ Asynchronous ``` Synchronous execution: ``` moveJ() ↓ Motion completes ↓ return ``` Asynchronous execution: ``` moveJ() ↓ return ↓ Robot moves ``` --- # 8.10 Return Value Normally, the method returns: ``` True ``` for success, or: ``` False ``` for failure. However, a communication disconnection, Protective Stop, or similar condition may result in a `RuntimeError`. --- # 8.11 Blend Radius A blend radius can be specified for `moveJ`. Instead of: ``` ○ ↓ Stop ↓ ○ ``` The movements can be joined smoothly: ``` ○ ╲ ╱ ○ ``` This reduces time spent stopping. --- # 8.12 Determining Arrival It is safer to determine completion of a `moveJ` motion from the difference between the current and target positions, rather than simply from whether the API call has returned. Example: ``` Current joint angles ↓ Difference from target joint angles ↓ 1e-3 rad or less ↓ Complete ``` --- # 8.13 Joint Limits `moveJ` cannot move to a configuration that exceeds the joint limits. The joint ranges are checked before inverse kinematics becomes relevant. --- # 8.14 Collision Detection If any of the following occurs during motion: - Protective Stop - Safety Stop - Emergency Stop `moveJ` does not complete normally. Therefore, handle errors as follows: ```python try: ok = rtde_c.moveJ(q) except RuntimeError: ... ``` --- # 8.15 Advantages of moveJ - Fast - Stable - Does not require inverse kinematics - Low CPU overhead - Suitable for moving between taught points --- # 8.16 Disadvantages of moveJ - Does not guarantee the TCP trajectory - Unsuitable for machining - Does not avoid obstacles - Does not allow intermediate orientations to be specified --- # 8.17 Comparison with moveL | Item | moveJ | moveL | |---|---|---| | Interpolation | Joint | TCP | | Speed | Fast | Slow | | TCP trajectory | Not guaranteed | Straight line | | Machining | × | ○ | | Retreat | ○ | △ | | Teaching | ◎ | ○ | --- # 8.18 Recommended Usage A typical sequence combines the commands as follows: ``` Home ↓ moveJ ↓ Near the target ↓ moveJ ↓ Machining start position ↓ moveL ↓ Machining ↓ moveL ↓ Retreat ↓ moveJ ``` Many industrial robot programs use this structure. --- # Summary `moveJ` is one of the most fundamental motion commands for UR robots. Because it interpolates in joint space, it is fast and stable, making it well suited to retreat motions and orientation changes. However, because the TCP trajectory is not guaranteed, `moveL` should be used for machining and measurement. The next chapter explains `moveL` in detail.