Swing up and stay upright
Pendulum-v1The trajectory data could not be loaded.
Principles
- Key quantity
- angular velocity \(\omega\)
- Threshold speed
- \(\omega^*(\theta)=\sqrt{\tfrac{3g}{l}\,(1-\cos\theta)}\), the speed that just coasts to the top, taken at the next-step angle \(\theta'\)
| Principle | When | Reference |
|---|---|---|
| Accumulate energy | \(|\theta|>0.41\) rad | \(\omega\to\operatorname{sgn}(\omega)\,\omega^*(\theta')\) |
| Stay upright | \(|\theta|\le 0.41\) rad | \(\omega\to-\operatorname{sgn}(\theta')\,\omega^*(\theta')\) |
\(\theta\) is measured from upright and \(\omega\) is its rate. At 0.41 rad the largest torque just holds the pendulum against gravity.
Sample efficiency
Within 36,000 environment steps
- Success criterion
- all 20 evaluation episodes stay within 0.1 rad of upright for their last 2.5 s
- Converges in
- 18 updates
Train it yourself
$ pip install -r requirements.txt
$ python pendulum_swing_up.py