# Chapter 10: speedJ and speedL ## About This Chapter The `moveJ` and `moveL` commands discussed so far instruct the robot to move to a target position. By contrast, `speedJ` and `speedL` are commands for moving at a specified velocity. They are used for joystick operation, visual servoing, tracking control, and similar applications. --- # 10.1 Differences from Move Commands `moveJ`: ```text Target position ↓ Controller generates trajectory ↓ Stop ``` `speedJ`: ```text Target velocity ↓ Maintain velocity ↓ Continue moving until a stop command ``` This is the most important difference. --- # 10.2 What Is speedJ? `speedJ` specifies joint velocities. It specifies the velocity of each of the six axes. Example: ```python qd = [ 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, ] rtde_c.speedJ(qd, 1.0, 2.0) ``` --- # 10.3 Arguments ```python speedJ( qd, acceleration, time ) ``` | Argument | Description | |----------|-------------| | `qd` | Joint velocities | | `acceleration` | Acceleration | | `time` | Execution time | --- # 10.4 qd Joint velocities: ```text [ dq1, dq2, dq3, dq4, dq5, dq6 ] ``` Unit: ```text rad/s ``` --- # 10.5 time For example, a value of: ```text 2.0 ``` maintains the specified velocity for two seconds. Some implementations also use a value of `0`. However, the handling of execution duration depends on the `ur_rtde` version, so check the API for the version in use. --- # 10.6 speedL `speedL` specifies the TCP velocity: ```python [ vx, vy, vz, wx, wy, wz ] ``` Units: ```text m/s rad/s ``` --- # 10.7 speedL Example ```python speed = [ 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, ] rtde_c.speedL(speed,0.5,2.0) ``` The TCP moves in the X direction at `0.1 m/s`. --- # 10.8 speedStop Unlike Move commands, velocity control does not stop automatically. At the end of the operation, call: ```python rtde_c.speedStop() ``` Alternatively, use: ```python stopJ() stopL() ``` --- # 10.9 Characteristics of Velocity Control Move commands: ```text Position control ``` Speed commands: ```text Velocity control ``` The final position is not guaranteed. --- # 10.10 Applications Joystick: ```text Joystick ↓ Velocity ↓ speedJ ``` Visual tracking: ```text Camera ↓ Velocity calculation ↓ speedL ``` Force control: ```text Force ↓ PID ↓ speedL ``` These are typical examples. --- # 10.11 Comparison with Move Commands | Item | moveJ | speedJ | |------|-------|--------| | Input | Position | Velocity | | Termination | Automatic | Stop command | | Application | Teaching | Real-time control | | Item | moveL | speedL | |------|-------|--------| | Input | Pose | TCP velocity | | Termination | Automatic | Stop command | | Application | Processing | Tracking control | --- # 10.12 Common Mistakes If you execute only: ```python speedJ(...) ``` as though it were a Move command, the robot may continue moving until a stop command is sent. For real-time control, always design the complete stopping sequence. --- # 10.13 Design in ur_ctrl.py For general applications, it is convenient to expose high-level APIs such as: ```python speed_j() speed_l() stop_motion() ``` It is recommended to use velocity commands together with corresponding stop commands. --- # Summary `speedJ` and `speedL` are APIs for controlling velocity rather than position. They are more important than Move commands for joystick operation and real-time tracking control. On the other hand, `moveJ` and `moveL` are used more frequently for ordinary teaching and automatic operation. The next chapter explains `servoJ` and `servoL`.