Inverted Pendulum on a cart. More...
#include <inverted-pendulum.hh>
Public Member Functions | |
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... | |
InvertedPendulum (const std::string &inName) | |
Constructor by name. More... | |
~InvertedPendulum () | |
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... | |
Public Member Functions inherited from dynamicgraph::Entity | |
virtual void | display (std::ostream &os) const |
std::ostream & | displaySignalList (std::ostream &os) const |
Entity (const std::string &name) | |
const std::string & | getCommandList () const |
LoggerVerbosity | getLoggerVerbosityLevel () |
LoggerVerbosity | getLoggerVerbosityLevel () |
const std::string & | getName () const |
command::Command * | getNewStyleCommand (const std::string &cmdName) |
CommandMap_t | getNewStyleCommandMap () |
SignalBase< int > & | getSignal (const std::string &signalName) |
const SignalBase< int > & | getSignal (const std::string &signalName) const |
SignalMap | getSignalMap () const |
double | getStreamPrintPeriod () |
double | getStreamPrintPeriod () |
double | getTimeSample () |
double | getTimeSample () |
bool | hasSignal (const std::string &signame) const |
Logger & | logger () |
Logger & | logger () |
const Logger & | logger () const |
const Logger & | logger () const |
void | sendMsg (const std::string &msg, MsgType t=MSG_TYPE_INFO, const std::string &lineId="") |
void | sendMsg (const std::string &msg, MsgType t=MSG_TYPE_INFO, const std::string &lineId="") |
void | setLoggerVerbosityLevel (LoggerVerbosity lv) |
void | setLoggerVerbosityLevel (LoggerVerbosity lv) |
bool | setStreamPrintPeriod (double t) |
bool | setStreamPrintPeriod (double t) |
bool | setTimeSample (double t) |
bool | setTimeSample (double t) |
virtual SignalBase< int > * | test () |
virtual void | test2 (SignalBase< int > *) |
virtual std::ostream & | writeCompletionList (std::ostream &os) const |
virtual std::ostream & | writeGraph (std::ostream &os) const |
virtual | ~Entity () |
Static Public Attributes | |
static const std::string | CLASS_NAME |
Private Member Functions | |
::dynamicgraph::Vector | computeDynamics (const ::dynamicgraph::Vector &inState, const double &inControl, double inTimeStep) |
Compute the evolution of the state of the pendulum. More... | |
Private Attributes | |
double | cartMass_ |
Mass of the cart. More... | |
SignalPtr< double, int > | forceSIN |
Input force acting on the inverted pendulum. More... | |
double | pendulumLength_ |
Length of the pendulum. More... | |
double | pendulumMass_ |
Mass of the pendulum. More... | |
Signal< ::dynamicgraph::Vector, int > | stateSOUT |
State of the inverted pendulum. More... | |
double | viscosity_ |
Viscosity coefficient. More... | |
Additional Inherited Members | |
Public Types inherited from dynamicgraph::Entity | |
typedef std::map< const std::string, command::Command * > | CommandMap_t |
typedef std::map< std::string, SignalBase< int > * > | SignalMap |
Protected Member Functions inherited from dynamicgraph::Entity | |
void | addCommand (const std::string &name, command::Command *command) |
void | entityDeregistration () |
void | entityRegistration () |
void | signalDeregistration (const std::string &name) |
void | signalRegistration (const SignalArray< int > &signals) |
Protected Attributes inherited from dynamicgraph::Entity | |
CommandMap_t | commandMap |
Logger | logger_ |
std::string | name |
SignalMap | signalMap |
Inverted Pendulum on a cart.
This class represents the classical inverted pendulum on a cart. The equation of motion is:
where
A more natural form of the above equation for roboticists is
where
In order to make the system intrinsically stable, we add some viscosity by rewriting:
where is a positive coefficient.
Definition at line 72 of file inverted-pendulum.hh.
InvertedPendulum::InvertedPendulum | ( | const std::string & | inName | ) |
Constructor by name.
Definition at line 29 of file inverted-pendulum.cpp.
InvertedPendulum::~InvertedPendulum | ( | ) |
Definition at line 115 of file inverted-pendulum.cpp.
|
private |
Compute the evolution of the state of the pendulum.
Definition at line 117 of file inverted-pendulum.cpp.
|
inline |
Get the mass of the cart.
Definition at line 104 of file inverted-pendulum.hh.
|
inlinevirtual |
Each entity should provide the name of the class it belongs to.
Reimplemented from dynamicgraph::Entity.
Definition at line 82 of file inverted-pendulum.hh.
|
inlinevirtual |
Header documentation of the python class.
Reimplemented from dynamicgraph::Entity.
Definition at line 85 of file inverted-pendulum.hh.
|
inline |
Get the length of the pendulum.
Definition at line 124 of file inverted-pendulum.hh.
|
inline |
Get the mass of the pendulum.
Definition at line 114 of file inverted-pendulum.hh.
void InvertedPendulum::incr | ( | double | inTimeStep | ) |
Integrate equation of motion over time step given as input.
Definition at line 160 of file inverted-pendulum.cpp.
|
inline |
Set the mass of the cart.
Definition at line 99 of file inverted-pendulum.hh.
|
inline |
Set the length of the cart.
Definition at line 119 of file inverted-pendulum.hh.
|
inline |
Set the mass of the cart.
Definition at line 109 of file inverted-pendulum.hh.
|
private |
Mass of the cart.
Definition at line 147 of file inverted-pendulum.hh.
|
static |
Definition at line 134 of file inverted-pendulum.hh.
|
private |
Input force acting on the inverted pendulum.
Definition at line 140 of file inverted-pendulum.hh.
|
private |
Length of the pendulum.
Definition at line 151 of file inverted-pendulum.hh.
|
private |
Mass of the pendulum.
Definition at line 149 of file inverted-pendulum.hh.
|
private |
State of the inverted pendulum.
Definition at line 144 of file inverted-pendulum.hh.
|
private |
Viscosity coefficient.
Definition at line 153 of file inverted-pendulum.hh.