# Appendix B Derivation of motion equation for a planar robot

We derive each element in ( 106 ) individually for j\geq z , then combine them altogether to derive the dynamic equation of the system. In this regard, for the first element in ( 106 ), we can write

 \frac{\partial T_{j}}{\partial\dot{q}_{z}}=m_{j}\Big(\frac{\partial\dot{f}_{j,1}}{\partial\dot{q}_{z}}\dot{f}_{j,1}+\frac{\partial\dot{f}_{j,2}}{\partial\dot{q}_{z}}\dot{f}_{j,2}\Big)=m_{j}\Big(\Big(-l_{z}s_{z}\Big)\dot{f}_{j,1}+\Big(l_{z}c_{z}\Big)\dot{f}_{j,2}\Big),

whose time derivative can be expressed as

 \frac{d}{dt}\frac{\partial T_{j}}{\partial\dot{q}_{z}}=m_{j}\Big(\Big(-l_{z}\dot{q}_{z}c_{z}\Big)\dot{f}_{j,1}-\Big(l_{z}s_{z}\Big)\ddot{f}_{j,1}-\Big(l_{z}\dot{q}_{z}s_{z}\Big)\dot{f}_{j,2}+\Big(l_{z}c_{z}\Big)\ddot{f}_{j,2}\Big),

where

For the second term in ( 106 ), we can write

 \frac{\partial T_{j}}{\partial q_{z}}=m_{j}\Big(\frac{\partial\dot{f}_{j,1}}{\partial q_{z}}\dot{f}_{j,1}+\frac{\partial\dot{f}_{j,2}}{\partial q_{z}}\dot{f}_{j,2}\Big)=m_{j}\Bigg(\Big(-l_{z}\dot{q}_{z}c_{z}\Big)\dot{f}_{j,1}-\Big(l_{z}\dot{q}_{z}s_{z}\Big)\dot{f}_{j,2}\Bigg),

and finally, the potential energy term can be calculated as

 \frac{\partial U_{j}}{\partial q_{z}}=m_{j}gl_{z}c_{z}.

The z- th generalized force can be found by substituting the derived terms to ( 106 ) as

 \displaystyle u_{z} \displaystyle=\sum_{j=z}^{N}\Big(m_{j}\Big(\Big(-l_{z}\dot{q}_{z}c_{z}\Big)\dot{r}_{j,1}-\Big(l_{z}s_{k}\Big)\ddot{r}_{j,1}-\Big(l_{z}\dot{q}_{z}s_{z}\Big)\dot{r}_{j,2}+\Big(l_{z}c_{z}\Big)\ddot{r}_{j,2}\Big)-m_{j}\Big(\Big(-l_{z}\dot{q}_{z}c_{z}\Big)\dot{r}_{j,1}-\Big(l_{z}\dot{q}_{z}s_{z}\Big)\dot{r}_{j,2}\Big)+m_{j}gl_{z}c_{z}\Big) \displaystyle=\sum_{j=z}^{N}\Big(m_{j}\Big(\Big(-l_{z}s_{z}\Big)\ddot{r}_{j,1}+\Big(l_{z}c_{z}\Big)\ddot{r}_{j,2}\Big)+m_{j}gl_{z}c_{z}\Big) \displaystyle=\sum_{j=z}^{N}\Big(m_{j}\Big(\Big(-l_{z}s_{z}\Big)\Big(-\sum_{k=1}^{j}l_{k}\ddot{q}_{k}s_{k}-\sum_{k=1}^{j}l_{k}\dot{q}_{k}^{2}c_{k}\Big)+\Big(l_{z}c_{z}\Big)\Big(\sum_{k=1}^{j}l_{k}\ddot{q}_{k}c_{k}-\sum_{k=1}^{j}l_{k}\dot{q}_{k}^{2}s_{k}\Big)\Big)+m_{j}gl_{z}c_{z}\Big) \displaystyle=\sum_{j=z}^{N}m_{j}\Big(\sum_{k=1}^{j}l_{z}l_{k}c_{z-k}\ddot{q}_{k}+\sum_{k=1}^{j}l_{z}l_{k}s_{z-k}\dot{q}_{k}^{2}\Big)+\sum_{j=z}^{N}m_{j}gl_{z}c_{z},

where

 c_{h-k}=c_{h}c_{k}-s_{h}s_{k},\ \ \ s_{h-k}=s_{h}c_{k}-c_{h}s_{k}.

By rearranging the order of elements, we can write

 \sum_{j=z}^{N}m_{j}\Big(\sum_{k=1}^{j}l_{z}l_{k}c_{z-k}\ddot{q}_{k}\Big)=u_{z}-\sum_{j=z}^{N}m_{j}\Big(\sum_{k=1}^{j}l_{z}l_{k}s_{z-k}\dot{q}_{k}^{2}\Big)-\sum_{j=z}^{N}m_{j}gl_{z}c_{z}.