| autogenu-jupyter
    An automatic code generator and the continuation/GMRES (C/GMRES) based numerical solvers for nonlinear MPC | 
Definition of the optimal control problem (OCP) of cartpole. More...
#include <ocp.hpp>
| Public Member Functions | |
| void | disp (std::ostream &os) const | 
| void | synchronize () | 
| Synchrozies the internal parameters of this OCP with the external references. This method is called at the beginning of each MPC update.  More... | |
| void | eval_f (const double t, const double *x, const double *u, double *dx) const | 
| Computes the state equation dx = f(t, x, u).  More... | |
| void | eval_phix (const double t, const double *x, double *phix) const | 
| Computes the partial derivative of terminal cost with respect to state, i.e., phix = dphi/dx(t, x).  More... | |
| void | eval_hx (const double t, const double *x, const double *u, const double *lmd, double *hx) const | 
| Computes the partial derivative of the Hamiltonian with respect to state, i.e., hx = dH/dx(t, x, u, lmd).  More... | |
| void | eval_hu (const double t, const double *x, const double *u, const double *lmd, double *hu) const | 
| Computes the partial derivative of the Hamiltonian with respect to control input and the equality constraints, i.e., hu = dH/du(t, x, u, lmd).  More... | |
| template<typename VectorType1 , typename VectorType2 , typename VectorType3 > | |
| void | eval_f (const double t, const MatrixBase< VectorType1 > &x, const MatrixBase< VectorType2 > &u, const MatrixBase< VectorType3 > &dx) const | 
| Computes the state equation dx = f(t, x, u).  More... | |
| template<typename VectorType1 , typename VectorType2 > | |
| void | eval_phix (const double t, const MatrixBase< VectorType1 > &x, const MatrixBase< VectorType2 > &phix) const | 
| Computes the partial derivative of terminal cost with respect to state, i.e., phix = dphi/dx(t, x).  More... | |
| template<typename VectorType1 , typename VectorType2 , typename VectorType3 , typename VectorType4 > | |
| void | eval_hx (const double t, const MatrixBase< VectorType1 > &x, const MatrixBase< VectorType2 > &uc, const MatrixBase< VectorType3 > &lmd, const MatrixBase< VectorType4 > &hx) const | 
| Computes the partial derivative of the Hamiltonian with respect to the state, i.e., hx = dH/dx(t, x, u, lmd).  More... | |
| template<typename VectorType1 , typename VectorType2 , typename VectorType3 , typename VectorType4 > | |
| void | eval_hu (const double t, const MatrixBase< VectorType1 > &x, const MatrixBase< VectorType2 > &uc, const MatrixBase< VectorType3 > &lmd, const MatrixBase< VectorType4 > &hu) const | 
| Computes the partial derivative of the Hamiltonian with respect to control input and the equality constraints, i.e., hu = dH/du(t, x, u, lmd).  More... | |
| Public Attributes | |
| double | m_c = 2 | 
| double | m_p = 0.2 | 
| double | l = 0.5 | 
| double | g = 9.80665 | 
| std::array< double, 4 > | q = {2.5, 10, 0.01, 0.01} | 
| std::array< double, 4 > | q_terminal = {2.5, 10, 0.01, 0.01} | 
| std::array< double, 4 > | x_ref = {0, M_PI, 0, 0} | 
| std::array< double, 1 > | r = {1} | 
| std::array< double, nub > | umin = {-15.0} | 
| std::array< double, nub > | umax = {15.0} | 
| std::array< double, nub > | dummy_weight = {0.1} | 
| Static Public Attributes | |
| static constexpr int | nx = 4 | 
| Dimension of the state.  More... | |
| static constexpr int | nu = 1 | 
| Dimension of the control input.  More... | |
| static constexpr int | nc = 0 | 
| Dimension of the equality constraints.  More... | |
| static constexpr int | nh = 0 | 
| Dimension of the Fischer-Burmeister function (already counded in nc).  More... | |
| static constexpr int | nuc = nu + nc | 
| Dimension of the concatenation of the control input and equality constraints.  More... | |
| static constexpr int | nub = 1 | 
| Dimension of the bound constraints on the control input.  More... | |
| static constexpr std::array< int, nub > | ubound_indices = {0} | 
| Friends | |
| std::ostream & | operator<< (std::ostream &os, const OCP_cartpole &ocp) | 
Definition of the optimal control problem (OCP) of cartpole.
| 
 | inline | 
| 
 | inline | 
