Jump to content

Cart Pendulum: Difference between revisions

From mintOC
Line 58: Line 58:


<gallery caption="Reference solution plots" widths="500px" heights="300px" perrow="1">
<gallery caption="Reference solution plots" widths="500px" heights="300px" perrow="1">
  Image:Moon_Landing.png| States and discretized control for a local optimum. The free end time <math>t_f</math> was modeled using the additional control <math>t</math>.
  Image:Cart_Pendulum.png| States and discretized control for a local optimum.
</gallery>
</gallery>



Revision as of 08:51, 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

minu∫0tfα⋅x(t)2+β⋅(θ(t)−π)2+γ⋅u(t)2dtsubject tox˙(t)=x˙(t),θ˙(t)=θ˙(t),x¨(t)=u+m⋅g⋅sin⁡(θ)⋅cos⁡(θ)+m⋅θ˙2⋅sin⁡(θ)M+m⋅(1−cos⁡(θ)2),θ¨(t)=−g⋅sin⁡(θ)−u+m⋅g⋅sin⁡(θ)⋅cos⁡(θ)+m⋅θ¨2⋅sin⁡(θ)M+m⋅(1−cos⁡(θ)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],

Parameters

These fixed values are used within the model:

Symbol Value Description
α 10 Objective coefficient for x
β 50 Objective coefficient for θ
γ 0.5 Objective coefficient for u
tf 4 Horizon of the control problem
M 1 Weight of the cart
m 0.1 Weight of the pendulum
g 9.81 Gravitational acceleration

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