## 3 Offline Optimization and Adaptation Under Nonlinear Task Constraints
### Optimization and Adaptation Procedure
#### 3.3.2 Adaptation Procedure
Considering the impenetrability of the \(O\) obstacles and that the influence from other obstacles vanishes when approaching one obstacle boundary, we set the weight inversely proportional to the distance measure \((\Gamma(\xi_{k})-1)\) as follows:

\[\mathbf{w}_{k}(\xi_{k})=\prod_{k=1,k\
eq i}^{O}\frac{(\Gamma(\xi_{k})-1)}{(\Gamma( \xi_{k})-1)+(\Gamma(\xi_{i})-1)} \tag{44}\]Given Equations (33) and (37), to integrate \(O\) obstacles, for simplicity, we first compute the weighted mean of the relative velocity induced by the obstacle motion as follows:

\[\dot{\xi}_{\text{all}}=\sum_{k=1}^{O}\exp\left(-\frac{1}{\rho_{k}}(\Gamma(\xi_{k })-1)\right)\mathbf{w}_{k}(\xi_{k})\Big{(}\dot{\xi}_{k}^{L}+\dot{\xi}_{k}^{R}\times \big{(}\dot{\xi}_{k}/\eta_{k}\big{)}\Big{)} \tag{45}\]

where we add the weight term \(\mathbf{w}_{k}^{\text{rel}}=\exp\left(-\frac{1}{\rho_{k}}(\Gamma(\xi_{k})-1)\right)\) to smooth the distance influence. In this paper, the combined weighted mean of \(\mathbf{f}(\xi_{k})\) refers to the init velocity \(\dot{\xi}_{\text{init}}\) computed from the offline task execution trajectory (see Section 3.3.2) with position differencing. To be specific, \(\dot{\xi}_{\text{init}}\) is a nonlinear function of \(\xi\), which can be computed from the trajectory generalization method presented in Section 2.1 given the current position \(\xi\). We further simplify Equation (37) as follows:

\[\dot{\xi}_{\text{mod}}= M\big{(}\dot{\xi}_{\text{all}}\big{(}\dot{\xi}_{\text{init}}- \dot{\xi}_{\text{all}}\big{)}+\dot{\xi}_{\text{all}} \tag{46}\] \[= \mathbf{q}\big{(}\dot{\xi}\big{)}_{\text{all}}\|\mathbf{Q}\big{(}\dot{\xi} \big{)}\|_{\text{all}}+\dot{\xi}_{\text{all}}\]

where \(\|\mathbf{Q}\big{(}\dot{\xi}\big{)}\|_{\text{all}}\) and \(\mathbf{q}\big{(}\dot{\xi}\big{)}_{\text{all}}\) represent the combined magnitude and direction of \(\mathbf{M}\big{(}\dot{\xi}\big{)}_{\text{all}}\big{(}\dot{\xi}_{\text{init}}- \dot{\xi}_{\text{all}}\big{)}\). For the magnitude, given separate equivalent magnitude \(\|\mathbf{Q}\big{(}\dot{\xi}\big{)}\|_{k}\) for each obstacle from Equation (37) and the weight in Equation (44), we can obtain:

\[\|\mathbf{Q}\big{(}\dot{\xi}\big{)}\|_{\text{all}}=\sum_{k=1}^{O}\mathbf{w}_{k}(\xi_{ k})\|\mathbf{Q}\big{(}\dot{\xi}\big{)}\|_{k} \tag{47}\]

where \(\|\mathbf{Q}\big{(}\dot{\xi}\big{)}\|_{k}\) is obtained from Equation (37):

\[M(\xi_{k})\Big{(}\mathbf{f}(\xi_{k})-\dot{\xi}_{k}\Big{)}=\mathbf{q}\big{(}\dot{\xi} \big{)}_{k}\|\mathbf{Q}\big{(}\dot{\xi}\big{)}\|_{k} \tag{48}\]

Concerning the combined directions, given each equivalent directions \(\mathbf{q}\big{(}\dot{\xi}\big{)}_{k}\), as [31], we define the function \(\mathbf{\kappa}\in\mathbb{R}^{2}\) to project the 3D original space onto a 2D hyper-sphere \(\mathbf{\kappa}\) space with radius \(\pi\) as follows:

\[\mathbf{\kappa}\Big{(}\dot{\xi}_{k},\dot{\xi}\Big{)}=\arccos\left(\dot{\theta}_{1 }^{\dot{\xi}_{k}}\right)\left[\frac{\dot{\mathbf{q}}_{2}^{\dot{\xi}_{k}}}{\dot{ \mathbf{q}}_{2}^{\dot{\xi}_{k}}+\dot{\xi}_{3}^{\dot{\xi}_{k}}},\dot{\mathbf{q}}_{2}^{ \dot{\xi}_{k}}=\mathbf{R}_{f}^{T}\mathbf{q}\big{(}\dot{\xi}\big{)}_{k}\right. \tag{49}\]

Figure 2: Dynamic system modulation for robot end-effector.