## 2 Dynamic System Framework for Movement Generation
### Learning and Generalization Process of DMPs  
Learning the demonstrated movements and generalizing them to new situations is the ultimate goals of DMPs. According to the introduction of the DMPs model, the function of a nonlinear function term \(f(s)\) is to generate arbitrary complex movements while ensuring the shape of the demonstrated trajectory. Especially, the weight parameter \(\omega_{i}\) is the core factor which can be learned from a given trajectory during the DMPs' learning process. Given the displacement sequence \(x_{\text{demo}}(t)\) of a demonstration trajectory, where the corresponding time is \(t\in\{\Delta t,\;2\Delta t,\cdots,n\Delta t\}\) and \(\Delta t\) represents the step size, we can easily obtain the velocity sequence \(\dot{x}_{\text{demo}}(t)\) and the acceleration sequence \(\ddot{x}_{\text{demo}}(t)\). Rearranging Equation (1), integrating the initial position with \(x_{0}=x_{\text{demo}}(0)\) and final position with \(x_{g}=x_{\text{demo}}(n\Delta t)\), we can calculate the non-linear function sequence by  
\[f_{\text{demo}}(s)=\frac{\tau^{2}\ddot{x}_{\text{demo}}+D\tau\dot{x}_{\text{ demo}}}{K}-(x_{g}-x_{\text{demo}})+(x_{g}-x_{0})s. \tag{5}\]  
Additionally, considering the canonical system is integrable, the phase \(s\) can be calculated based on the constants \(\alpha\) and \(\tau\). Thus, the non-linear function sequence \(f_{\text{demo}}\) can be easily obtained. Furthermore, the learning problem can be transformed into the function approximation problem. The purpose of the DMPs learning framework is to determine the approximate weight parameter \(\omega_{i}\) in Equation (4) to make the values of \(f\) close to \(f_{\text{demo}}\). This problem can be addressed with the locally weighted regression, such as the least mean square method. Equation (4) can be converted to the form of a linear equation  
\[Tw=f\approx f_{\text{demo}}, \tag{6}\]  
where  
\[T=\left[ \begin{array}{ccc}\frac{\psi_{1}(s_{1})}{\sum_{i=1}^{N}\psi_{i}(s_{ i})}s_{1}&\cdots&\frac{\psi_{1}(s_{1})}{\sum_{i=1}^{N}\psi_{i}(s_{i})}s_{1}\\ \cdots&\cdots&\cdots\\ \frac{\psi_{1}(s_{n})}{\sum_{i=1}^{N}\psi_{i}(s_{i})}s_{n}&\cdots&\frac{\psi_ {N}(s_{n})}{\sum_{i=1}^{N}\psi_{i}(s_{i})}s_{n}\end{array} \right]\text{and} \tag{7}\]  
\[w=\left[ \begin{array}{ccc}w_{1}&\cdots&w_{N}\end{array} \right]^{T} \tag{8}\]  
Based on the minimum error criterion  
\[J=\sum_{s}{(f_{demo}(s)-f(s)^{2})}, \tag{9}\]  
the optimal weight parameter \(\omega_{i}\) of the system can be obtained when \(J\) takes the minimum value. Following the above steps, we can obtain the weights sequence of the demonstrated movement, which can be used to generate new motions in any new environment with the same motion characteristics of the demonstrated one. The generalization process of DMPs is just the opposite of the learning process. A movement plan in a new environment can be generated by reusing the obtained weight parameters \(\omega_{i}\) by specifying the desired start point \(x_{0}\) and goal point \(x_{g}\) and integrating the canonical system with \(s=1\). The non-linear function \(f\), which is derived from the phase variable, can, in turn, perturb the linear spring-damper system to generate the desired attractor landscapes. Just by rearranging Equations (1) and (2), the displacement \(x\), velocity \(\dot{x}\), and acceleration \(\ddot{x}\) of the generalized trajectory can all be computed with the point-by-point iterative method. The whole learning and generalization process are illustrated in Figure 1 in detail. Furthermore, the learning and generalization process of DMPs can also be generalized to the motion learning of multi-degrees of freedom. In this case, all the motions are coupled in time, but each degree of freedom has its corresponding non-linear function and dynamical system. In the DMPs model, the same canonical system can ensure the time coupling of each degree of freedom and the corresponding dynamical system can guarantee each degree of freedom has its own motion characteristics.