Lagrangian Dynamics of an inverted Spherical Cart Pendulum

classical-mechanicscoordinate systemsdifferential equationskinematicslagrangian-formalism

Introduction

I have to come up with a PD-controller for an inverted Spherical Cart Pendulum, therefore I tried to compute the Dynamics of such a Pendulum.
Spherical Pendulum

The Spherical Cart Pendulum is a hybrid between the Cart Pole and the Spherical Pendulum. The underlying Cart can move in the X-Y Plane.

Cart Pole

Basics

$l$ is the length of the Pendulum, $m_p$ is the mass of the pendulum, $m_c$ is the mass of the cart, $\theta$ denotes the azimuthal and $\phi$ the polar

As generalized Coordinates I use the conversion between spherical Coordinates and cartesian Coordinates:

$$x=l\sin(\theta)\cos(\phi)$$
$$y=l\sin(\theta)\sin(\phi)$$
$$z=l\cos(\theta)$$

The generalized Coordinates for the Pendulum look like this:

$$x_p=l\sin(\theta)\cos(\phi)+x$$
$$y_p=l\sin(\theta)\sin(\phi)+y$$
$$z_p=l\cos(\theta)$$
and
$$\dot x_p = -l\sin(\phi)\sin(\theta)\dot\phi+l\cos(\phi)\cos(\theta)\dot\theta+\dot x$$
$$\dot y_p = l\sin(\phi)\cos(\theta)\dot\theta+l\sin(\theta)\cos(\phi)\dot\phi+\dot y$$
$$\dot z_p = -l\sin(\theta)\dot \theta$$
The Lagrangian Equation is defined by:
$$L=T-V$$
with
$$T=T_c+T_p$$
$$T_c=\frac{1}{2}m_c(\dot x^2+\dot y^2)$$
$$T_c=\frac{1}{2}m_p(\dot x_p^2+\dot y_p^2 + \dot z_p^2)$$
and
$$V=m_p\cdot g \cdot z_p$$
results in:
$$L=- g l m_{p} \cos{\left(\theta \right)} + 0.5 l^{2} m_{p} \sin^{2}{\left(\theta \right)} \dot{\theta}^{2} + 0.5 m_{c} \dot{x}^{2} + 0.5 m_{c} \dot{y}^{2} + 0.5 m_{p} \left(- l \sin{\left(\phi \right)} \sin{\left(\theta \right)} \dot{\phi} + l \cos{\left(\phi \right)} \cos{\left(\theta \right)} \dot{\theta} + \dot{x}\right)^{2} + 0.5 m_{p} \left(l \sin{\left(\phi \right)} \cos{\left(\theta \right)} \dot{\theta} + l \sin{\left(\theta \right)} \cos{\left(\phi \right)} \dot{\phi} + \dot{y}\right)^{2}$$

and after $$\frac{\partial L}{\partial q_j}-\frac{d}{dt}\frac{\partial L}{\partial \dot q_j}=0$$

I get a set of differential equations$A=(\ddot \phi, \ddot \theta, \ddot x, \ddot y)^T$. They are all looking good, except one:

Now my Problem:

The equilibrium point of the inverted Pendulum I want to control is at $\theta=0$. Therefore the differential equation for
$$
\ddot{\phi} =\frac{- 2 l \cos{\left(\theta \right)} \dot{\phi} \dot{\theta} + \sin{\left(\phi \right)} \ddot{x} – \cos{\left(\phi \right)} \ddot{y}}{l \sin{\left(\theta \right)}}
$$

$$
\lim_{\theta \to 0}\ddot{\phi}=\infty
$$

means that I cannot compute $\theta$ for very small angles. I know that for $\ddot x=0$ and $\ddot y=0$, $\ddot \phi$ is a cyclic Coordinate and displays the angular momentum.

How can I interpret $\ddot \phi$ in a way that my differential equation makes sense and does not explode into the infinity?

Best Answer

Imagine the pendulum swinging along $y=0$, with $x$ changing. As the pendulum swings directly below the cart, $\phi$ instantly changes from 0 to $\pi$, so you would expect $\ddot{\phi}$ to be infinite - when $\theta=0$, $\phi$ can take any value without the mass moving. It's similar to gimbal lock (https://en.wikipedia.org/wiki/Gimbal_lock).

You probably need to rephrase in a different coordinate system or reference frame - for example, set $\theta$ to be the angle from the z-axis in the yz-plane, and $\phi$ to be the angle from the z-axis in the xz-plane, and redo the analysis, that shouldn't lead to either blowing up with the pendulum vertical with $\theta=\phi=0$ (but will have discontinuities with it horizontal if aligned to the axes, so at $\theta=\pi/2$, $phi$ will be similarly undefined).

Related Question