|
bitsim
Model, simulate, estimate and control robots in C++
|
A cart on a straight track, pushed by a horizontal force F, with a pole hinged on it. More...
#include <cart_pole_dynamics.h>
Public Member Functions | |
| CartPoleDynamics (const CartPoleParameters ¶meters=CartPoleParameters(), const CartPoleState &state=CartPoleState::Zero()) | |
| void | step (real_t force, real_t dt) |
| Advance by dt [s], with the force F [N] held over the step. | |
| CartPoleState | derivative (const CartPoleState &x, real_t force) const |
| CartPoleLinearModel | linearise (const CartPoleState &x=CartPoleState::Zero(), real_t force=0.0) const |
| real_t | limit (real_t force) const |
| real_t | energy (const CartPoleState &x) const |
| bool | off_track () const |
| const CartPoleState & | state () const noexcept |
| CartPoleState & | state () noexcept |
| const CartPoleParameters & | parameters () const noexcept |
| real_t | time () const noexcept |
A cart on a straight track, pushed by a horizontal force F, with a pole hinged on it.
The pole is a uniform rod of mass m with its centre l from the pivot, on a cart of mass M, without friction. With \(\theta\) the angle of the pole from upright,
\[\ddot\theta = \frac{g \sin\theta - \cos\theta \, \tau}{l \left(\tfrac{4}{3} - \tfrac{m \cos^2\theta}{M + m}\right)}, \quad \ddot x = \tau - \frac{m l \ddot\theta \cos\theta}{M + m}, \quad \tau = \frac{F + m l \dot\theta^2 \sin\theta}{M + m} , \]
the equations of Barto, Sutton and Anderson. Upright, \(\theta = 0\), is an equilibrium, and an unstable one: the model is the classic test of a controller that has to balance something.
step() integrates with fourth order Runge-Kutta, with the force first limited to max_force. The track is not a wall: off_track() says when the cart has gone past its end, and the application decides what that means.
|
explicit |
| CartPoleState bitsim::dynamics::CartPoleDynamics::derivative | ( | const CartPoleState & | x, |
| real_t | force ) const |
| real_t bitsim::dynamics::CartPoleDynamics::energy | ( | const CartPoleState & | x | ) | const |
| real_t bitsim::dynamics::CartPoleDynamics::limit | ( | real_t | force | ) | const |
| CartPoleLinearModel bitsim::dynamics::CartPoleDynamics::linearise | ( | const CartPoleState & | x = CartPoleState::Zero(), |
| real_t | force = 0.0 ) const |
| bool bitsim::dynamics::CartPoleDynamics::off_track | ( | ) | const |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
| void bitsim::dynamics::CartPoleDynamics::step | ( | real_t | force, |
| real_t | dt ) |
Advance by dt [s], with the force F [N] held over the step.
|
inlinenoexcept |