Inverted Pendulum on a cart. More...
#include <dynamic-graph/tutorial/inverted-pendulum.hh>
Public Member Functions | |
InvertedPendulum (const std::string &inName) | |
Constructor by name. More... | |
~InvertedPendulum () | |
virtual const std::string & | getClassName (void) const |
Each entity should provide the name of the class it belongs to. More... | |
virtual std::string | getDocString () const |
Header documentation of the python class. More... | |
void | incr (double inTimeStep) |
Integrate equation of motion over time step given as input. More... | |
Parameters | |
void | setCartMass (const double &inMass) |
Set the mass of the cart. More... | |
double | getCartMass () const |
Get the mass of the cart. More... | |
void | setPendulumMass (const double &inMass) |
Set the mass of the cart. More... | |
double | getPendulumMass () const |
Get the mass of the pendulum. More... | |
void | setPendulumLength (const double &inLength) |
Set the length of the cart. More... | |
double | getPendulumLength () const |
Get the length of the pendulum. More... | |
Static Public Attributes | |
static const std::string | CLASS_NAME |
Inverted Pendulum on a cart.
This class represents the classical inverted pendulum on a cart. The equation of motion is:
\begin{eqnarray*} \left ( M + m \right ) \ddot x - m l \ddot \theta \cos \theta + m l \dot \theta^2 \sin \theta &=& F\\ m l (-g \sin \theta - \ddot x \cos \theta + l \ddot \theta) &=& 0 \end{eqnarray*}
where
A more natural form of the above equation for roboticists is
\[ \textbf{M}(\textbf{q})\ddot{\textbf{q}} + \textbf{N}(\textbf{q},\dot{\textbf{q}})\dot{\textbf{q}} + \textbf{G}(\textbf{q}) = \textbf{F} \]
where
\begin{eqnarray*} \textbf{q} &=& (x, \theta) \\ \textbf{M}(\textbf{q}) &=& \left( \begin{array}{cc} M + m & -m\ l\ \cos\theta \\ -m\ l\ \cos\theta & m\ l^2 \end{array}\right) \\ \textbf{N}(\textbf{q},\dot{\textbf{q}}) &=& \left( \begin{array}{cc} 0 & m\ l\ \dot{\theta} \sin\theta \\ 0 & 0 \end{array}\right)\\ \textbf{G}(\textbf{q}) &=& \left( \begin{array}{c} 0 \\ -m\ l\ g\ \sin\theta \end{array}\right)\\ \textbf{F} &=& \left( \begin{array}{c} F \\ 0 \end{array}\right) \end{eqnarray*}
In order to make the system intrinsically stable, we add some viscosity by rewriting:
\begin{eqnarray*} \textbf{N}(\textbf{q},\dot{\textbf{q}}) &=& \left( \begin{array}{cc} \lambda & m\ l\ \dot{\theta} \sin\theta\\ 0 & \lambda \end{array}\right) \end{eqnarray*}
where \(\lambda\) is a positive coefficient.
dynamicgraph::tutorial::InvertedPendulum::InvertedPendulum | ( | const std::string & | inName | ) |
Constructor by name.
dynamicgraph::tutorial::InvertedPendulum::~InvertedPendulum | ( | ) |
|
inline |
Get the mass of the cart.
|
inlinevirtual |
Each entity should provide the name of the class it belongs to.
|
inlinevirtual |
Header documentation of the python class.
|
inline |
Get the length of the pendulum.
|
inline |
Get the mass of the pendulum.
void dynamicgraph::tutorial::InvertedPendulum::incr | ( | double | inTimeStep | ) |
Integrate equation of motion over time step given as input.
|
inline |
Set the mass of the cart.
|
inline |
Set the length of the cart.
|
inline |
Set the mass of the cart.
|
static |