inverted-pendulum.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2010,
3  * Florent Lamiraux
4  *
5  * CNRS
6  *
7  */
8 
9 #ifndef DG_TUTORIAL_INVERTED_PENDULUM_HH
10 #define DG_TUTORIAL_INVERTED_PENDULUM_HH
11 
12 #include <dynamic-graph/entity.h>
15 
16 namespace dynamicgraph {
17 namespace tutorial {
18 
72 class InvertedPendulum : public Entity {
73  public:
77  InvertedPendulum(const std::string& inName);
78 
80 
82  virtual const std::string& getClassName(void) const { return CLASS_NAME; }
83 
85  virtual std::string getDocString() const {
86  return "Classical inverted pendulum dynamic model\n";
87  }
88 
90  void incr(double inTimeStep);
91 
99  void setCartMass(const double& inMass) { cartMass_ = inMass; }
100 
104  double getCartMass() const { return cartMass_; }
105 
109  void setPendulumMass(const double& inMass) { pendulumMass_ = inMass; }
110 
114  double getPendulumMass() const { return pendulumMass_; }
115 
119  void setPendulumLength(const double& inLength) { pendulumLength_ = inLength; }
120 
124  double getPendulumLength() const { return pendulumLength_; }
125 
130  public:
131  /*
132  \brief Class name
133  */
134  static const std::string CLASS_NAME;
135 
136  private:
145 
147  double cartMass_;
153  double viscosity_;
154 
158  ::dynamicgraph::Vector computeDynamics(const ::dynamicgraph::Vector& inState,
159  const double& inControl,
160  double inTimeStep);
161 };
162 } // namespace tutorial
163 } // namespace dynamicgraph
164 #endif
signal-ptr.h
dynamicgraph::Signal< ::dynamicgraph::Vector, int >
dynamicgraph::tutorial::InvertedPendulum::computeDynamics
::dynamicgraph::Vector computeDynamics(const ::dynamicgraph::Vector &inState, const double &inControl, double inTimeStep)
Compute the evolution of the state of the pendulum.
Definition: inverted-pendulum.cpp:117
dynamicgraph::tutorial::InvertedPendulum::InvertedPendulum
InvertedPendulum(const std::string &inName)
Constructor by name.
Definition: inverted-pendulum.cpp:29
dynamicgraph::SignalPtr< double, int >
dynamicgraph
dynamicgraph::tutorial::InvertedPendulum::~InvertedPendulum
~InvertedPendulum()
Definition: inverted-pendulum.cpp:115
dynamicgraph::Entity
dynamicgraph::tutorial::InvertedPendulum::getCartMass
double getCartMass() const
Get the mass of the cart.
Definition: inverted-pendulum.hh:104
dynamicgraph::tutorial::InvertedPendulum::getDocString
virtual std::string getDocString() const
Header documentation of the python class.
Definition: inverted-pendulum.hh:85
dynamicgraph::tutorial::InvertedPendulum::getPendulumLength
double getPendulumLength() const
Get the length of the pendulum.
Definition: inverted-pendulum.hh:124
dynamicgraph::tutorial::InvertedPendulum::pendulumLength_
double pendulumLength_
Length of the pendulum.
Definition: inverted-pendulum.hh:151
dynamicgraph::tutorial::InvertedPendulum::stateSOUT
Signal< ::dynamicgraph::Vector, int > stateSOUT
State of the inverted pendulum.
Definition: inverted-pendulum.hh:144
dynamicgraph::tutorial::InvertedPendulum::cartMass_
double cartMass_
Mass of the cart.
Definition: inverted-pendulum.hh:147
dynamicgraph::tutorial::InvertedPendulum::incr
void incr(double inTimeStep)
Integrate equation of motion over time step given as input.
Definition: inverted-pendulum.cpp:160
dynamicgraph::tutorial::InvertedPendulum::CLASS_NAME
static const std::string CLASS_NAME
Definition: inverted-pendulum.hh:134
dynamicgraph::tutorial::InvertedPendulum::setPendulumLength
void setPendulumLength(const double &inLength)
Set the length of the cart.
Definition: inverted-pendulum.hh:119
dynamicgraph::Vector
Eigen::VectorXd Vector
dynamicgraph::tutorial::InvertedPendulum::viscosity_
double viscosity_
Viscosity coefficient.
Definition: inverted-pendulum.hh:153
dynamicgraph::tutorial::InvertedPendulum::pendulumMass_
double pendulumMass_
Mass of the pendulum.
Definition: inverted-pendulum.hh:149
linear-algebra.h
dynamicgraph::tutorial::InvertedPendulum::forceSIN
SignalPtr< double, int > forceSIN
Input force acting on the inverted pendulum.
Definition: inverted-pendulum.hh:140
dynamicgraph::tutorial::InvertedPendulum::setCartMass
void setCartMass(const double &inMass)
Set the mass of the cart.
Definition: inverted-pendulum.hh:99
dynamicgraph::tutorial::InvertedPendulum::getPendulumMass
double getPendulumMass() const
Get the mass of the pendulum.
Definition: inverted-pendulum.hh:114
dynamicgraph::tutorial::InvertedPendulum::setPendulumMass
void setPendulumMass(const double &inMass)
Set the mass of the cart.
Definition: inverted-pendulum.hh:109
dynamicgraph::tutorial::InvertedPendulum
Inverted Pendulum on a cart.
Definition: inverted-pendulum.hh:72
dynamicgraph::tutorial::InvertedPendulum::getClassName
virtual const std::string & getClassName(void) const
Each entity should provide the name of the class it belongs to.
Definition: inverted-pendulum.hh:82


dynamic-graph-tutorial
Author(s): Nicolas Mansard, Olivier Stasse
autogenerated on Tue Jun 20 2023 02:35:58