# Control of Flexible Robot by Harmonic Functions
## 2 Materials and Methods
### Exact Input-Output Linearization with Parametrization  
Let us consider a nonlinear dynamic system (Eigen equations of motion):  
\[\mathbf{M}(\mathbf{q})\ddot{\mathbf{q}}=\mathbf{F}(\mathbf{q},\dot{\mathbf{q} })+\mathbf{B}(\mathbf{q})\mathbf{u} \tag{1}\]  
where the matrix \(\mathbf{M}|n\times n|\) is an inertia matrix; \(\mathbf{q}[n\times 1]\) are coordinates describing the system; \(\dot{\mathbf{q}}\) and \(\ddot{\mathbf{q}}\) their time derivatives; \(\mathbf{F}[n\times 1]\) is a matrix containing forces dependent on velocities and external forces besides control inputs; \(\mathbf{B}[n\times k]\) is the control input distribution matrix; the vector \(\mathbf{u}[k\times 1],\ k<n\) contains the control inputs. The state vector \(\mathbf{q}\) could be rewritten without loss of generality in the following way:  
\[\mathbf{q}= \begin{bmatrix}\mathbf{q}_{a}\\ \mathbf{q}_{z}\end{bmatrix}  \tag{2}\]  
where \(\mathbf{q}_{a}\) has the same dimension as the rank of matrix \(\mathbf{B}\). Remaining \(z\) coordinates in vector \(\mathbf{q}_{z}\) represent not directly actuated states (zero dynamics). This coordinate selection is generally not unique. The system (1) could be rewritten as follows:  
\[\mathbf{M}_{aa}^{I}(\mathbf{q})\ddot{\mathbf{q}}_{a}+\mathbf{M}_{ az}^{I}(\mathbf{q})\ddot{\mathbf{q}}_{z} =\mathbf{F}_{a}^{I}(\mathbf{q},\dot{\mathbf{q}})+\mathbf{B}_{a}( \mathbf{q})\mathbf{u} \tag{3}\] \[\mathbf{M}_{za}^{I}(\mathbf{q})\ddot{\mathbf{q}}_{a}+\mathbf{M}_ {zz}^{I}(\mathbf{q})\ddot{\mathbf{q}}_{z} =\mathbf{F}_{z}^{I}(\mathbf{q},\dot{\mathbf{q}})+\mathbf{B}_{z}^{I }(\mathbf{q})\mathbf{u} \tag{4}\]  
where the matrix \(\mathbf{B}_{a}[a\times a]\) is the largest regular sub-matrix of the matrix \(\mathbf{B}\) with the rank \(a\) (the actuator redundancy is not covered, so \(a=k\)). The number of \(\mathbf{q}_{z}\) coordinates is \(z=n-a\). The matrix dimensions in (3) and (4) are dependent on the lower indexes, and matrix \(\mathbf{B}_{z}^{I}\) has dimensions \([z\times a]\). Let us consider the vector of system outputs \(\mathbf{y}\) of the same dimension as the vector \(\mathbf{q}_{a}\). There is a relation between system outputs and system coordinates:  
\[\mathbf{y}=\mathbf{f}(\mathbf{q}_{a},\mathbf{q}_{z}) \tag{5}\]  
with a vector \(\mathbf{f}[a\times 1]\) representing the dependence of the output on the system coordinates \(\mathbf{q}_{a}\) and \(\mathbf{q}_{z}\). There exist the inverse relation \(\mathbf{f}^{-1}\), such that the coordinates \(\mathbf{q}_{a}\) and its second time derivative can be uniquely determined:  
\[\mathbf{q}_{a}=\mathbf{f}^{-1}(\mathbf{y},\mathbf{q}_{z}) \tag{6}\] \[\ddot{\mathbf{q}}_{a}=\mathbf{J}_{y}(\mathbf{y},\mathbf{q}_{z}) \ddot{\mathbf{y}}+\mathbf{J}_{z}(\mathbf{y},\mathbf{q}_{z})\ddot{\mathbf{q}}_ {z}+\mathbf{S}(\mathbf{y},\dot{\mathbf{y}},\mathbf{q}_{z},\dot{\mathbf{q}}_{z}) \tag{7}\]  
where \(\mathbf{J}_{y}[a\times a]\), \(\mathbf{J}_{z}[a\times z]\) and \(\mathbf{S}[a\times 1]\) are matrices resulting the time derivatives. The outputs \(\mathbf{y}\) are often parametrized, especially in robotics applications. The parametrized trajectory is defined:  
\[\mathbf{P}=\mathbf{y}=\mathbf{P}(\mathbf{p}(t)) \tag{8}\]  
with the following output acceleration:  
\[\ddot{\mathbf{y}}=\mathbf{J}_{p}(\mathbf{p})\ddot{\mathbf{p}}+\mathbf{T}( \mathbf{p},\dot{\mathbf{p}}) \tag{9}\]  
where vector \(\mathbf{P}[a\times 1]\) is output parametrization and \(\mathbf{J}_{p}[a\times p]\), \(\mathbf{T}[a\times 1]\) are time derivative resulting matrices with \(p\) equalling the number of parameters.