|
DMP_BBO library
|
Interface for implementing dynamical systems. More...
#include <DynamicalSystem.hpp>

Public Member Functions | |
Constructors/Destructor | |
| DynamicalSystem (int order, double tau, Eigen::VectorXd initial_state, Eigen::VectorXd attractor_state, std::string name) | |
| Initialization constructor. More... | |
| virtual | ~DynamicalSystem (void) |
| Destructor. | |
| virtual DynamicalSystem * | clone (void) const =0 |
| Return a pointer to a deep copy of the DynamicalSystem object. More... | |
Main DynamicalSystem functions | |
| virtual void | differentialEquation (const Eigen::Ref< const Eigen::VectorXd > &x, Eigen::Ref< Eigen::VectorXd > xd) const =0 |
| The differential equation which defines the system. More... | |
| virtual void | analyticalSolution (const Eigen::VectorXd &ts, Eigen::MatrixXd &xs, Eigen::MatrixXd &xds) const =0 |
| Return analytical solution of the system at certain times. More... | |
| virtual void | integrateStart (Eigen::Ref< Eigen::VectorXd > x, Eigen::Ref< Eigen::VectorXd > xd) const |
| Start integrating the system. More... | |
| void | integrateStart (const Eigen::VectorXd &x_init, Eigen::Ref< Eigen::VectorXd > x, Eigen::Ref< Eigen::VectorXd > xd) |
| Start integrating the system with a new initial state. More... | |
| virtual void | integrateStep (double dt, const Eigen::Ref< const Eigen::VectorXd > x, Eigen::Ref< Eigen::VectorXd > x_updated, Eigen::Ref< Eigen::VectorXd > xd_updated) const |
| Integrate the system one time step. More... | |
Protected Member Functions | |
| DynamicalSystem (void) | |
| Default constructor. More... | |
Friends | |
| class | boost::serialization::access |
| Give boost serialization access to private members. More... | |
Input/Output | |
| std::ostream & | operator<< (std::ostream &output, const DynamicalSystem &dyn_sys) |
| Write a DynamicalSystem to an output stream. More... | |
| virtual std::string | toString (void) const =0 |
| Returns a string representation of the object. More... | |
Accessor functions | |
| enum | IntegrationMethod { EULER, RUNGE_KUTTA } |
| The possible integration methods that can be used. More... | |
| void | set_integration_method (IntegrationMethod integration_method) |
| Choose the integration method. More... | |
| int | dim (void) const |
| Get the dimensionality of the dynamical system, i.e. More... | |
| int | dim_orig (void) const |
| Get the dimensionality of the dynamical system, i.e. More... | |
| double | tau (void) const |
| Accessor function for the time constant. More... | |
| virtual void | set_tau (double tau) |
| Mutator function for the time constant. More... | |
| Eigen::VectorXd | initial_state (void) const |
| Accessor function for the initial state of the dynamical system. More... | |
| void | initial_state (Eigen::VectorXd &initial_state) const |
| Accessor function for the initial state of the dynamical system. More... | |
| virtual void | set_initial_state (const Eigen::VectorXd &initial_state) |
| Mutator function for the initial state of the dynamical system. More... | |
| Eigen::VectorXd | attractor_state (void) const |
| Accessor function for the attractor state of the dynamical system. More... | |
| void | attractor_state (Eigen::VectorXd &attractor_state) const |
| Accessor function for the attractor state of the dynamical system. More... | |
| virtual void | set_attractor_state (const Eigen::Ref< const Eigen::VectorXd > &attractor_state) |
| Mutator function for the attractor state of the dynamical system. More... | |
| std::string | name (void) const |
| Accessor function for the name of the dynamical system. More... | |
| virtual void | set_name (std::string name) |
| Mutator function for the name of the dynamical system. More... | |
| void | set_dim (int dim) |
| Set the dimensionality of the dynamical system, i.e. More... | |
Interface for implementing dynamical systems.
Other dynamical systems should inherit from this class.
Two pure virtual functions that each DynamicalSystem subclass should implement are
This class provides accesor/mutator methods for some variables typically found in dynamical systems:
This class also provides functionality for integrating a dynamical system by repeatidly calling it's differentialEquation, and doing simple Euler or 4th-order Runge-Kutta integration. The related functions are:
Definition at line 62 of file DynamicalSystem.hpp.
| enum IntegrationMethod |
The possible integration methods that can be used.
Definition at line 190 of file DynamicalSystem.hpp.
| DynamicalSystem | ( | int | order, |
| double | tau, | ||
| Eigen::VectorXd | initial_state, | ||
| Eigen::VectorXd | attractor_state, | ||
| std::string | name | ||
| ) |
Initialization constructor.
| order | Order of the system |
| tau | Time constant, see tau() |
| initial_state | Initial state, see initial_state() |
| attractor_state | Attractor state, see attractor_state() |
| name | A name you give, see name() |
Definition at line 35 of file DynamicalSystem.cpp.
|
inlineprotected |
Default constructor.
Definition at line 375 of file DynamicalSystem.hpp.

