iDynTree::optimalcontrol::LinearSystem class

Base classes

class DynamicalSystem
DynamicalSystem base class.

Constructors, destructors, conversion operators

LinearSystem(size_t stateSize, size_t controlSize)
LinearSystem(size_t stateSize, size_t controlSize, const iDynTree::optimalcontrol::SparsityStructure& stateSparsity, const iDynTree::optimalcontrol::SparsityStructure& controlSparsity)
LinearSystem(const LinearSystem& other) deleted
~LinearSystem() override

Public functions

auto setStateMatrix(const iDynTree::MatrixDynSize& stateMatrix) -> bool
auto setControlMatrix(const iDynTree::MatrixDynSize& controlMatrix) -> bool
auto setStateMatrix(std::shared_ptr<TimeVaryingMatrix> stateMatrix) -> bool
auto setControlMatrix(std::shared_ptr<TimeVaryingMatrix> controlMatrix) -> bool
auto dynamics(const VectorDynSize& state, double time, VectorDynSize& stateDynamics) -> bool final
Computes the system dynamics.
auto dynamicsStateFirstDerivative(const VectorDynSize& state, double time, MatrixDynSize& dynamicsDerivative) -> bool final
Compute the partial derivative of the state dynamics wrt the state.
auto dynamicsControlFirstDerivative(const VectorDynSize& state, double time, MatrixDynSize& dynamicsDerivative) -> bool final
Compute the partial derivative of the state dynamics wrt the control.
auto dynamicsStateFirstDerivativeSparsity(iDynTree::optimalcontrol::SparsityStructure& stateSparsity) -> bool final
Returns the set of nonzeros elements in terms of row and colun index, in the state jacobian.
auto dynamicsControlFirstDerivativeSparsity(iDynTree::optimalcontrol::SparsityStructure& controlSparsity) -> bool final
Returns the set of nonzeros elements in terms of row and colun index, in the control jacobian.
auto dynamicsSecondPartialDerivativeWRTState(double time, const iDynTree::VectorDynSize& state, const iDynTree::VectorDynSize& lambda, iDynTree::MatrixDynSize& partialDerivative) -> bool final
Evaluate the dynamics second partial derivative wrt the state variables.
auto dynamicsSecondPartialDerivativeWRTControl(double time, const iDynTree::VectorDynSize& state, const iDynTree::VectorDynSize& lambda, iDynTree::MatrixDynSize& partialDerivative) -> bool final
Evaluate the dynamics second partial derivative wrt the control.
auto dynamicsSecondPartialDerivativeWRTStateControl(double time, const iDynTree::VectorDynSize& state, const iDynTree::VectorDynSize& lambda, iDynTree::MatrixDynSize& partialDerivative) -> bool final
Evaluate the dynamics second partial derivative wrt the state and control.
auto dynamicsSecondPartialDerivativeWRTStateSparsity(iDynTree::optimalcontrol::SparsityStructure& stateSparsity) -> bool final
Returns the set of nonzeros elements in terms of row and colun index, in the state hessian.
auto dynamicsSecondPartialDerivativeWRTStateControlSparsity(iDynTree::optimalcontrol::SparsityStructure& stateControlSparsity) -> bool final
Returns the set of nonzeros elements in terms of row and colun index, in the mixed hessian.
auto dynamicsSecondPartialDerivativeWRTControlSparsity(iDynTree::optimalcontrol::SparsityStructure& controlSparsity) -> bool final
Returns the set of nonzeros elements in terms of row and colun index, in the control hessian.

Function documentation

bool iDynTree::optimalcontrol::LinearSystem::dynamics(const VectorDynSize& state, double time, VectorDynSize& stateDynamics) final

Computes the system dynamics.

Parameters
state in The state point in which the dynamics is computed.
time in The time at which the dynamics is computed.
stateDynamics out The value of the state derivative.
Returns True if successfull.

It return $ f(t,x) $ . Notice that here the dependency from the control input is removed, so that basically we are assuming an autonomous system. If the system is controlled, the control input will be set separately with the method setControlInput. This was necessary since the Integrator class needs an autonomous system to be integrated. See ControlledDynamicalSystem class in case you want to join a DynamicalSystem with a Controller.

bool iDynTree::optimalcontrol::LinearSystem::dynamicsStateFirstDerivative(const VectorDynSize& state, double time, MatrixDynSize& dynamicsDerivative) final

Compute the partial derivative of the state dynamics wrt the state.

Parameters
state in The state value at which computing the partial derivative.
time in The time at which computing the partial derivative.
dynamicsDerivative out The output derivative. It has to be a square matrix with dimension equal to the state size.
Returns True if successful, false otherwise (or if not implemented).

Namely it computes, $ \frac{\partial f(t,x,u)}{\partial x}$ . By default it return false;

