This project demonstrates the stabilization of a pendulum system using adaptive control techniques. The simulation explores different control strategies, including energy-based control and adaptive parameter estimation.
The derivation is described in derivation.png.
The pendulum system with friction is modeled by the following equations:
where:
-
$m = 0.337$ kg — pendulum mass -
$l = 0.127$ m — pendulum length -
$g = 9.81$ m/s² — gravity constant -
$C = 0.08$ — friction coefficient -
$(\vartheta, \omega)$ — angle and angular velocity (state variables) -
$\tau$ — torque (control action)
- Energy-based control with known friction parameters
- Adaptive control that estimates friction coefficients online
- Comparative analysis of control strategies
- Python 3.8+
- uv for package management
If you don't have uv installed, run:
curl -LsSf https://astral.sh/uv/install.sh | shClone the repository and install dependencies:
git clone https://github.com/yourusername/adaptive-pendulum.git
cd adaptive-pendulumThree simulation modes are available:
# 1. Energy-based control with zero friction coefficient (fails to stabilize)
uv run eval.py --eval-type energy_based --friction-coeff=0.0
# 2. Energy-based control with correct friction coefficient (stabilizes)
uv run eval.py --eval-type energy_based --friction-coeff=0.08
# 3. Adaptive control (stabilizes by estimating friction parameters online)
uv run eval.py --eval-type adaptiveThe simulations demonstrate:


