## Appendix A  
The centre of mass calculated for all the links of the robot  
\[\mathbf{r_{C1}}=\left[ \begin{array}{c}0\\ \frac{b_{1}}{2}\\ 0\end{array} \right] \mathbf{r_{C7}}=\left[ \begin{array}{c}\Big{(}L_{21}+q_{22}-\frac{L_{2 2}}{2}\Big{)}Cq_{1}C(q_{2}+q_{21})+c_{2}Cq_{1}Cq_{2}\\ \Big{(}L_{21}+q_{22}-\frac{L_{22}}{2}\Big{)}Sq_{1}C(q_{2}+q_{21})+c_{2}Sq_{1}Cq _{2}\\ \Big{(}L_{21}+q_{22}-\frac{L_{22}}{2}\Big{)}S(q_{2}+q_{21})+c_{2}Sq_{2}+b_{1} \end{array} \right]\]  
\[\mathbf{r_{C2}}=\left[ \begin{array}{c}\frac{L_{21}}{2}Cq_{1}Cq_{2}\\ \frac{L_{22}}{2}Sq_{1}Sq_{2}\\ \frac{L_{22}}{2}Sq_{2}+b_{1}\end{array} \right] \mathbf{r_{C8}}=\left[ \begin{array}{c}Cq_{1}\Big{(}\frac{L_{22}} {2}+(L_{3}-b_{3})C(q_{2}+q_{3})+L_{2}Cq_{2}\Big{)}\\ Sq_{1}\Big{(}\frac{L_{22}}{2}+(L_{3}-b_{3})C(q_{2}+q_{3})+L_{2}Cq_{2}\Big{)}\\ (L_{3}-b_{3})S(q_{2}+q_{3})+L_{2}Sq_{2}+b_{1}\end{array} \right]\]  
\[\mathbf{r_{C3}}=\left[ \begin{array}{c}\frac{1}{2}L_{11}Cq_{1}Cq_{11}-L_{1}Cq _{1}\\ \frac{1}{2}L_{11}Sq_{1}Cq_{11}-L_{1}Sq_{1}\\ \frac{1}{2}L_{11}Sq_{11}+b_{1}\end{array} \right] \mathbf{r_{C9}}=\left[ \begin{array}{c}Cq_{1}\Big{(}\frac{L_{2 }}{2}+L_{42}+(L_{3}-b_{3})C(q_{2}+q_{3})+L_{2}Cq_{2}\Big{)}\\ Sq_{1}\Big{(}\frac{L_{2}}{2}+L_{42}+(L_{3}-b_{3})C(q_{2}+q_{3})+L_{2}Cq_{2}\Big{)} \\ (L_{3}-b_{3})S(q_{2}+q_{3})+L_{2}Sq_{2}+b_{1}\end{array} \right]\]  
\[\mathbf{r_{C4}}=\left[ \begin{array}{c}\Big{(}L_{11}+q_{12}-\frac{L_{4}}{2} \Big{)}Cq_{1}Cq_{11}-L_{1}Cq_{1}\\ \Big{(}L_{11}+q_{12}-\frac{L_{4}}{2}\Big{)}Sq_{1}Cq_{11}-L_{1}Sq_{1}\\ \Big{(}L_{11}+q_{12}-\frac{L_{4}}{2}\Big{)}Sq_{11}+b_{1}\end{array} \right] \mathbf{r_{C10}}=\left[ \begin{array}{c}Cq_{1}\Big{(}\frac{L_{2}}{2}Cq_{2 }-c_{1}\Big{)}\\ Sq_{1}\Big{(}\frac{L_{2}}{2}Cq_{2}-c_{1}\Big{)}\\ \frac{L_{2}}{2}Sq_{2}+b_{1}\end{array} \right]\]  
\[\mathbf{r_{C5}}=\left[ \begin{array}{c}Cq_{1}\Big{(}\frac{(L_{3}-2b_{3})}{2} C(q_{2}+q_{3})+L_{2}Cq_{2}\Big{)}\\ Sq_{1}\Big{(}\frac{(L_{3}-2b_{3})}{2}C(q_{2}+q_{3})+L_{2}Cq_{2}\Big{)}\\ \frac{(L_{3}-2b_{3})}{2}S(q_{2}+q_{3})+L_{2}Sq_{2}+b_{1}\end{array} \right] \mathbf{r_{C5}}=\left[ \begin{array}{c}Cq_{1}\Big{(}\frac{(L_{3}-2b_{3})}{2 }C(q_{2}+q_{3})+L_{2}Cq_{2}\Big{)}\\ Sq_{1}\Big{(}\frac{(L_{3}-b_{3})}{2}C(q_{2}+q_{3})+L_{2}Cq_{2}\Big{)}\\ \frac{(L_{3}-b_{3})}{2}S(q_{2}+q_{3})+L_{2}Sq_{2}+c_{1}+b_{1}\end{array} \right]\]  
\[\mathbf{r_{C6}}=\left[ \begin{array}{c}Cq_{1}\Big{(}\frac{L_{21}}{2}C(q_{2}+q_ {21})+c_{2}Cq_{2}\Big{)}\\ Sq_{1}\Big{(}\frac{L_{21}}{2}C(q_{2}+q_{21})+c_{2}Cq_{2}\Big{)}\\ \frac{L_{21}}{2}S(q_{2}+q_{21})+c_{2}Sq_{2}+b_{1}\end{array} \right]\]  
\[\mathbf{r_{C12}}=\left[ \begin{array}{c}Cq_{1}\Big{(}\frac{(L_{3}-b_{3})}{2} C(q_{2}+q_{3})+L_{2}Cq_{2}\Big{)}\\ Sq_{1}\Big{(}\frac{(L_{3}-b_{3})}{2}C(q_{2}+q_{3})+L_{2}Cq_{2}\Big{)}\\ \frac{(L_{3}-b_{3})}{2}S(q_{2}+q_{3})+L_{2}Sq_{2}+c_{1}+b_{1}\end{array} \right]\]  
The angular velocities of the robot links\[\omega_{1}=\left[ \begin{array}{c}0\\ 0\\ \dot{q}_{1}\end{array} \right] \omega_{2}=\left[ \begin{array}{c}\dot{q}_{2}Sq_{1}\\ -\dot{q}_{2}Cq_{1}\\ \dot{q}_{1}\end{array} \right] \omega_{3}=\left[ \begin{array}{c}\dot{q}_{11}Sq_{1}\\ -\dot{q}_{11}Cq_{1}\\ \dot{q}_{1}\end{array} \right]\]  
\[\omega_{4}=\omega_{3} \omega_{5}=\left[ \begin{array}{c}Sq_{1}\big{(}\dot{q}_{2}+\dot{q}_ {3}\big{)}\\ -Cq_{1}\big{(}\dot{q}_{2}+\dot{q}_{3}\big{)}\\ \dot{q}_{1}\end{array} \right] \omega_{6}=\left[ \begin{array}{c}Sq_{1}\big{(}\dot{q}_{2}+\dot{q}_ {21}\big{)}\\ -Cq_{1}\big{(}\dot{q}_{2}+\dot{q}_{21}\big{)}\\ \dot{q}_{1}\end{array} \right]\]  
\[\omega_{7}=\omega_{6} \omega_{8}=\omega_{1} \omega_{9}=\left[ \begin{array}{c}\dot{q}_{4}Cq_{1}\\ \dot{q}_{4}Sq_{1}\\ \dot{q}_{1}\end{array} \right]\]  
\[\omega_{10}=\omega_{2} \omega_{11}=\omega_{1} \omega_{12}=\omega_{5}\]  
The potential energy of the robot  
\[