## Appendix A Cartesian Dynamic Movement Primitives--CDMPs  
Cartesian space Dynamic Movement Primitive (CDMP) separately provide the position and orientation trajectories. The positions are specified in the same way as in, for example, joint space DMPs [43]. The orientations are specified by unit quaternions and therefore require different parameter computation and integration.  
A CDMP does not directly depend on time. The phase system provides indirect time dependency and synchronization of position and orientation degrees of freedom along the trajectory. The phase system is defined with  
\[\dot{x}=-\alpha_{x}x, \tag{1}\]  
where \(x\) is the phase that starts at 1 and converges to 0 as the trajectory goal is reached. \(\alpha_{x}\) is a positive constant.  
The positions \(\mathbf{p}\) and orientations \(\mathbf{\Phi}\) are specified by  
\[\
u(x)\dot{z} = \alpha_{z}(\beta_{z}(\mathbf{g}^{p}-\mathbf{p})-\mathbf{z})+\mathbf{f}_{p}(x), \tag{2}\] \[\dot{\mathbf{p}} = \mathbf{z},\] (3) \[\dot{\mathbf{\eta}} = \alpha_{z}(\beta_{z}2\log\left(\mathbf{g}^{o}*\mathbf{\Phi}\right)-\mathbf{ \eta})+f_{o}(x),\] (4) \[\dot{\mathbf{\Phi}} = \frac{1}{2}\mathbf{\eta}*\mathbf{\Phi}, \tag{5}\]where \(g^{p}\in\mathbb{R}^{3}\) is the goal position and \(g^{o}\in\mathbb{R}^{4}\) the goal orientation of the movement. The orientation is in the form of unit quaternion \(\mathbf{\Phi}\in\mathbb{R}^{4}\). The parameters \(\mathbf{z},\ \mathbf{\eta}\in\mathbb{R}^{3}\) denote the scaled linear and angular velocity (\(\mathbf{z}=\
u(x)\dot{\mathbf{p}}\), \(\mathbf{\eta}=\
u(x)\mathbf{\omega}\)). Additional details on quaternion operations, such as product \(*\), conjugation \(\overline{\mathbf{\Phi}}\), and the quaternion logarithm \(\log(\mathbf{\Phi})\), see in [42]. The so-called forcing terms \(\mathbf{f}_{p}\), \(\mathbf{f}_{o}:\mathbb{R}\to\mathbb{R}^{3}\) are given with  
\[\mathbf{f}_{p}(x) = \mathbf{D}_{p}\frac{\sum_{i=1}^{N}\mathbf{w}_{i}^{p}\Psi_{i}(x)}{\sum_{i= 1}^{N}\Psi_{i}(x)}x, \tag{11}\] \[\mathbf{f}_{o}(x) = \mathbf{D}_{o}\frac{\sum_{i=1}^{N}\mathbf{w}_{i}^{p}\Psi_{i}(x)}{\sum_{i= 1}^{N}\Psi_{i}(x)}x. \tag{12}\]  
where the weights \(\mathbf{w}_{i}^{p}\), \(\mathbf{w}_{i}^{o}\in\mathbb{R}^{3}\), \(i=1,\dots,N\), encode the positions and orientations, respectively, and \(N\) is the number of radial basis functions. The weights have to be learned, for example, directly from an input Cartesian trajectory \(\{\mathbf{p}_{k}\), \(\mathbf{\Phi}_{k}\), \(\dot{\mathbf{p}}_{k}\), \(\mathbf{\omega}_{k}\), \(\dot{\mathbf{p}}_{k}\), \(\dot{\mathbf{\omega}}_{k}\), \(t_{k}\}_{k=0}^{K}\). For \(\mathbf{D}_{p}\), \(\mathbf{D}_{o}\in\mathbb{R}^{3\times 3}\), we can use \(\mathbf{I}\), see in [42] for further possibilities. The forcing terms are composed from a linear combination of nonlinear radial basis functions (RBF) \(\Psi_{i}\)  
\[\Psi_{i}(x)=\exp\Bigl{(}-h_{i}(x-c_{i})^{2}\Bigr{)}. \tag{13}\]  
The RBF are centered at \(c_{i}=\exp\Bigl{(}-\alpha_{x}\frac{i-1}{N-1}\Bigr{)}\), while their width is \(h_{i}=\frac{1}{(c_{i+1}-c_{i})^{2}}\), \(i=1,\dots,N\), \(h_{N}=h_{N-1}\)[9]. The goal position and orientation are usually set to the final position and orientation on the desired trajectory, i.e., \(g^{p}=\mathbf{p}_{t_{K}}\) and \(g^{o}=\mathbf{\Phi}_{t_{K}}\). For more details and auxiliary math see in [42].