Go to the documentation of this file.
22 template<
int StateDim,
int InputDim,
int IneqDim>
131 void reset(
double _x,
double _u,
double _lambda,
double _s,
double _nu);
168 Coefficient(
int state_dim,
int input_dim,
int ineq_dim);
291 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
325 inline const std::vector<Coefficient> &
coeffList()
const
390 std::shared_ptr<FmpcProblem<StateDim, InputDim, IneqDim>>
problem_;
double gain_pre
Duration of pre-process for gain calculation (included in backward) [msec].
double barrier_eps_
Barrier parameter.
bool forwardPass()
Process forward pass a.k.a forward Riccati recursion.
Status solve(double current_t, const StateDimVector ¤t_x, const Variable &initial_variable)
Solve optimization.
std::vector< Coefficient > coeff_list_
Sequence of coefficients of linearized KKT condition.
@ ErrorInUpdate
Error in update.
bool check_nan
Whether to check NaN.
double kkt_error
KKT condition error.
bool containsNaN() const
Check whether NaN or infinity is containd.
typename nmpc_ddp::DDPProblem< StateDim, InputDim >::StateDimVector StateDimVector
Type of vector of state dimension.
Data to trace optimization loop.
double gain_post
Duration of post-process for gain calculation (included in backward) [msec].
StateInputDimMatrix B
First-order derivative of state equation w.r.t. input.
bool init_complementary_variable
Whether to initialize complementarity variables.
std::vector< IneqDimVector > nu_list
Sequence of Lagrange multipliers of inequality constraints (nu[0], ..., nu[N-1])
std::vector< IneqDimVector > s_list
Sequence of slack variables of inequality constraints (s[0], ..., s[N-1])
Eigen::Matrix< double, IneqDim, 1 > IneqDimVector
Type of vector of inequality dimension.
@ Uninitialized
Uninitialized.
StateStateDimMatrix P
Coefficient matrix for lambda calculation.
double backward
Duration to process backward pass (included in opt) [msec].
double duration_update
Duration to update variables [msec].
Data of computation duration.
const Variable & variable() const
Const accessor to optimization variables.
ComputationDuration computation_duration_
Computation duration data.
typename nmpc_ddp::DDPProblem< StateDim, InputDim >::InputDimVector InputDimVector
Type of vector of input dimension.
void setupMeritFunc()
Setup the merit function and its directional derivative.
int iter
Iteration of optimization loop.
int horizon_steps
Number of steps in horizon.
double duration_coeff
Duration to calculate coefficients [msec].
const ComputationDuration & computationDuration() const
Const accessor to computation duration.
typename FmpcProblem< StateDim, InputDim, IneqDim >::IneqStateDimMatrix IneqStateDimMatrix
Type of matrix of inequality x state dimension.
Configuration & config()
Accessor to configuration.
InputStateDimMatrix K
Feedback gain for input w.r.t. state error.
StateDimVector current_x_
Current state.
Variable delta_variable_
Update amount of optimization variables.
std::vector< StateDimVector > lambda_list
Sequence of Lagrange multipliers of equality constraints (lambda[0], ..., lambda[N-1],...
std::shared_ptr< FmpcProblem< StateDim, InputDim, IneqDim > > problem_
FMPC problem.
Coefficient(int state_dim, int input_dim, int ineq_dim)
Constructor.
bool break_if_llt_fails
Whether to break if LLT decomposition fails.
InputDimVector k
Feedforward term for input.
typename nmpc_ddp::DDPProblem< StateDim, InputDim >::StateInputDimMatrix StateInputDimMatrix
Type of matrix of state x input dimension.
bool update_barrier_eps
Whether to update barrier parameter.
typename FmpcProblem< StateDim, InputDim, IneqDim >::IneqDimVector IneqDimVector
Type of vector of inequality dimension.
@ ErrorInForward
Error in forward.
typename FmpcProblem< StateDim, InputDim, IneqDim >::IneqInputDimMatrix IneqInputDimMatrix
Type of matrix of inequality x input dimension.
@ IterationContinued
Iteration continued (used internally only)
typename FmpcProblem< StateDim, InputDim, IneqDim >::InputDimVector InputDimVector
Type of vector of input dimension.
double fraction
Duration to calculate fraction-to-boundary rule (included in update) [msec].
@ ErrorInBackward
Error in backward.
bool backwardPass()
Process backward pass a.k.a backward Riccati recursion.
std::vector< InputDimVector > u_list
Sequence of input (u[0], ..., u[N-1])
const std::vector< TraceData > & traceDataList() const
Const accessor to trace data list.
Eigen::Matrix< double, IneqDim, InputDim > IneqInputDimMatrix
Type of matrix of inequality x input dimension.
Eigen::Matrix< double, IneqDim, StateDim > IneqStateDimMatrix
Type of matrix of inequality x state dimension.
bool containsNaN() const
Check whether NaN or infinity is containd.
double duration_forward
Duration to process forward pass [msec].
Variable(int _horizon_steps=0)
Constructor.
Coefficients of linearized KKT condition.
double merit_func_
Merit function.
double calcMeritFunc(const Variable &variable) const
Calculate merit function.
Variable variable_
Optimization variables.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW FmpcSolver(const std::shared_ptr< FmpcProblem< StateDim, InputDim, IneqDim >> &problem)
Constructor.
void dumpTraceDataList(const std::string &file_path) const
Dump trace data list.
typename FmpcProblem< StateDim, InputDim, IneqDim >::InputInputDimMatrix InputInputDimMatrix
Type of matrix of input x input dimension.
std::vector< TraceData > trace_data_list_
Sequence of trace data.
@ MaxIterationReached
Maximum iteration reached.
double update
Duration to update variables (included in opt) [msec].
int horizon_steps
Number of steps in horizon.
int print_level
Print level (0: no print, 1: print only important, 2: print verbose, 3: print very verbose)
double calcKktError(double barrier_eps) const
Calculate KKT condition error.
InputInputDimMatrix Luu
Second-order derivative of running cost w.r.t. input.
bool enable_line_search
Whether to enable line search.
int print_level
Print level (0: no print, 1: print only important, 2: print verbose, 3: print very verbose)
double current_t_
Current time [sec].
typename FmpcProblem< StateDim, InputDim, IneqDim >::StateStateDimMatrix StateStateDimMatrix
Type of matrix of state x state dimension.
int print_level
Print level (0: no print, 1: print only important, 2: print verbose, 3: print very verbose)
const std::vector< Coefficient > & coeffList() const
Const accessor to sequence of coefficients of linearized KKT condition.
typename nmpc_ddp::DDPProblem< StateDim, InputDim >::InputStateDimMatrix InputStateDimMatrix
Type of matrix of input x state dimension.
double duration_backward
Duration to process backward pass [msec].
void reset(double _x, double _u, double _lambda, double _s, double _nu)
Reset variables.
StateStateDimMatrix Lxx
Second-order derivative of running cost w.r.t. state.
double solve
Duration to solve [msec].
int max_iter
Maximum iteration of optimization loop.
void checkVariable() const
Check optimization variables.
typename nmpc_ddp::DDPProblem< StateDim, InputDim >::StateStateDimMatrix StateStateDimMatrix
Type of matrix of state x state dimension.
const Configuration & config() const
Const accessor to configuration.
double opt
Duration of optimization loop (included in solve) [msec].
double merit_const_scale_
Scale of constraint errors in the merit function.
typename FmpcProblem< StateDim, InputDim, IneqDim >::StateDimVector StateDimVector
Type of vector of state dimension.
bool updateVariables()
Update optimization variables given Newton-step direction.
StateDimVector s
Offset vector for lambda calculation.
Eigen::Matrix< double, IneqDim, IneqDim > IneqIneqDimMatrix
Type of matrix of inequality x inequality dimension.
bool merit_const_scale_from_lagrange_multipliers
Whether to calculate the scale of constraint errors in the merit function from Lagrange multipliers.
typename nmpc_ddp::DDPProblem< StateDim, InputDim >::InputInputDimMatrix InputInputDimMatrix
Type of matrix of input x input dimension.
Configuration config_
Configuration.
InputDimVector Lu
First-order derivative of running cost w.r.t. input.
IneqStateDimMatrix C
First-order derivative of inequality constraints w.r.t. state.
StateStateDimMatrix A
First-order derivative of state equation w.r.t. state.
std::vector< StateDimVector > x_list
Sequence of state (x[0], ..., x[N-1], x[N])
IneqInputDimMatrix D
First-order derivative of inequality constraints w.r.t. input.
Status procOnce(int iter)
Process one iteration.
double setup
Duration to setup (included in solve) [msec].
StateInputDimMatrix Lxu
Second-order derivative of running cost w.r.t. state and input.
double gain_solve
Duration to solve linear equation for gain calculation (included in backward) [msec].
typename FmpcProblem< StateDim, InputDim, IneqDim >::InputStateDimMatrix InputStateDimMatrix
Type of matrix of input x state dimension.
double kkt_error_thre
Threshold of KKT condition error.
double merit_deriv_
Directional derivative of merit function.
double forward
Duration to process forward pass (included in opt) [msec].
StateDimVector Lx
First-order derivative of running cost w.r.t. state.
typename FmpcProblem< StateDim, InputDim, IneqDim >::StateInputDimMatrix StateInputDimMatrix
Type of matrix of state x input dimension.
double coeff
Duration to calculate coefficients (included in opt) [msec].