## 3 Offline Optimization and Adaptation Under Nonlinear Task Constraints
### Optimization and Adaptation Procedure
#### 3.3.2 Adaptation Procedure
We weight the joint velocity vectors from Equations (60) and (62) to obtain the combined joint velocity vector \(\mathbf{\delta_{\mathbf{\
u}}}^{*}\) as follows:

\[\mathbf{\delta_{\mathbf{\
u}}}^{*}=\gamma\Big{(}\mathbf{N}^{T}\mathbf{N}+\lambda\mathbf{N}^{T}\bm {\Sigma}_{q_{\mathbf{\
u}}}^{-1}\mathbf{N}\Big{)}^{-1}\mathbf{N}^{T}\Big{(}\mathbf{\mu}_{q_{ \mathbf{\
u}}}-\mathbf{J}^{\#}\mathbf{x}_{\mathbf{\
u}}\Big{)}+\rho\big{(}\mathbf{J}_{0}\mathbf{N} \big{)}^{\#}\Big{(}\mathbf{x}_{\mathbf{\
u}}^{0}-\mathbf{J}_{0}\mathbf{J}^{\#}\mathbf{x}_{\mathbf{\
u}} \Big{)} \tag{63}\]

Taking \(\mathbf{\dot{q}}\) and \(\mathbf{\dot{x}}\) as control variables and substituting Equation (63) to \(\mathbf{\dot{q}}=\mathbf{J}^{\#}\mathbf{\dot{x}}+\mathbf{N}\mathbf{\delta_{\mathbf{\
u}}}^{*}\), we obtain:

\[\mathbf{\dot{q}}=\mathbf{J}^{\#}\mathbf{\dot{x}}+\gamma\mathbf{N}\Big{(}\mathbf{N}^{T}\mathbf{N}+ \lambda\mathbf{N}^{T}\mathbf{\Sigma}_{q_{\mathbf{\
u}}}^{-1}\mathbf{N}\Big{)}^{-1}\mathbf{N}^{T} \Big{(}\mathbf{\mu}_{q_{\mathbf{\
u}}}-\mathbf{J}^{\#}\mathbf{x}_{\mathbf{\
u}}\Big{)}+\rho\mathbf{N} \big{(}\mathbf{J}_{0}\mathbf{N}\big{)}^{\#}\Big{(}\mathbf{x}_{\mathbf{\
u}}^{0}-\mathbf{J}_{0}\mathbf{ J}^{\#}\mathbf{x}_{\mathbf{\
u}}\Big{)} \tag{64}\]

Due to the idempotent and hermitian nature of \(\mathbf{N}=\mathbf{I}-\mathbf{J}^{+}\mathbf{J}\) in Equation (55), that is, \((\mathbf{J}_{0}\mathbf{N})^{\#}=\mathbf{N}(\mathbf{J}_{0}\mathbf{N})^{\#}\), we simplify Equation (64) as follows:

\[\mathbf{\dot{q}}=\mathbf{J}^{\#}\mathbf{\dot{x}}+\gamma\mathbf{N}\Big{(}\mathbf{N}^{T}\mathbf{N}+ \lambda\mathbf{N}^{T}\mathbf{\Sigma}_{q_{\mathbf{\
u}}}^{-1}\mathbf{N}\Big{)}^{-1}\mathbf{N}^{T} \Big{(}\mathbf{\mu}_{q_{\mathbf{\
u}}}-\mathbf{J}^{\#}\mathbf{x}_{\mathbf{\
u}}\Big{)}+\rho\big{(} \mathbf{J}_{0}\mathbf{N}\big{)}^{\#}\Big{(}\mathbf{x}_{\mathbf{\
u}}^{0}-\mathbf{J}_{0}\mathbf{J}^{\#} \mathbf{x}_{\mathbf{\
u}}\Big{)} \tag{65}\]

Given the expected end-effector velocity \(\mathbf{x}_{\mathbf{\
u}}\), we can utilize Equation (65) to design a feedback controller for non-end-effector adaptation. In this context, \(\mathbf{J}^{\#}\mathbf{\dot{x}}\) is used to track \(\mathbf{x}_{\mathbf{\
u}}\), \(\mathbf{J}_{0}\mathbf{J}^{\#}\mathbf{x}_{\mathbf{\
u}}\) denote the point \(C_{0}\) velocity attributed to \(\mathbf{x}_{\mathbf{\
u}}\), and \((\mathbf{J}_{0}\mathbf{N})^{\#}\) is used to transform the Cartesian velocity \(\mathbf{x}_{\mathbf{\
u}}^{0}-\mathbf{J}_{0}\mathbf{J}^{\#}\mathbf{x}_{\mathbf{\
u}}\) into the joint velocity. In this paper, considering the manipulator redundancy is 1, less than 3, we define the direction of \(\mathbf{x}_{\mathbf{\
u}}^{0}\) the same as vector \(\mathbf{d}_{0}\) as \(\mathbf{x}_{\mathbf{\
u}}^{0}=\mathbf{v}_{0}\mathbf{n}_{0},\mathbf{n}_{0}=\frac{\mathbf{d}_{0}}{|\mathbf{d} _{0}|^{2}}\), where \(\mathbf{n}_{0}\) is the unit vector of \(\mathbf{d}_{0}\), and \(\mathbf{v}_{0}\) is a scalar velocity. To obtain smooth and flexible motion for obstacle avoidance, we define \(\mathbf{v}_{0}\) as in Equation (66),

Figure 3: Null-space velocity control for robot non-end-effector. where \(\mathbf{d}_{m}\) is the safety margin, and \(\mathbf{d}_{n}\) denotes the distance at which the obstacle begins to affect the manipulator to construct a smoothing factor \((1+\cos\Bigl{(}\pi\frac{\|\mathbf{d}_{0}\|-\mathbf{d}_{m}}{\mathbf{d}_{n}-\mathbf{d}_{m}}\Bigr{)})\). \[\begin{cases}v_{0}&=\lambda_{v}v_{n}\\ \lambda_{v}&= \begin{cases}\left(\frac{\mathbf{d}_{m}}{\|\mathbf{d}_{0}\|}\right)^{2}-1 &\text{if }\|\mathbf{d}_{0}\|<\mathbf{d}_{m}\\ \frac{1}{2}\Bigl{(}1+\cos\Bigl{(}\pi\frac{\|\mathbf{d}_{0}\|-\mathbf{d}_{m}}{\mathbf{d}_{n} -\mathbf{d}_{m}}\Bigr{)}\Bigr{)}\left(\left(\frac{\mathbf{d}_{m}}{\|\mathbf{d}_{0}\|} \right)^{2}-1\right)&\text{if }\mathbf{d}_{m}<\|\mathbf{d}_{0}\|<\mathbf{d}_{n}\\ 0&\text{if }\|\mathbf{d}_{0}\|\geqslant\mathbf{d}_{n}\end{cases}  \tag{66}\]

Let \(\mathbf{x}=T(\mathbf{q})\) denote the end effector pose obtained through the forward kinematics function \(T(.