Calculating the angular velocity

664 Views Asked by At

I have an inverted pendulum with a accelerometer mounted on the top that at rest gives me a vector up opposite to gravity, which is used to calculate the angle of the pendulum. Is it possible to calculate the angular velocity from this information?

1

There are 1 best solutions below

0
On

The Lagrangian of the pendulum in xy-plane $$L=T-V=\frac12m(\dot x^2+\dot y^2)-m\,g\,y$$ where x and y are coordinates of center of mass m. If we assume that $\theta$ is the angle between x-axis and the rod of pendulum it follows that $$x=l\cos(\theta)$$ $$\dot x=-l\sin(\theta)\,\dot \theta$$ $$y=l\sin(\theta)$$ $$\dot y=l\cos(\theta)\,\dot \theta$$ where l is the distance between origin and center of mass. By rewriting the Lagrangian $$L=\frac12m\bigg((-l\sin(\theta)\,\dot \theta)^2+(l\cos(\theta)\,\dot \theta)^2\bigg)-m\,g\,l\sin(\theta)$$ $$L=\frac12m\,l^2(\dot \theta)^2-m\,g\,l\sin(\theta)$$ The equations of motion are $$\frac{d}{dt}\bigg(\frac{\partial L}{\partial \dot \theta}\bigg)-\frac{\partial L}{\partial \theta}=M$$ where M is the function of moment. For sake of simplicity we assume that M=0. $$\ddot \theta-\frac gl \cos(\theta)=0$$

From here you have two options: you can linearize around $\pi/2$ or use numerical methods. If you use linearity then $$\cos(\theta=\pi/2)\approx \cos(\pi/2)-\sin(\pi/2)(\alpha)+O(\epsilon^2)=-\alpha$$ where $\alpha=\theta-\pi/2$ and therefore $$\ddot \alpha-\frac gl \alpha=0$$ which has the solution $a=\sqrt{g/l}$ $$\alpha(t)=\frac{a}{2}\bigg(e^{at}+e^{-at}\bigg)=\alpha \cosh(\alpha\,t)$$ and $$\dot \alpha(t)=\frac{a^2}{2}\bigg(e^{at}-e^{-at}\bigg)=\alpha^2 \sinh(\alpha\,t)$$ which you can use for a parametric relationship between angle and velocity.