## Appendix C Dynamic Model  
Defining \(s.=\sin(\cdot)\), \(c.=\cos(\cdot)\), \(c_{i}=c_{qi},s_{i}=s_{qi}\), we obtained the matrix  
\[\mathbf{M}(\mathbf{q})= \begin{bmatrix}m_{11}(\mathbf{q})&m_{12}(\mathbf{q})&m_ {13}(\mathbf{q})\\ m_{21}(\mathbf{q})&m_{22}(\mathbf{q})&m_{23}(\mathbf{q})\\ m_{31}(\mathbf{q})&m_{32}(\mathbf{q})&m_{33}(\mathbf{q})\end{bmatrix}  \tag{10}\]  
with  
\[m_{11}(\mathbf{q})= L_{1,zz}+l_{\mathcal{L}2,zz}+l_{\mathcal{L}3,zz}+{\ell_{1}}^{2} \,m_{2}+{\ell_{1}}^{2}\,m_{3}+{\ell_{2}}^{2}\,m_{3}+{b_{1}}^{2}\,m_{1}+{b_{2}} ^{2}\,m_{2}+{b_{3}}^{2}\,m_{3} \tag{11}\] \[+2\,\ell_{1}\,{b_{3}}\,m_{3}\,c_{23}+2\,\ell_{1}\,\ell_{2}\,m_{3} \,c_{2}+2\,\ell_{1}\,b_{2}\,m_{2}\,c_{2}+2\,\ell_{2}\,{b_{3}}\,m_{3}\,c_{3},\]  
\[m_{22}(\mathbf{q})=m_{3}\,{\ell_{2}}^{2}+2\,m_{3}\,c_{3}\,\ell_{2}\,{b_{3}}+m _{2}\,{b_{2}}^{2}+m_{3}\,{b_{3}}^{2}+l_{\mathcal{L}2,zz}+l_{\mathcal{L}3,zz}, \tag{12}\]  
\[m_{33}(\mathbf{q})=m_{3}\,{b_{3}}^{2}+l_{\mathcal{L}3,zz}, \tag{13}\]\[m_{12}(\mathbf{q})= m_{21}(\mathbf{q})=m_{3}\,{\ell_{2}}^{2}+2\,m_{3}\,c_{3}\,\ell_{2} \,b_{3}+\ell_{1}\,m_{3}\,c_{2}\,\ell_{2}+m_{2}\,{b_{2}}^{2}+\ell_{1}\,m_{2}\,c_{2 }\,{b_{2}}+m_{3}\,{b_{3}}^{2} \tag{111}\] \[+\ell_{1}\,m_{3}\,c_{23}\,b_{3}+l_{2,zz}+l_{3,zz},\] \[m_{13}(\mathbf{q})=m_{31}(\mathbf{q})=l_{3,zz}+{b_{3}}^{2}\,m_{3}+ \ell_{1}\,b_{3}\,m_{3}\,c_{23}+\ell_{2}\,b_{3}\,m_{3}\,c_{3},\] (112) \[\text{and}\] \[m_{23}(\mathbf{q})=m_{32}(\mathbf{q})=m_{3}\,{b_{3}}^{2}+\ell_{2}\,m_{3} \,c_{3}\,b_{3}+l_{3,zz}\] (113) \[\text{Therefore, the}\,\,\mathbf{C}(\mathbf{q},\dot{\mathbf{q}})\, \text{terms}\] \[\mathbf{C}(\mathbf{q},\dot{\mathbf{q}})=\left[ \begin{array}{c}C_{1}( \mathbf{q},\dot{\mathbf{q}})\\ C_{2}(\mathbf{q},\dot{\mathbf{q}})\\ C_{3}(\mathbf{q},\dot{\mathbf{q}})\end{array} \right] \tag{114}\]  
with  
\[ \begin{split} C_{1}(\mathbf{q},\dot{\mathbf{q}})&=-\ell_{1} \,\ell_{2}\,m_{3}\,\ell_{2}^{2}\,s_{2}-\ell_{1}\,b_{2}\,m_{2}\,\ell_{2}^{2}\,s _{2}-\ell_{2}\,b_{3}\,m_{3}\,q_{3}^{2}\,s_{3}-\ell_{1}\,b_{3}\,m_{3}\,q_{2}^{2} \,c_{2}\,s_{3}\\ &-\ell_{1}\,b_{3}\,m_{3}\,q_{2}^{2}\,c_{3}\,s_{2}-\ell_{1}\,b_{3}\,m_{3} \,q_{3}^{2}\,c_{2}\,s_{3}-\ell_{1}\,b_{3}\,m_{3}\,q_{3}^{2}\,c_{3}\,s_{2}-2\, \ell_{1}\,\ell_{2}\,m_{3}\,\dot{q}_{1}\,\dot{q}_{2}\,s_{2}\\ &-2\,\ell_{1}\,b_{2}\,m_{2}\,\dot{q}_{1}\,\dot{q}_{2}\,s_{2}-2\,\ell_{2}\, b_{3}\,m_{3}\,\dot{q}_{1}\,\dot{q}_{3}\,s_{3}-2\,\ell_{2}\,b_{3}\,m_{3}\, \dot{q}_{2}\,\dot{q}_{3}\,s_{3}\\ &-2\,\ell_{1}\,b_{3}\,m_{3}\,\dot{q}_{1}\,\dot{q}_{2}\,c_{3}\,s_{2}-2\, \ell_{1}\,b_{3}\,m_{3}\,\dot{q}_{2}\,c_{3}-2\,\ell_{1}\,b_{3}\,m_{3}\,\dot{q}_{ 2}\,d_{3}\,c_{3}\,s_{2}\\ &\hskip 14.226378 ptC_{2}(\mathbf{q},\dot{\mathbf{q}})=\ell_{1}\, \ell_{2}\,m_{3}\,q_{1}^{2}\,s_{2}+\ell_{1}\,b_{2}\,m_{2}\,q_{1}^{2}\,s_{2}- \ell_{2}\,b_{3}\,m_{3}\,q_{3}^{2}\,s_{3}+\ell_{1}\,b_{3}\,m_{3}\,q_{1}^{2}\,c_ {2}\,s_{3}\\ &\hskip 14.226378 pt+\ell_{1}\,b_{3}\,m_{3}\,q_{1}^{2}\,c_{3}\,s_{2}-2\, \ell_{2}\,b_{3}\,m_{3}\,\dot{q}_{1}\,q_{3}\,s_{3}-2\,\ell_{2}\,b_{3}\,m_{3}\, \dot{q}_{2}\,q_{3}\,s_{3}\end{split}  \tag{115}\]  
and  
\[ \begin{split} C_{3}(\mathbf{q},\dot{\mathbf{q}})&= \dot{q}_{1}\,(\dot{q}_{1}\,(\ell_{1}\,b_{3}\,m_{3}\,s_{23}+\ell_{2}\,b_{3}\,m _{3}\,s_{3})+\ell_{2}\,b_{3}\,m_{3}\,\dot{q}_{2}\,s_{3})\\ &+\dot{q}_{2}\,(\ell_{2}\,b_{3}\,m_{3}\,\dot{q}_{1}\,s_{3}+\ell_ {2}\,b_{3}\,m_{3}\,\dot{q}_{2}\,s_{3})\end{split}  \tag{116}\]  
Now, taking into account that the gravity term is defined as  
\[\mathbf{G}(\mathbf{q})=\left(\frac{\partial\mathcal{U}(\mathbf{q})}{\partial \mathbf{q}}\right)^{T}= \begin{bmatrix}g_{1}(\mathbf{q})\\ g_{2}(\mathbf{q})\\ g_{3}(\mathbf{q})\end{bmatrix}