Segway Model

The model of the balancing robot proposed in [15] is derived from the physical description of Fig. 2.

../_images/model_image.png

Fig. 2 Segway’s relevant parameters [15]

Where;

  • \(x\) is the horizontal position of the center of the wheel.
  • \(\varphi\) is the clockwise rotation angle of the wheel from the horizontal axis
  • \(\theta\) is the clockwise rotation angle of the Zumo32u4 from the horizontal axis
  • \(m\) is the mass of the entire robot
  • \(m_w\) is the mass of the wheel
  • \(R\) radius of the wheel
  • \(L\) length between the center of the wheel and the COM
  • \(\tau_0\) is the applied torque
  • \(I\) inertia of the body part
  • \(I_w\) inertia of the wheel

System’s dynamics equations

The obtained differential equations of the system in [15] are;

(2)\[\begin{split}E \begin{bmatrix} \ddot{\varphi} \\ \ddot{\theta} \end{bmatrix} \ \ + F \begin{bmatrix} \dot{\varphi} \\ \dot{\theta} \end{bmatrix} \ \ + G \theta = H\tau_0\end{split}\]

With,

\[\begin{split}E = \begin{bmatrix} I_w + (m_w + m)R^2 & mRL \\ mRL & I + mL^2 \end{bmatrix}\end{split}\]
\[\begin{split}F = \begin{bmatrix} \beta_\gamma + \beta_m & -\beta_m \\ -\beta_m & \beta_m \end{bmatrix}\end{split}\]
\[\begin{split}G = \begin{bmatrix} 0 \\ -mgL \end{bmatrix}\end{split}\]
\[\begin{split}H = \begin{bmatrix} 1 \\ -1 \end{bmatrix}\end{split}\]

Model Adaptation

In [15] they define \(L\) as in (3) with the variables define as in Fig. 3.

(3)\[L = \frac{L_2}{2} + \frac{L_1 + L_2}{2}\frac{m_1}{m}\]
../_images/com_image.png

Fig. 3 Center of Mass calculation [15]

Similarly [15] defines the inertia momentum of the robot as in (4).

(4)\[I = m_1(\frac{L_1}{2}+L_2)^2 \frac{1}{12}m_2L_2^2\]

Given the geometry of the Zumo32u4 we consider that \(m_1 = 0\) and \(L_1 = 0\). Therefore the distance to the COM and the inertia momentum can be calculated \(L = \frac{L_2}{2}\) and \(I = \frac{1}{12}m_2L_2^2\), respectively.

Furthermore, the model in [15] consider a normal wheel. In our Zumo32u4 we have a caterpillar system. (5) shows how the inertia moment of the caterpillar system was calculated.

(5)\[I_w = I_{w_1} + I_c + I_{w_2}\]

Where the \(I_{w_1}\) and \(I_{w_2}\) are the inertia moment of the both wheels and \(I_c\) is the inertia moment of the caterpillar band. In our case both wheels are equal and can be calculated as in (6)

(6)\[I_{w_i} = m_wR^2\]

Additionally the inertia of the caterpillar band can be calculated as shown in (7). Where \(m_c\) is the mass of the caterpillar band.

(7)\[I_c = m_cR^2\]

Finally the inertia moment of the entire caterpillar system can be calculated as in (8).

(8)\[I_w = (2\cdot m_w + m_c)R^2\]

Input Adaptation

The model in [15] defines the input to be the torque \(\tau_0\). Since the actual input to our system is the PWM applied to the motors we can use the equation defined in the subsection Motors of the chapter Zumo32u4, shown in (9).

(9)\[\tau_0 = \frac{\tau_s}{400} \times speed_{PWM}\]

Merging (9) and (2) we obtain;

\[\begin{split}E \begin{bmatrix} \ddot{\varphi} \\ \ddot{\theta} \end{bmatrix} \ \ + F \begin{bmatrix} \dot{\varphi} \\ \dot{\theta} \end{bmatrix} \ \ + G \theta = H_1speed_{PWM}\end{split}\]

With;

\[H_1 = H * \frac{\tau_s}{400}\]

State Variable Model

Finally the state variable model of the system can be calculated as shown in (10).

(10)\[ \begin{align}\begin{aligned}\dot{x} = Ax + Bu\\y = Cx + D\end{aligned}\end{align} \]

With the state variable vector;

\[\begin{split}x = \begin{bmatrix} \varphi \\ \theta \\ \dot{\varphi} \\ \dot{\theta} \end{bmatrix}\end{split}\]

And the constant matrices;

\[\begin{split}A = \left[ \begin{array}{c|c|cc} \begin{matrix} 0 \\ 0 \end{matrix} & \begin{matrix} 0 \\ 0 \end{matrix} & \begin{matrix} 1 & 0 \\ 0 & 1 \end{matrix} \\ \hline \begin{matrix} 0 \\ 0 \end{matrix} & -E^{-1}G & -E^{-1}F \end{array} \right]\end{split}\]
\[\begin{split}B = \left[ \begin{array}{c} \begin{matrix} 0 \\ 0 \end{matrix} \\ \hline -E^{-1}H \end{array} \right]\end{split}\]
\[\begin{split}C = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}\end{split}\]
\[\begin{split}D = \begin{bmatrix} 0 \\ 0 \\ 0 \\ 0 \end{bmatrix}\end{split}\]

[15](1, 2, 3, 4, 5, 6, 7, 8) Mie Kunio Ye Ding, Joshua Gafford. Modeling, simulation and fabrication of a balancing robot. Technical Report, Harvard University, Massachusettes Institute of Technology, 2012.