# Precise Calculation of Inverse Kinematics of the Center of Gravity for Bipedal Walking Robots
## 2 Materials and Methods
### Robot Kinematics  
The method developed in this study requires the separate calculation of the CoG of the legs. Because each leg can be represented as a matrix structure, the Denavit-Hartenberg \begin{table}
\begin{tabular}{c c c} \hline \hline
**Parameter Symbol** & **Value** & **Unit** \\ \hline \(x_{0}\) & \(-0.14\) & m \\ \(y_{0}\) & \(0.13\) & m \\ \(z_{0}\) & \(-0.07\) & m \\ \(l_{1}\) & \(0.422\) & m \\ \(l_{2}\) & \(0.4\) & m \\ \(l_{3}\) & \(0.075\) & m \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Length parameters. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Part Name** & \(\mathbf{c_{x}}\) **(m)** & \(\mathbf{c_{y}}\) **(m)** & \(\mathbf{c_{z}}\) **(m)** & \(\mathbf{m}\) **(kg)** \\ \hline Torso & \(0.000006\) & \(0.020549\) & \(0.157635\) & \(2.387902\) \\ Hip roll body & \(0.000003\) & \(0.035534\) & \(0.0661\) & \(2.139072\) \\ Hip yaw body & \(-0.009912\) & \(0.002801\) & \(-0.0228\) & \(0.71518\) \\ Upper leg body & \(0.186095\) & \(-0.004384\) & \(-0.003505\) & \(3.804756\) \\ Lower leg body & \(0.180778\) & \(-0.007\) & \(0.000426\) & \(2.805996\) \\ Ankle roll body & \(-0.000011\) & \(-0.001187\) & \(0.001606\) & \(0.022225\) \\ Foot & \(0.058582\) & \(0.000012\) & \(0.018663\) & \(1.584761\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: CoGs and masses of the body parts. Figure 1: Joint angles and basic dimensions of the robot: (**a**) joint and length parameters; (**b**) leg indices and approximate CoGs. (DH) [34] method is used for kinematic calculations. The link transformations are presented in Table 3.  
Equations (1)-(4) present the link transformation matrices for an inertial reference frame. \[O_{B}= \begin{bmatrix}1&0&0&x_{0}\\ 0&1&0&0\\ 0&0&1&0\\ 0&0&0&1\end{bmatrix} , \tag{1}\]  
The transformation matrix of \(O_{0R}\) according to \(O_{W}\) is given in Equation (2). The calculation for the left foot is made by writing \(y_{0}\) in the second row and fourth column. \[{}^{W}O_{0R}=O_{B} \begin{bmatrix}0&-1&0&0\\ 1&0&0&-y_{0}\\ 0&0&1&z_{0}\\ 0&0&0&1\end{bmatrix}  \tag{2}\]  
The joint transformation matrix can be written with Equation (3). \[{}^{n-1}T_{n}= \begin{bmatrix}\cos\theta_{n}&-\sin\theta_{n}\cos\alpha_{n}&\sin \theta_{n}\sin\alpha_{n}&r_{n}\cos\theta_{n}\\ \sin\theta_{n}&\cos\theta_{n}\cos\alpha_{n}&-\cos\theta_{n}\sin\alpha_{n}&r_{ n}\sin\theta_{n}\\ 0&\sin\alpha_{n}&\cos\alpha_{n}&d_{n}\\ 0&0&0&1\end{bmatrix}  \tag{3}\]  
After these expressions, the position and orientation of the foot can be calculated based on the 0 th coordinate system as given in Equation (4). \[{}^{0R}T_{6R}={}^{0R}T_{1R}{}^{1R}T_{2R}{}^{2R}T_{3R}{}^{3R}T_{4R}{}^{4R}T_{5R }{}^{5R}T_{6R}= \begin{bmatrix}n_{x}&o_{x}&a_{x}&p_{x}\\ n_{y}&o_{y}&a_{y}&p_{y}\\ n_{z}&o_{z}&a_{z}&p_{z}\\ 0&0&0&1\end{bmatrix}  \tag{4}\]  
where the left side of the equation is obtained by the placement of the values in the DH matrix. Its right side includes the position and orientation values of the foot obtained in the 0 th coordinate system. When the reciprocal of the left side of the equation is taken, the chain from the foot to the hip is obtained. If both sides are multiplied by the matrix \({}^{5R}T_{6R}^{-1}\), the transformation matrix from the ankle to the hip can be obtained [35]. As 2 coordinate systems intersect at the ankle, and 3 intersect at the hip, the value of the knee joint is obtained based on the matrix that is formed. According to this, inverse kinematic calculations can be made using Equations (5)-(10). \[\theta_{4}=\sqrt{ \begin{cases}\dfrac{1-\cos\theta_{4}^{2}}{\dfrac{\left[(p_{x }+l_{3})^{2}+p_{y}^{2}+p_{z}^{2}-l_{z}^{2}-l_{z}^{2}\right]}{(2l_{1}l_{2})}} \end{cases} } \tag{5}\]