## 3 Offline Optimization and Adaptation Under Nonlinear Task Constraints
### Optimization and Adaptation Procedure
#### 3.3.2 Adaptation Procedure
(**a**) Typical modulation cases for specific timesteps. The left, middle, and right columns denote the robot init positions, modulation process, and modulated positions. We utilize ellipsoids to envelop the task objects and robot gripper. (**b**) One episode execution snapshots when the robot selects the skill of moving above around the obstacle with 0.2 s intervals for each adjacement timestep. We conduct 10 dynamic experiments for each of the three skills by randomly placing and changing the objects, including obstacles and emergency stop, in real-time to evaluate the robot movement adaptation competence; the results are shown in Figure 8. Considering space restrictions, we select typical modulation cases for specific timesteps, as shown in Figure 8a, and choose one episode of moving above around the obstacle with snapshots, as shown in Figure 8b. During the above experiments, considering the detected minimum distance \(\|\mathbf{d}_{0}\|\) for the robot, link1 to link6 are always larger than the safety margin \(\mathbf{d}_{m}=10\) mm (see Figure 3), null-space velocity control for the robot non-end-effector is not required, and we only denote end-effector modulation, as shown in Figure 8a. The left, middle, and right columns denote the robot init positions, modulation process, and modulated positions, respectively. In the first row, the human suddenly moves a big bottle towards the robot end-effector with relative X and Y linear velocities \(\left(\mathbf{\dot{\xi}}_{1}^{L}\right)_{x}=2.22\) mm/s, \(\left(\mathbf{\dot{\xi}}_{1}^{L}\right)_{y}=117.13\) mm/s, the distance functions for the big bottle \(\Gamma_{1}(\mathbf{\dot{\xi}}_{1})=1.6613\) and blue painting \(\Gamma_{2}(\mathbf{\dot{\xi}}_{2})=9.6395\) are derived. As \(\Gamma_{2}(\mathbf{\dot{\xi}}_{2})=9.6395>4\), we ignore the influence of the blue painting, and the robot only modulates in response to the big bottle. We define the weight term \(\mathbf{w}_{1}^{\text{rel}}\) to smooth the distance influence and obtain the weighted relative velocity \(\mathbf{\dot{\xi}}_{\text{all}}\) from Equation (45); the direction coincides with the normal vector \(\mathbf{n}(\mathbf{\dot{\xi}}_{1})\). Given the init velocity \(\mathbf{\dot{\xi}}_{\text{init}}\), we compute the diagonal eigenvalue matrix \(\mathbf{D}(\mathbf{\dot{\xi}}_{1})\) and the basis matrix \(E(\mathbf{\dot{\xi}}_{1})\) to formulate the modulation matrix \(\mathbf{M}(\mathbf{\dot{\xi}}_{1})\). The modulated velocity \(\mathbf{\dot{\xi}}_{\text{mod}}\) is then computed from Equation (46) with one single obstacle. We apply velocity integration to obtain the expected position for the next timestep, generalize new trajectory sets \(\left\{\mathbf{\dot{\xi}}_{\text{next}}\right\}\) (see Section 2.1) at the current position, and compute the next velocity \(\mathbf{\dot{\xi}}_{\text{next}}\) with position differencing, treating this as the initial velocity for subsequent modulation. After modulation, we discover that there is an evident backward movement for the robot in the right column. In the second row, the init robot position after the last timestep modulation will collide with the big bottle, and the robot is subject to the combined effects of multiple obstacles. Distinct from [31], in this paper, if the robot init position will collide, we develop the method by iteratively modulating positions until they are collision-free. Specifically, to ensure the impenetrability of obstacles, we set the big bottle and blue painting distance function \(\Gamma_{1}(\mathbf{\dot{\xi}}_{1})=1.001,\Gamma_{2}(\mathbf{\dot{\xi}}_{2})=2.4987\) with the distance weights derived from Equation (44) as \(\mathbf{w}_{1}(\mathbf{\dot{\xi}}_{1})=0.9993,\mathbf{w}_{2}(\mathbf{\dot{\xi}}_{2})=0.0007\).