Computes the state equation dx = f(t, x, u).
| [in] | t | Time. | 
| [in] | x | State. | 
| [in] | u | Control input. | 
| [out] | dx | Evaluated value of the state equation. | 
| 
 | inline | 
Computes the state equation dx = f(t, x, u).
| [in] | t | Time. | 
| [in] | x | State. Size must be nx. | 
| [in] | u | Control input. Size must be nu. | 
| [out] | dx | Evaluated value of the state equation. Size must be nx. | 
| 
 | inline | 
Computes the partial derivative of the Hamiltonian with respect to control input and the equality constraints, i.e., hu = dH/du(t, x, u, lmd).
| [in] | t | Time. | 
| [in] | x | State. | 
| [in] | u | Concatenatin of the control input and Lagrange multiplier with respect to the equality constraints. | 
| [in] | lmd | Costate. | 
| [out] | hu | Evaluated value of the partial derivative of the Hamiltonian. | 
| 
 | inline | 
Computes the partial derivative of the Hamiltonian with respect to control input and the equality constraints, i.e., hu = dH/du(t, x, u, lmd).
| [in] | t | Time. | 
| [in] | x | State. Size must be nx. | 
| [in] | uc | Concatenatin of the control input and Lagrange multiplier with respect to the equality constraints. Size must be nuc. | 
| [in] | lmd | Costate. Size must be nx. | 
| [out] | hu | Evaluated value of the partial derivative of the Hamiltonian. Size must be nuc. | 
| 
 | inline | 
Computes the partial derivative of the Hamiltonian with respect to state, i.e., hx = dH/dx(t, x, u, lmd).
| [in] | t | Time. | 
| [in] | x | State. | 
| [in] | u | Concatenatin of the control input and Lagrange multiplier with respect to the equality constraints. | 
| [in] | lmd | Costate. | 
| [out] | hx | Evaluated value of the partial derivative of the Hamiltonian. | 
| 
 | inline | 
Computes the partial derivative of the Hamiltonian with respect to the state, i.e., hx = dH/dx(t, x, u, lmd).
| [in] | t | Time. | 
| [in] | x | State. Size must be nx. | 
| [in] | uc | Concatenatin of the control input and Lagrange multiplier with respect to the equality constraints. Size must be nuc. | 
| [in] | lmd | Costate. Size must be nx. | 
| [out] | hx | Evaluated value of the partial derivative of the Hamiltonian. Size must be nx. | 
| 
 | inline | 
Computes the partial derivative of terminal cost with respect to state, i.e., phix = dphi/dx(t, x).
| [in] | t | Time. | 
| [in] | x | State. | 
| [out] | phix | Evaluated value of the partial derivative of terminal cost. | 
| 
 | inline | 
Computes the partial derivative of terminal cost with respect to state, i.e., phix = dphi/dx(t, x).
| [in] | t | Time. | 
| [in] | x | State. Size must be nx. | 
| [out] | phix | Evaluated value of the partial derivative of terminal cost. Size must be nx. | 
| 
 | inline | 
Synchrozies the internal parameters of this OCP with the external references. This method is called at the beginning of each MPC update.
| 
 | friend | 
| std::array<double, nub> cgmres::OCP_cartpole::dummy_weight = {0.1} | 
| double cgmres::OCP_cartpole::g = 9.80665 | 
| double cgmres::OCP_cartpole::l = 0.5 | 
| double cgmres::OCP_cartpole::m_c = 2 | 
| double cgmres::OCP_cartpole::m_p = 0.2 | 
| 
 | staticconstexpr | 
Dimension of the equality constraints.
| 
 | staticconstexpr | 
Dimension of the Fischer-Burmeister function (already counded in nc).
| 
 | staticconstexpr | 
Dimension of the control input.
| 
 | staticconstexpr | 
Dimension of the bound constraints on the control input.
Dimension of the concatenation of the control input and equality constraints.
| 
 | staticconstexpr | 
Dimension of the state.
| std::array<double, 4> cgmres::OCP_cartpole::q = {2.5, 10, 0.01, 0.01} | 
| std::array<double, 4> cgmres::OCP_cartpole::q_terminal = {2.5, 10, 0.01, 0.01} | 
| std::array<double, 1> cgmres::OCP_cartpole::r = {1} | 
| 
 | staticconstexpr | 
| std::array<double, nub> cgmres::OCP_cartpole::umax = {15.0} | 
| std::array<double, nub> cgmres::OCP_cartpole::umin = {-15.0} | 
| std::array<double, 4> cgmres::OCP_cartpole::x_ref = {0, M_PI, 0, 0} |