nmpc_ddp
|
DDP solver. More...
#include <DDPSolver.h>
Classes | |
struct | ComputationDuration |
Data of computation duration. More... | |
struct | Configuration |
Configuration. More... | |
struct | ControlData |
Control data. More... | |
struct | Derivative |
Derivatives of DDP problem. More... | |
struct | TraceData |
Data to trace optimization loop. More... | |
Public Types | |
using | StateDimVector = typename DDPProblem< StateDim, InputDim >::StateDimVector |
Type of vector of state dimension. More... | |
using | InputDimVector = typename DDPProblem< StateDim, InputDim >::InputDimVector |
Type of vector of input dimension. More... | |
using | StateStateDimMatrix = typename DDPProblem< StateDim, InputDim >::StateStateDimMatrix |
Type of matrix of state x state dimension. More... | |
using | InputInputDimMatrix = typename DDPProblem< StateDim, InputDim >::InputInputDimMatrix |
Type of matrix of input x input dimension. More... | |
using | StateInputDimMatrix = typename DDPProblem< StateDim, InputDim >::StateInputDimMatrix |
Type of matrix of state x input dimension. More... | |
using | InputStateDimMatrix = typename DDPProblem< StateDim, InputDim >::InputStateDimMatrix |
Type of matrix of input x state dimension. More... | |
Public Member Functions | |
EIGEN_MAKE_ALIGNED_OPERATOR_NEW | DDPSolver (const std::shared_ptr< DDPProblem< StateDim, InputDim >> &problem) |
Constructor. More... | |
Configuration & | config () |
Accessor to configuration. More... | |
const Configuration & | config () const |
Const accessor to configuration. More... | |
bool | solve (double current_t, const StateDimVector ¤t_x, const std::vector< InputDimVector > &initial_u_list) |
Solve optimization. More... | |
void | setInputLimitsFunc (const std::function< std::array< InputDimVector, 2 >(double)> &input_limits_func) |
Set function to return input limits. More... | |
const ControlData & | controlData () const |
Const accessor to control data calculated by solve(). More... | |
const std::vector< TraceData > & | traceDataList () const |
Const accessor to trace data list. More... | |
const ComputationDuration & | computationDuration () const |
Const accessor to computation duration. More... | |
void | dumpTraceDataList (const std::string &file_path) const |
Dump trace data list. More... | |
Protected Member Functions | |
int | procOnce (int iter) |
Process one iteration. More... | |
bool | backwardPass () |
Process backward pass. More... | |
void | forwardPass (double alpha) |
Process forward pass. More... | |
Protected Attributes | |
Configuration | config_ |
Configuration. More... | |
std::shared_ptr< DDPProblem< StateDim, InputDim > > | problem_ |
DDP problem. More... | |
std::vector< TraceData > | trace_data_list_ |
Sequence of trace data. More... | |
std::function< std::array< InputDimVector, 2 >double)> | input_limits_func_ |
Function to return input limits (in the order of lower, upper) More... | |
ComputationDuration | computation_duration_ |
Computation duration data. More... | |
double | current_t_ = 0 |
Current time [sec]. More... | |
double | lambda_ = 0 |
Regularization coefficient. More... | |
double | dlambda_ = 0 |
Scaling factor of regularization coefficient. More... | |
ControlData | control_data_ |
Control data (sequence of state, input, and cost) More... | |
ControlData | candidate_control_data_ |
Candidate control data (sequence of state, input, and cost) More... | |
std::vector< InputDimVector > | k_list_ |
Sequence of feedforward term for input (k[0], ..., k[N-1]) More... | |
std::vector< InputStateDimMatrix > | K_list_ |
Sequence of feedback gain for input w.r.t. state error (K[0], ..., K[N-1]) More... | |
std::vector< Derivative > | derivative_list_ |
Sequence of derivatives. More... | |
StateDimVector | last_Vx_ |
First-order derivative of value in last step of horizon. More... | |
StateStateDimMatrix | last_Vxx_ |
Second-order derivative of value in last step of horizon. More... | |
Eigen::Vector2d | dV_ |
Expected update of value. More... | |
DDP solver.
StateDim | state dimension |
InputDim | input dimension |
See the following for a detailed algorithm.
Definition at line 24 of file DDPSolver.h.
using nmpc_ddp::DDPSolver< StateDim, InputDim >::InputDimVector = typename DDPProblem<StateDim, InputDim>::InputDimVector |
Type of vector of input dimension.
Definition at line 31 of file DDPSolver.h.
using nmpc_ddp::DDPSolver< StateDim, InputDim >::InputInputDimMatrix = typename DDPProblem<StateDim, InputDim>::InputInputDimMatrix |
Type of matrix of input x input dimension.
Definition at line 37 of file DDPSolver.h.
using nmpc_ddp::DDPSolver< StateDim, InputDim >::InputStateDimMatrix = typename DDPProblem<StateDim, InputDim>::InputStateDimMatrix |
Type of matrix of input x state dimension.
Definition at line 43 of file DDPSolver.h.
using nmpc_ddp::DDPSolver< StateDim, InputDim >::StateDimVector = typename DDPProblem<StateDim, InputDim>::StateDimVector |
Type of vector of state dimension.
Definition at line 28 of file DDPSolver.h.
using nmpc_ddp::DDPSolver< StateDim, InputDim >::StateInputDimMatrix = typename DDPProblem<StateDim, InputDim>::StateInputDimMatrix |
Type of matrix of state x input dimension.
Definition at line 40 of file DDPSolver.h.
using nmpc_ddp::DDPSolver< StateDim, InputDim >::StateStateDimMatrix = typename DDPProblem<StateDim, InputDim>::StateStateDimMatrix |
Type of matrix of state x state dimension.
Definition at line 34 of file DDPSolver.h.
nmpc_ddp::DDPSolver< StateDim, InputDim >::DDPSolver | ( | const std::shared_ptr< DDPProblem< StateDim, InputDim >> & | problem | ) |
|
protected |
Process backward pass.
Definition at line 343 of file DDPSolver.hpp.
|
inline |
Const accessor to computation duration.
Definition at line 300 of file DDPSolver.h.
|
inline |
Accessor to configuration.
Definition at line 258 of file DDPSolver.h.
|
inline |
Const accessor to configuration.
Definition at line 264 of file DDPSolver.h.
|
inline |
Const accessor to control data calculated by solve().
Definition at line 288 of file DDPSolver.h.
void nmpc_ddp::DDPSolver< StateDim, InputDim >::dumpTraceDataList | ( | const std::string & | file_path | ) | const |
Dump trace data list.
file_path | path to output file |
Definition at line 563 of file DDPSolver.hpp.
|
protected |
Process forward pass.
alpha | scaling factor of k |
Definition at line 537 of file DDPSolver.hpp.
|
protected |
Process one iteration.
iter | current iteration |
Definition at line 144 of file DDPSolver.hpp.
|
inline |
Set function to return input limits.
input_limits_func | function to return input limits (in the order of lower, upper) |
Definition at line 282 of file DDPSolver.h.
bool nmpc_ddp::DDPSolver< StateDim, InputDim >::solve | ( | double | current_t, |
const StateDimVector & | current_x, | ||
const std::vector< InputDimVector > & | initial_u_list | ||
) |
Solve optimization.
current_t | current time [sec] |
current_x | current state |
initial_u_list | initial sequence of input |
Definition at line 27 of file DDPSolver.hpp.
|
inline |
Const accessor to trace data list.
Definition at line 294 of file DDPSolver.h.
|
protected |
Candidate control data (sequence of state, input, and cost)
Definition at line 356 of file DDPSolver.h.
|
protected |
Computation duration data.
Definition at line 341 of file DDPSolver.h.
|
protected |
Definition at line 329 of file DDPSolver.h.
|
protected |
Control data (sequence of state, input, and cost)
Definition at line 353 of file DDPSolver.h.
|
protected |
Current time [sec].
Definition at line 344 of file DDPSolver.h.
|
protected |
Sequence of derivatives.
Definition at line 365 of file DDPSolver.h.
|
protected |
Scaling factor of regularization coefficient.
Definition at line 350 of file DDPSolver.h.
|
protected |
Expected update of value.
Definition at line 374 of file DDPSolver.h.
|
protected |
Function to return input limits (in the order of lower, upper)
Definition at line 338 of file DDPSolver.h.
|
protected |
Sequence of feedforward term for input (k[0], ..., k[N-1])
Definition at line 359 of file DDPSolver.h.
|
protected |
Sequence of feedback gain for input w.r.t. state error (K[0], ..., K[N-1])
Definition at line 362 of file DDPSolver.h.
|
protected |
Regularization coefficient.
Definition at line 347 of file DDPSolver.h.
|
protected |
First-order derivative of value in last step of horizon.
Definition at line 368 of file DDPSolver.h.
|
protected |
Second-order derivative of value in last step of horizon.
Definition at line 371 of file DDPSolver.h.
|
protected |
DDP problem.
Definition at line 332 of file DDPSolver.h.
|
protected |
Sequence of trace data.
Definition at line 335 of file DDPSolver.h.