Jump to content

Cart Pendulum: Difference between revisions

From mintOC
Line 14: Line 14:
<math>
<math>
  \begin{array}{lll}
  \begin{array}{lll}
  \displaystyle \min_{u} && \int_{0}^{t_f} dt \\
  \displaystyle \min_{u} && \int_{0}^{t_f} \alpha \cdot x(t)^2 + \beta \cdot (\theta - \pi)^2 + \gamma \cdot u(t)^2 dt \\
  \text{subject to} \\
  \text{subject to} \\
\quad \dot{x}(t) & = & \dot{x}(t),\\
\quad \dot{x}(t) & = & \dot{x}(t),\\
Line 24: Line 24:
\quad \dot{x}(0) &=& 0, \\
\quad \dot{x}(0) &=& 0, \\
\quad \dot{\theta}(0) &=& 0, \\
\quad \dot{\theta}(0) &=& 0, \\
\quad t_f &\geq& 0, \\
\quad x(t) &\in& [-2,2]  \ &\quad \forall t \in [0,t_f], \\
\quad x(t) &\in& [-2,2]  \ &\quad \forall t \in [0,t_f], \\
\quad u(t) &\in& [-30,30]  \ &\quad \forall t \in [0,t_f], \\
\quad u(t) &\in& [-30,30]  \ &\quad \forall t \in [0,t_f], \\

Revision as of 08:39, 3 February 2026

Cart Pendulum
State dimension: 1
Differential states: 3
Discrete control functions: 2


The Cart Pendulum problem concerns a pendulum hinged to a mobile cart. The control objective is to transition the pendulum from a downward position to a stabilized, inverted state above the cart. In this formulation, the objective function is defined by a composite of least-squares terms.

The implementation here is taken from [1]. Its dynamics are given by a four-dimensional ODE model.

Mathematical formulation

minu0tfαx(t)2+β(θπ)2+γu(t)2dtsubject tox˙(t)=x˙(t),θ˙(t)=θ˙(t),x¨(t)=u+mgsin(θ)cos(θ)+mθ˙2sin(θ)M+m(1cos(θ)2),θ¨(t)=gsin(θ)u+mgsin(θ)cos(θ)+mθ¨2sin(θ)M+m(1cos(θ)2)cos(θ),x(0)=0,θ(0)=0,x˙(0)=0,θ˙(0)=0,x(t)[2,2] t[0,tf],u(t)[30,30] t[0,tf],

Reference Solutions

Here is one local solution to the above control problem.

Miscellaneous and Further Reading

This formulation and a detailed description can be found in [1].

References

[1] Multidisciplinary Optimal Control Library: https://openmdao.org/dymos/docs/latest/examples/moon_landing/moon_landing.html