bool iDynTree::optimalcontrol::LinearSystem::dynamicsControlFirstDerivative(const VectorDynSize& state, double time, MatrixDynSize& dynamicsDerivative) final

Compute the partial derivative of the state dynamics wrt the control.

Parameters
state in The state value at which computing the partial derivative.
time in The time at which computing the partial derivative.
dynamicsDerivative out The output derivative. It has to be a matrix with number of rows equal to the state size and number of columns equal to the control size.
Returns True if successful, false otherwise (or if not implemented).

Namely it computes, $ \frac{\partial f(t,x,u)}{\partial u}$ . By default it return false;

bool iDynTree::optimalcontrol::LinearSystem::dynamicsStateFirstDerivativeSparsity(iDynTree::optimalcontrol::SparsityStructure& stateSparsity) final

Returns the set of nonzeros elements in terms of row and colun index, in the state jacobian.

Parameters
stateSparsity Sparsity structure of the partial derivative of the jacobian wrt state variables.
Returns true if the sparsity is available. False otherwise.

bool iDynTree::optimalcontrol::LinearSystem::dynamicsControlFirstDerivativeSparsity(iDynTree::optimalcontrol::SparsityStructure& controlSparsity) final

Returns the set of nonzeros elements in terms of row and colun index, in the control jacobian.

Parameters
controlSparsity Sparsity structure of the partial derivative of the jacobian wrt state variables.
Returns true if the sparsity is available. False otherwise.

bool iDynTree::optimalcontrol::LinearSystem::dynamicsSecondPartialDerivativeWRTState(double time, const iDynTree::VectorDynSize& state, const iDynTree::VectorDynSize& lambda, iDynTree::MatrixDynSize& partialDerivative) final

Evaluate the dynamics second partial derivative wrt the state variables.

Parameters
time in The time at which the partial derivative is computed.
state in The state value at which the partial derivative is computed.
lambda in The associated lagrange multipliers
partialDerivative out The output partial derivative.
Returns True if successfull, false otherwise (or if not implemented).

It is the result of $\frac{\partial^2 f(t, x, u)}{\partial x^2}$

bool iDynTree::optimalcontrol::LinearSystem::dynamicsSecondPartialDerivativeWRTControl(double time, const iDynTree::VectorDynSize& state, const iDynTree::VectorDynSize& lambda, iDynTree::MatrixDynSize& partialDerivative) final

Evaluate the dynamics second partial derivative wrt the control.

Parameters
time in The time at which the partial derivative is computed.
state in The state value at which the partial derivative is computed.
lambda in The associated lagrange multipliers
partialDerivative out The output partial derivative.
Returns True if successfull, false otherwise (or if not implemented).

It is the result of $\frac{\partial^2 f(t, x, u)}{\partial u^2}$

bool iDynTree::optimalcontrol::LinearSystem::dynamicsSecondPartialDerivativeWRTStateControl(double time, const iDynTree::VectorDynSize& state, const iDynTree::VectorDynSize& lambda, iDynTree::MatrixDynSize& partialDerivative) final

Evaluate the dynamics second partial derivative wrt the state and control.

Parameters
time in The time at which the partial derivative is computed.
state in The state value at which the partial derivative is computed.
lambda in The associated lagrange multipliers
partialDerivative out The output partial derivative.
Returns True if successfull, false otherwise (or if not implemented).

It is the result of $\frac{\partial^2 f(t, x, u)}{\partial x \partial u}$ , thus it has number of rows equals to the number of states and number of cols equal to the number of control inputs.

bool iDynTree::optimalcontrol::LinearSystem::dynamicsSecondPartialDerivativeWRTStateSparsity(iDynTree::optimalcontrol::SparsityStructure& stateSparsity) final

Returns the set of nonzeros elements in terms of row and colun index, in the state hessian.

Parameters
stateSparsity out Sparsity structure of the partial derivative of the jacobian wrt state variables.
Returns true if the sparsity is available. False otherwise.

bool iDynTree::optimalcontrol::LinearSystem::dynamicsSecondPartialDerivativeWRTStateControlSparsity(iDynTree::optimalcontrol::SparsityStructure& stateControlSparsity) final

Returns the set of nonzeros elements in terms of row and colun index, in the mixed hessian.

Parameters
stateControlSparsity out Sparsity structure of the partial derivative of the jacobian wrt state and control variables.
Returns true if the sparsity is available. False otherwise.

bool iDynTree::optimalcontrol::LinearSystem::dynamicsSecondPartialDerivativeWRTControlSparsity(iDynTree::optimalcontrol::SparsityStructure& controlSparsity) final

Returns the set of nonzeros elements in terms of row and colun index, in the control hessian.

Parameters
controlSparsity out Sparsity structure of the partial derivative of the jacobian wrt control variables.
Returns true if the sparsity is available. False otherwise.