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 mobilerobot. 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 | vx_ref = 0.4 |
double | v_min = -0.5 |
double | v_max = 0.5 |
double | w_min = -0.75 |
double | w_max = 0.75 |
double | X_1 = 1 |
double | Y_1 = 0.25 |
double | R_1 = 0.5 |
double | X_2 = 2 |
double | Y_2 = -0.25 |
double | R_2 = 0.5 |
std::array< double, 3 > | q = {10, 1, 0.01} |
std::array< double, 2 > | r = {0.1, 0.1} |
std::array< double, 3 > | x_ref = {0, 0, 0} |
std::array< double, nub > | umin = {-1.0, -1.0} |
std::array< double, nub > | umax = {1.0, 1.0} |
std::array< double, nub > | dummy_weight = {0.1, 0.1} |
std::array< double, nh > | fb_eps = {0.01, 0.01} |
Static Public Attributes | |
static constexpr int | nx = 3 |
Dimension of the state. More... | |
static constexpr int | nu = 2 |
Dimension of the control input. More... | |
static constexpr int | nc = 2 |
Dimension of the equality constraints. More... | |
static constexpr int | nh = 2 |
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 = 2 |
Dimension of the bound constraints on the control input. More... | |
static constexpr std::array< int, nub > | ubound_indices = {0, 1} |
Friends | |
std::ostream & | operator<< (std::ostream &os, const OCP_mobilerobot &ocp) |
Definition of the optimal control problem (OCP) of mobilerobot.
|
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_mobilerobot::dummy_weight = {0.1, 0.1} |
std::array<double, nh> cgmres::OCP_mobilerobot::fb_eps = {0.01, 0.01} |
|
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, 3> cgmres::OCP_mobilerobot::q = {10, 1, 0.01} |
std::array<double, 2> cgmres::OCP_mobilerobot::r = {0.1, 0.1} |
double cgmres::OCP_mobilerobot::R_1 = 0.5 |
double cgmres::OCP_mobilerobot::R_2 = 0.5 |
|
staticconstexpr |
std::array<double, nub> cgmres::OCP_mobilerobot::umax = {1.0, 1.0} |
std::array<double, nub> cgmres::OCP_mobilerobot::umin = {-1.0, -1.0} |
double cgmres::OCP_mobilerobot::v_max = 0.5 |
double cgmres::OCP_mobilerobot::v_min = -0.5 |
double cgmres::OCP_mobilerobot::vx_ref = 0.4 |
double cgmres::OCP_mobilerobot::w_max = 0.75 |
double cgmres::OCP_mobilerobot::w_min = -0.75 |
double cgmres::OCP_mobilerobot::X_1 = 1 |
double cgmres::OCP_mobilerobot::X_2 = 2 |
std::array<double, 3> cgmres::OCP_mobilerobot::x_ref = {0, 0, 0} |
double cgmres::OCP_mobilerobot::Y_1 = 0.25 |
double cgmres::OCP_mobilerobot::Y_2 = -0.25 |