Derivation, simulation, and control of a rigid-body double pendulum with a moving base, control torques, and an external wind force.
The model consists of a 2 DOF double pendulum, where the DOF are defined as the segment angles
Each segment is modeled as a rigid-body with a length
The dynamics equations of motion are derived symbolically via Lagrangian mechanics in a MATLAB Live Script: dynamics/free_forced_rigid_double_pendulum_with_wind_dynamics.mlx
The derivation code is designed to be easily modifiable. If one wishes to change certain model properties (for instance make damping proportion to velocity squared, etc.) the code can be modified and re-run.
The final output of the derivation code is the nonlinear state-space equations required to simulate the model, which can be copy-pasted for use with an ODE solver. The current dynamics are defined in the DoublePendulumModel class in double_pendulum.py in the f method
This repository makes use of the pybounds Python package (https://github.com/vanbreugel-lab/pybounds) to simulate and control the derived dynamics. It is recommended to install pybounds from source:
pip install pandas
pip install do-mpc
pip install git+https://github.com/vanbreugel-lab/pybounds
A nice feature of the simulation code is that it is easy to exclude certain parts of the dynamics by adjusting the model parameters. For instance, one can effectively turn off gravity, wind, given springs and dampers, etc., and even turn the double-pendulum into a single-pendulum by setting parameters to 0 accordingly.
Example simulations are provided as Jupyter notebooks
Include gravity, but no damping or springs
Precisely control the movement of the base, and the 1st segment angle, but leave the 2nd segment under open-loop control. Damping and springs are on. See pybounds for MPC guidance.
example_model_predictive_control.ipynb
Keep the base and 1st segment angle constant and let the wind move the 2nd segment. Damping and springs are on.



