- 3.0.2 optimal control module.
|
#include <GNRiccatiSolver.hpp>
Public Types | |
typedef LQOCProblem< STATE_DIM, CONTROL_DIM, SCALAR > | LQOCProblem_t |
typedef ct::core::StateMatrix< STATE_DIM, SCALAR > | StateMatrix |
typedef ct::core::StateMatrixArray< STATE_DIM, SCALAR > | StateMatrixArray |
typedef ct::core::ControlVector< CONTROL_DIM, SCALAR > | ControlVector |
typedef ct::core::ControlMatrix< CONTROL_DIM, SCALAR > | ControlMatrix |
typedef ct::core::ControlMatrixArray< CONTROL_DIM, SCALAR > | ControlMatrixArray |
typedef ct::core::StateControlMatrixArray< STATE_DIM, CONTROL_DIM, SCALAR > | StateControlMatrixArray |
typedef ct::core::FeedbackArray< STATE_DIM, CONTROL_DIM, SCALAR > | FeedbackArray |
typedef ct::core::StateVectorArray< STATE_DIM, SCALAR > | StateVectorArray |
typedef ct::core::ControlVectorArray< CONTROL_DIM, SCALAR > | ControlVectorArray |
Public Member Functions | |
GNRiccatiSolver (const std::shared_ptr< LQOCProblem_t > &lqocProblem=nullptr) | |
GNRiccatiSolver (int N) | |
virtual void | solve () override |
solve the LQOC problem More... | |
virtual void | initializeAndAllocate () override |
a method reserved for memory allocation (e.g. required for HPIPM) More... | |
virtual void | solveSingleStage (int N) override |
virtual void | configure (const NLOptConSettings &settings) override |
virtual void | computeStatesAndControls () override |
extract the solution (can be overriden if additional extraction steps required in specific solver) More... | |
virtual void | computeFeedbackMatrices () override |
return TVLQR feedback matrices More... | |
virtual void | compute_lv () override |
compute iLQR-style lv More... | |
virtual SCALAR | getSmallestEigenvalue () override |
return the smallest eigenvalue More... | |
Public Member Functions inherited from ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR > | |
LQOCSolver (const std::shared_ptr< LQOCProblem_t > &lqocProblem=nullptr) | |
virtual | ~LQOCSolver ()=default |
void | setProblem (std::shared_ptr< LQOCProblem_t > lqocProblem) |
virtual bool | configureInputBoxConstraints (std::shared_ptr< LQOCProblem< STATE_DIM, CONTROL_DIM >> lqocProblem) |
setup and configure the box constraints More... | |
virtual bool | configureStateBoxConstraints (std::shared_ptr< LQOCProblem< STATE_DIM, CONTROL_DIM >> lqocProblem) |
virtual bool | configureGeneralConstraints (std::shared_ptr< LQOCProblem< STATE_DIM, CONTROL_DIM >> lqocProblem) |
setup and configure the general (in)equality constraints More... | |
const ct::core::StateVectorArray< STATE_DIM, SCALAR > & | getSolutionState () |
return solution for state More... | |
const ct::core::ControlVectorArray< CONTROL_DIM, SCALAR > & | getSolutionControl () |
return solution for control More... | |
const ct::core::FeedbackArray< STATE_DIM, CONTROL_DIM, SCALAR > & | getSolutionFeedback () |
virtual const ct::core::ControlVectorArray< CONTROL_DIM, SCALAR > & | get_lv () |
return iLQR-style feedforward lv More... | |
Static Public Attributes | |
static EIGEN_MAKE_ALIGNED_OPERATOR_NEW const int | state_dim = STATE_DIM |
static const int | control_dim = CONTROL_DIM |
Protected Member Functions | |
virtual void | setProblemImpl (std::shared_ptr< LQOCProblem_t > lqocProblem) override |
void | changeNumberOfStages (int N) |
void | initializeCostToGo () |
void | computeCostToGo (size_t k) |
void | designController (size_t k) |
void | logToMatlab () |
Protected Member Functions inherited from ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR > | |
virtual void | setProblemImpl (std::shared_ptr< LQOCProblem_t > lqocProblem)=0 |
Protected Attributes | |
NLOptConSettings | settings_ |
ControlVectorArray | gv_ |
FeedbackArray | G_ |
ControlMatrixArray | H_ |
ControlMatrixArray | Hi_ |
ControlMatrixArray | Hi_inverse_ |
ControlMatrix | H_corrFix_ |
StateVectorArray | sv_ |
StateMatrixArray | S_ |
int | N_ |
SCALAR | smallestEigenvalue_ |
Eigen::SelfAdjointEigenSolver< Eigen::Matrix< SCALAR, CONTROL_DIM, CONTROL_DIM > > | eigenvalueSolver_ |
Eigenvalue solver, used for inverting the Hessian and for regularization. More... | |
Protected Attributes inherited from ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR > | |
std::shared_ptr< LQOCProblem_t > | lqocProblem_ |
core::StateVectorArray< STATE_DIM, SCALAR > | x_sol_ |
core::ControlVectorArray< CONTROL_DIM, SCALAR > | u_sol_ |
ct::core::FeedbackArray< STATE_DIM, CONTROL_DIM, SCALAR > | L_ |
ct::core::ControlVectorArray< CONTROL_DIM, SCALAR > | lv_ |
Additional Inherited Members | |
Public Attributes inherited from ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR > | |
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef LQOCProblem< STATE_DIM, CONTROL_DIM, SCALAR > | LQOCProblem_t |
This class implements an general Riccati backward pass for solving an unconstrained linear-quadratic Optimal Control problem
typedef LQOCProblem<STATE_DIM, CONTROL_DIM, SCALAR> ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::LQOCProblem_t |
typedef ct::core::StateMatrix<STATE_DIM, SCALAR> ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::StateMatrix |
typedef ct::core::StateMatrixArray<STATE_DIM, SCALAR> ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::StateMatrixArray |
typedef ct::core::ControlVector<CONTROL_DIM, SCALAR> ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::ControlVector |
typedef ct::core::ControlMatrix<CONTROL_DIM, SCALAR> ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::ControlMatrix |
typedef ct::core::ControlMatrixArray<CONTROL_DIM, SCALAR> ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::ControlMatrixArray |
typedef ct::core::StateControlMatrixArray<STATE_DIM, CONTROL_DIM, SCALAR> ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::StateControlMatrixArray |
typedef ct::core::FeedbackArray<STATE_DIM, CONTROL_DIM, SCALAR> ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::FeedbackArray |
typedef ct::core::StateVectorArray<STATE_DIM, SCALAR> ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::StateVectorArray |
typedef ct::core::ControlVectorArray<CONTROL_DIM, SCALAR> ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::ControlVectorArray |
ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::GNRiccatiSolver | ( | const std::shared_ptr< LQOCProblem_t > & | lqocProblem = nullptr | ) |
ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::GNRiccatiSolver | ( | int | N | ) |
|
overridevirtual |
solve the LQOC problem
Implements ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >.
References i, ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >::lqocProblem_, and ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::solveSingleStage().
Referenced by TEST().
|
overridevirtual |
a method reserved for memory allocation (e.g. required for HPIPM)
Implements ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >.
|
overridevirtual |
Reimplemented from ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >.
References ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::computeCostToGo(), ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::designController(), ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::initializeCostToGo(), and ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >::lqocProblem_.
Referenced by ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::solve().
|
overridevirtual |
|
overridevirtual |
extract the solution (can be overriden if additional extraction steps required in specific solver)
control update rule in diff coordinates
state update rule in diff coordinates
Implements ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >.
References ct::optcon::LQOCProblem< STATE_DIM, CONTROL_DIM, SCALAR >::A_, ct::optcon::LQOCProblem< STATE_DIM, CONTROL_DIM, SCALAR >::B_, ct::optcon::LQOCProblem< STATE_DIM, CONTROL_DIM, SCALAR >::b_, ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >::L_, ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >::lqocProblem_, ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >::lv_, ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >::u_sol_, and ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >::x_sol_.
Referenced by TEST().
|
overridevirtual |
return TVLQR feedback matrices
Implements ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >.
Referenced by TEST().
|
overridevirtual |
compute iLQR-style lv
Implements ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >.
Referenced by TEST().
|
overridevirtual |
return the smallest eigenvalue
Reimplemented from ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >.
References ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::smallestEigenvalue_.
|
overrideprotectedvirtual |
resize matrices
lqocProblem |
References ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::changeNumberOfStages().
|
protected |
References ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::G_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::gv_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::H_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::Hi_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::Hi_inverse_, ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >::L_, ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >::lv_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::N_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::S_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::sv_, ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >::u_sol_, and ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >::x_sol_.
Referenced by ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::GNRiccatiSolver(), and ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::setProblemImpl().
|
protected |
since intializeCostToGo is the first call, we initialize the smallestEigenvalue here.
References ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >::lqocProblem_, ct::optcon::LQOCProblem< STATE_DIM, CONTROL_DIM, SCALAR >::Q_, ct::optcon::LQOCProblem< STATE_DIM, CONTROL_DIM, SCALAR >::qv_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::S_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::smallestEigenvalue_, and ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::sv_.
Referenced by ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::solveSingleStage().
|
protected |
References ct::optcon::LQOCProblem< STATE_DIM, CONTROL_DIM, SCALAR >::A_, ct::optcon::LQOCProblem< STATE_DIM, CONTROL_DIM, SCALAR >::b_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::G_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::gv_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::Hi_, ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >::L_, ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >::lqocProblem_, ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >::lv_, ct::optcon::LQOCProblem< STATE_DIM, CONTROL_DIM, SCALAR >::Q_, ct::optcon::LQOCProblem< STATE_DIM, CONTROL_DIM, SCALAR >::qv_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::S_, and ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::sv_.
Referenced by ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::solveSingleStage().
|
protected |
References ct::optcon::LQOCProblem< STATE_DIM, CONTROL_DIM, SCALAR >::A_, ct::optcon::LQOCProblem< STATE_DIM, CONTROL_DIM, SCALAR >::B_, ct::optcon::LQOCProblem< STATE_DIM, CONTROL_DIM, SCALAR >::b_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::eigenvalueSolver_, ct::optcon::NLOptConSettings::epsilon, ct::optcon::NLOptConSettings::fixedHessianCorrection, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::G_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::gv_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::H_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::Hi_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::Hi_inverse_, ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >::L_, ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >::lqocProblem_, ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >::lv_, ct::optcon::LQOCProblem< STATE_DIM, CONTROL_DIM, SCALAR >::P_, ct::optcon::LQOCProblem< STATE_DIM, CONTROL_DIM, SCALAR >::R_, ct::optcon::NLOptConSettings::recordSmallestEigenvalue, ct::optcon::LQOCProblem< STATE_DIM, CONTROL_DIM, SCALAR >::rv_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::S_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::settings_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::smallestEigenvalue_, and ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::sv_.
Referenced by ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::solveSingleStage().
|
protected |
References ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::G_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::gv_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::H_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::Hi_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::Hi_inverse_, ct::optcon::LQOCSolver< STATE_DIM, CONTROL_DIM, SCALAR >::L_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::S_, ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::sv_, and ct::core::DiscreteArray< T, Alloc >::toImplementation().
|
static |
|
static |
|
protected |
|
protected |
Referenced by ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::changeNumberOfStages(), ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::computeCostToGo(), ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::designController(), and ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::logToMatlab().
|
protected |
Referenced by ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::changeNumberOfStages(), ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::computeCostToGo(), ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::designController(), and ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::logToMatlab().
|
protected |
|
protected |
Referenced by ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::changeNumberOfStages(), ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::computeCostToGo(), ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::designController(), and ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::logToMatlab().
|
protected |
|
protected |
|
protected |
Referenced by ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::changeNumberOfStages(), ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::computeCostToGo(), ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::designController(), ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::initializeCostToGo(), and ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::logToMatlab().
|
protected |
Referenced by ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::changeNumberOfStages(), ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::computeCostToGo(), ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::designController(), ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::initializeCostToGo(), and ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::logToMatlab().
|
protected |
|
protected |
|
protected |
Eigenvalue solver, used for inverting the Hessian and for regularization.
Referenced by ct::optcon::GNRiccatiSolver< STATE_DIM, CONTROL_DIM, SCALAR >::designController().