class
#include <iDynTree/Integrator.h>
Integrator The Integrator base class.
Inherit publicly from this class in order to specify a custom integration method.
Derived classes
- class FixedStepIntegrator
Constructors, destructors, conversion operators
- Integrator()
- Integrator default constructor.
-
Integrator(const std::shared_ptr<iDynTree::
optimalcontrol:: DynamicalSystem> dynamicalSystem) - Integrator constructor.
- Integrator(const Integrator& other) deleted
- ~Integrator() virtual
Public functions
- auto integrate(double initialTime, double finalTime) -> bool pure virtual
- Integrate the dynamical system with specified integration bounds.
- auto setMaximumStepSize(const double dT) -> bool
- Specify the maximum integration step size.
- auto maximumStepSize() const -> double
- Return the maximum step size set with setMaximumStepSize.
-
auto setDynamicalSystem(const std::shared_ptr<iDynTree::
optimalcontrol:: DynamicalSystem> dynamicalSystem) -> bool - Set the DynamicalSystem to be considered.
- auto dynamicalSystem() const -> const std::weak_ptr<DynamicalSystem>
- Weak pointer to the specified DynamicalSystem.
- auto getSolution(double time, VectorDynSize& solution) const -> bool virtual
- Retrieve integration solution at a specified time.
- auto getFullSolution() const -> const std::vector<SolutionElement>& virtual
- Retrieve the full buffer of SolutionElement.
- void clearSolution() virtual
- Clear the solution buffer.
- auto evaluateCollocationConstraint(double time, const std::vector<VectorDynSize>& collocationPoints, const std::vector<VectorDynSize>& controlInputs, double dT, VectorDynSize& constraintValue) -> bool virtual
- Evaluate the collocation constraint.
- auto evaluateCollocationConstraintJacobian(double time, const std::vector<VectorDynSize>& collocationPoints, const std::vector<VectorDynSize>& controlInputs, double dT, std::vector<MatrixDynSize>& stateJacobianValues, std::vector<MatrixDynSize>& controlJacobianValues) -> bool virtual
- auto getCollocationConstraintJacobianStateSparsity(std::vector<SparsityStructure>& stateJacobianSparsity) -> bool virtual
- auto getCollocationConstraintJacobianControlSparsity(std::vector<SparsityStructure>& controlJacobianSparsity) -> bool virtual
- auto evaluateCollocationConstraintSecondDerivatives(double time, const std::vector<VectorDynSize>& collocationPoints, const std::vector<VectorDynSize>& controlInputs, double dT, const VectorDynSize& lambda, CollocationHessianMap& stateSecondDerivative, CollocationHessianMap& controlSecondDerivative, CollocationHessianMap& stateControlSecondDerivative) -> bool virtual
- auto getCollocationConstraintSecondDerivativeWRTStateSparsity(CollocationHessianSparsityMap& stateDerivativeSparsity) -> bool virtual
- auto getCollocationConstraintSecondDerivativeWRTControlSparsity(CollocationHessianSparsityMap& controlDerivativeSparsity) -> bool virtual
- auto getCollocationConstraintSecondDerivativeWRTStateControlSparsity(CollocationHessianSparsityMap& stateControlDerivativeSparsity) -> bool virtual
- auto info() const -> const IntegratorInfo&
Protected functions
- auto interpolatePoints(const std::vector<SolutionElement>::const_iterator& first, const std::vector<SolutionElement>::const_iterator& second, double time, VectorDynSize& outputPoint) const -> bool virtual
- auto allocateBuffers() -> bool virtual
Protected variables
- double m_dTmax
- std::shared_ptr<DynamicalSystem> m_dynamicalSystem_ptr
- std::vector<SolutionElement> m_solution
- std::shared_ptr<IntegratorInfoData> m_infoData
- IntegratorInfo m_info
Function documentation
iDynTree:: optimalcontrol:: integrators:: Integrator:: Integrator()
Integrator default constructor.
This constructor allows to create an Integrator object without specifying a DynamicalSystem yet. This has to be done via the method setDynamicalSystem before calling the integrate method.
iDynTree:: optimalcontrol:: integrators:: Integrator:: Integrator(const std::shared_ptr<iDynTree:: optimalcontrol:: DynamicalSystem> dynamicalSystem)
Integrator constructor.
Parameters | |
---|---|
dynamicalSystem in | Pointer to the DynamicalSystem to be integrated. |
bool iDynTree:: optimalcontrol:: integrators:: Integrator:: integrate(double initialTime,
double finalTime) pure virtual
Integrate the dynamical system with specified integration bounds.
Parameters | |
---|---|
initialTime in | Lower integration bound. |
finalTime in | Upper integration bound. |
Returns | true if successfull. |
This method should be implemented by the custom integrator.
bool iDynTree:: optimalcontrol:: integrators:: Integrator:: setMaximumStepSize(const double dT)
Specify the maximum integration step size.
Parameters | |
---|---|
dT in | The masimum step size. |
Returns | true if successfull, false otherwise (for example if dT is not strictly positive) |
This parameter is considered when integrating a DynamicalSystem.
bool iDynTree:: optimalcontrol:: integrators:: Integrator:: setDynamicalSystem(const std::shared_ptr<iDynTree:: optimalcontrol:: DynamicalSystem> dynamicalSystem)
Set the DynamicalSystem to be considered.
Parameters | |
---|---|
dynamicalSystem in | The dynamical system pointer |
Returns | true if successfull, false otherwise, for example if a DynamicalSystem was already set. |
This methods changes the dynamical system only if it was not already set.
bool iDynTree:: optimalcontrol:: integrators:: Integrator:: getSolution(double time,
VectorDynSize& solution) const virtual
Retrieve integration solution at a specified time.
Parameters | |
---|---|
time in | Instant of interest. |
solution | State corresponding to the specified time. |
Returns | true if successfull. |
The method integrate should have been called first, and time should be within the integration bounds, otherwise returns false.
It sould not be necessary to override this method.
const std::vector<SolutionElement>& iDynTree:: optimalcontrol:: integrators:: Integrator:: getFullSolution() const virtual
Retrieve the full buffer of SolutionElement.
Returns | A const reference to the internal buffer contaning the full output of the integration routine. |
---|
The method integrate should have been called first, and time should be within the integration bounds, otherwise returns false.
It sould not be necessary to override this method.
bool iDynTree:: optimalcontrol:: integrators:: Integrator:: evaluateCollocationConstraint(double time,
const std::vector<VectorDynSize>& collocationPoints,
const std::vector<VectorDynSize>& controlInputs,
double dT,
VectorDynSize& constraintValue) virtual
Evaluate the collocation constraint.
Parameters | |
---|---|
time in | Instant at which the collocation constraint is evaluated |
collocationPoints in | A vector containing and . Notice that corresponds to the state at instant (time + dT). |
controlInputs in | A vector containing and . Notice that is supposed to be applied at instant (time + dT). |
dT in | The time distance between and . |
constraintValue out | The result of . |
Returns | True if successfull, false otherwise (or if not implemented). |
In some optimal control solvers, like the MultipleShootingSolver, we need to discretize the dynamical system associated to the optimal control problem. This function evaluates the discretization error according to specified integration method. The Integrator, when integrating a dynamical system, is performing the following discretization:
where is the discretized output. For example, using forward euler, we would have
This function returns the result of .