June, 03, 2020

# Segway Robot (Two-Wheeled Robot)

Note: Segway Robot project was done during the years 2011 – 2013 when Madi was a Master’s student.

Study on two-wheeled robots started in late 1990 in different robotic labs in different countries. The main objective is to design a balanced two-wheeled robot that has human-like abilities.
The main research challenge in these robots is the inherent instability of their dynamical system. These robots can be used as autonomous vehicles in companies, factories, or just to transport people.

### Actuator Modeling

According to Kirchhoff’s law:

${V}_{a}–Ri–L\frac{di}{dt}–{V}_{e}=0$

Newton’s Law for the shaft of the motor:

$\sum M={\tau }_{m}–{k}_{f}\omega –{\tau }_{a}={I}_{R}\frac{d\omega }{dt}$

Thus:

$\left[\begin{array}{c}\stackrel{˙}{\theta }\\ \stackrel{˙}{\omega }\end{array}\right]=\left[\begin{array}{cc}0& 1\\ 0& \frac{-{k}_{m}{k}_{e}}{{I}_{R}R}\end{array}\right]\left[\begin{array}{c}\theta \\ \omega \end{array}\right]+\left[\begin{array}{cc}0& 0\\ \frac{{k}_{m}}{{I}_{R}R}& \frac{-1}{{I}_{R}}\end{array}\right]\left[\begin{array}{c}{V}_{a}\\ {\tau }_{a}\end{array}\right]$
$y=\left[\begin{array}{cc}1& 0\end{array}\right]\left[\begin{array}{c}\theta \\ \omega \end{array}\right]+\left[\begin{array}{cc}0& 0\end{array}\right]\left[\begin{array}{c}{V}_{a}\\ {\tau }_{a}\end{array}\right]$

### Wheel Modeling

Applying Newton’s law in the x-direction and around wheel axis:

$\sum {F}_{x}=Ma$
${M}_{w}\stackrel{¨}{x}={H}_{fR}–{H}_{R}$
$\sum {M}_{a}=I\alpha$
${I}_{w}\stackrel{¨}{\theta }={C}_{R}–{H}_{fR}r$

### Chassis Modeling

Applying Newton’s laws to the chassis’s free diagram:

${I}_{p}{\stackrel{¨}{\theta }}_{p}–\frac{2{k}_{m}{k}_{e}}{Rr}\stackrel{˙}{x}+2\frac{{k}_{m}}{R}{V}_{a}+{M}_{p}g\ell sin\left({\theta }_{p}\right)+{M}_{p}{\ell }^{2}{\stackrel{¨}{\theta }}_{p}=-{M}_{p}\stackrel{¨}{x}\ell cos\left({\theta }_{p}\right)$
$2\left({M}_{w}+\frac{{I}_{w}}{{r}^{2}}\right)\stackrel{¨}{x}=\frac{-2{k}_{m}{k}_{e}}{R{r}^{2}}\stackrel{˙}{x}+\frac{2{k}_{m}}{Rr}{V}_{a}–{M}_{p}\stackrel{¨}{x}–{M}_{p}\ell {\stackrel{¨}{\theta }}_{p}cos\left({\theta }_{p}\right)+{M}_{p}\ell {\stackrel{¨}{{\theta }_{p}}}^{2}sin\left({\theta }_{p}\right)$

Linearizing the above nonlinear equations, the state equations of the system are as follows:

$\left[\begin{array}{c}\stackrel{˙}{x}\\ \stackrel{¨}{x}\\ \stackrel{˙}{\varphi }\\ \stackrel{¨}{\varphi }\end{array}\right]=\left[\begin{array}{cccc}0& 1& 0& 0\\ 0& \frac{2{k}_{m}{k}_{e}\left({M}_{p}\ell r–{I}_{p}–{M}_{p}{\ell }^{2}\right)}{R{r}^{2}\alpha }& \frac{{{M}_{p}}^{2}g{\ell }^{2}}{\alpha }& 0\\ 0& 0& 0& 1\\ 0& \frac{2{k}_{m}{k}_{e}\left(r\beta –{M}_{p}\ell \right)}{R{r}^{2}\alpha }& \frac{{M}_{p}g\ell \beta }{\alpha }& 0\end{array}\right]\left[\begin{array}{c}x\\ \stackrel{˙}{x}\\ \varphi \\ \stackrel{˙}{\varphi }\end{array}\right]+\left[\begin{array}{c}0\\ \frac{2{k}_{m}\left(-{M}_{p}\ell r+{I}_{p}+{M}_{p}{\ell }^{2}\right)}{Rr\alpha }\\ 0\\ \frac{2{k}_{m}\left({M}_{p}\ell –r\beta \right)}{Rr\alpha }\end{array}\right]{V}_{a}$

### Segway Robot Electronics

#### Motor specifications

EMG30, DC motor with gearbox and encoder, 170 rpm speed, 1.5 kg/cm torque. Motor driver is L298 IC.

#### Sensor Specifications

GP2D12 distance measuring sensor, 10-80 cm range, 5(v) power supply, voltage output