|
pure virtual |
Return a pointer to a deep copy of the DynamicalSystem object.
Implemented in Dmp, DmpWithGainSchedules, SpringDamperSystem, ExponentialSystem, TimeSystem, and SigmoidSystem.
|
pure virtual |
The differential equation which defines the system.
It relates state values to rates of change of those state values
| [in] | x | current state (column vector of size dim() X 1) |
| [out] | xd | rate of change in state (column vector of size dim() X 1) |
Implemented in Dmp, SpringDamperSystem, ExponentialSystem, TimeSystem, and SigmoidSystem.
|
pure virtual |
Return analytical solution of the system at certain times.
| [in] | ts | A vector of times for which to compute the analytical solutions |
| [out] | xs | Sequence of state vectors. T x D or D x T matrix, where T is the number of times (the length of 'ts'), and D the size of the state (i.e. dim()) |
| [out] | xds | Sequence of state vectors (rates of change). T x D or D x T matrix, where T is the number of times (the length of 'ts'), and D the size of the state (i.e. dim()) |
Implemented in Dmp, SpringDamperSystem, ExponentialSystem, TimeSystem, and SigmoidSystem.
|
virtual |
Start integrating the system.
| [out] | x | - The first vector of state variables |
| [out] | xd | - The first vector of rates of change of the state variables |
Reimplemented in Dmp.
Definition at line 60 of file DynamicalSystem.cpp.

| void integrateStart | ( | const Eigen::VectorXd & | x_init, |
| Eigen::Ref< Eigen::VectorXd > | x, | ||
| Eigen::Ref< Eigen::VectorXd > | xd | ||
| ) |
Start integrating the system with a new initial state.
| [in] | x_init | - The initial state vector |
| [out] | x | - The first vector of state variable |
| [out] | xd | - The first vector of rates of change of the state variables |
Definition at line 54 of file DynamicalSystem.cpp.

|
virtual |
Integrate the system one time step.
| [in] | dt | Duration of the time step |
| [in] | x | Current state |
| [out] | x_updated | Updated state, dt time later. |
| [out] | xd_updated | Updated rates of change of state, dt time later. |
Definition at line 75 of file DynamicalSystem.cpp.

|
pure virtual |
Returns a string representation of the object.
Implemented in Dmp, ExponentialSystem, SpringDamperSystem, SigmoidSystem, and TimeSystem.
|
inline |
Choose the integration method.
| [in] | integration_method | The integration method, see DynamicalSystem::IntegrationMethod. |
Definition at line 195 of file DynamicalSystem.hpp.
|
inline |
Get the dimensionality of the dynamical system, i.e.
the length of its state vector.
Definition at line 203 of file DynamicalSystem.hpp.
|
inline |
Get the dimensionality of the dynamical system, i.e.
the length of its output.
2nd order systems are represented as 1st order systems with an expanded state. The SpringDamperSystem for instance is represented as x = [y z], xd = [yd zd]. DynamicalSystem::dim() returns dim(x) = dim([y z]) = 2*dim(y) DynamicalSystem::dim_orig() returns dim(y) = dim()/2
For Dynamical Movement Primitives, dim_orig() may be for instance 3, if the output of the DMP represents x,y,z coordinates. However, dim() will have a much larger dimensionality, because it also contains the variables of all the subsystems (phase system, gating system, etc.)
Definition at line 221 of file DynamicalSystem.hpp.
|
inline |
Accessor function for the time constant.
Definition at line 229 of file DynamicalSystem.hpp.
|
inlinevirtual |
Mutator function for the time constant.
| [in] | tau | Time constant |
Reimplemented in Dmp, and SigmoidSystem.
Definition at line 235 of file DynamicalSystem.hpp.

|
inline |
Accessor function for the initial state of the dynamical system.
Definition at line 244 of file DynamicalSystem.hpp.
|
inline |
Accessor function for the initial state of the dynamical system.
| [out] | initial_state | Initial state of the dynamical system. |
Definition at line 250 of file DynamicalSystem.hpp.
|
inlinevirtual |
Mutator function for the initial state of the dynamical system.
| [in] | initial_state | Initial state of the dynamical system. |
Reimplemented in Dmp, and SigmoidSystem.
Definition at line 258 of file DynamicalSystem.hpp.

|
inline |
Accessor function for the attractor state of the dynamical system.
Definition at line 267 of file DynamicalSystem.hpp.
|
inline |
Accessor function for the attractor state of the dynamical system.
| [out] | attractor_state | Attractor state of the dynamical system. |
Definition at line 273 of file DynamicalSystem.hpp.
|
inlinevirtual |
Mutator function for the attractor state of the dynamical system.
| [in] | attractor_state | Attractor state of the dynamical system. |
Definition at line 281 of file DynamicalSystem.hpp.

|
inline |
Accessor function for the name of the dynamical system.
Definition at line 290 of file DynamicalSystem.hpp.
|
inlinevirtual |
Mutator function for the name of the dynamical system.
| [in] | name | Name of the dynamical system. |
Definition at line 295 of file DynamicalSystem.hpp.

|
inlineprotected |
Set the dimensionality of the dynamical system, i.e.
the length of its state vector.
| [in] | dim | Dimensionality of the dynamical system |
Definition at line 304 of file DynamicalSystem.hpp.

|
friend |
Give boost serialization access to private members.
Definition at line 375 of file DynamicalSystem.hpp.
|
friend |
Write a DynamicalSystem to an output stream.
| [in] | output | Output stream to which to write to |
| [in] | dyn_sys | Dynamical system to write |
Definition at line 169 of file DynamicalSystem.hpp.
1.8.11