Finding equations of motion for inverted pendulum using Lagrange

754 Views Asked by At

I studied engineering 10 years ago but am struggling to remember how to find the equations of motion for this project of mine.

I have a two wheeled inverted pendulum that I want to balance.

$M_w = $ wheel mass, $I_w = $ wheel inertia, $r = $ wheel radius

$M_b = $ body mass, $I_b = $ body inertia, $l = $ body length to center of mass

$x = $ displacement along ground

$\theta = $ angle from vertical

Using Lagrange I have.

$T = \frac{1}{2}M_{w}v_{w}^{2} + \frac{1}{2}I_{w}\omega _{w}^{2} + \frac{1}{2}M_{b}v_{b}^{2} + \frac{1}{2}I_{b}\omega _{b}^{2}$

$V = m_{b}gl\cos(\theta)$

where

$v_w = \dot{x}$

$\omega_w = \dot{x}/r$

$v_b = (\dot{x} + l\dot{\theta}cos(\theta))_\hat{i} - (l\dot{\theta}sin(\theta))_\hat{j}$

$v_b . v_b = (\dot{x} + l\dot{\theta}cos(\theta))_\hat{i}^2 - (l\dot{\theta}sin(\theta))_\hat{j}^2$

so

$L = \frac{1}{2}M_{w}\dot{x}^{2} + \frac{1}{2}I_{w}\frac{\dot{x}^2}{r^2} + \frac{1}{2}M_{b}v_{b}.v_{b} + \frac{1}{2}I_{b}\dot{\theta}^{2} -m_{b}gl\cos(\theta)$

Look ok so far?