A sparse MPC solver for walking motion generation.
Public Member Functions | Public Attributes | List of all members
smpc::solver_as Class Reference

API of the sparse MPC solver. More...

#include <smpc_solver.h>

Inheritance diagram for smpc::solver_as:
smpc::solver

Public Member Functions

 solver_as (const int N, const double gain_position=2000.0, const double gain_velocity=150.0, const double gain_acceleration=0.02, const double gain_jerk=1.0, const double tol=1e-7, const unsigned int max_added_constraints_num=0, const bool constraint_removal_on=true, const bool obj_computation_on=false)
 Constructor: initialize an active set method solver. More...
 
 ~solver_as ()
 
void set_parameters (const double *, const double *, const double, const double *, const double *, const double *, const double *, const double *)
 These functions are documented in the definition of the base abstract class smpc::solver. More...
 
void form_init_fp (const double *, const double *, const state_com &, double *)
 These functions are documented in the definition of the base abstract class smpc::solver. More...
 
void form_init_fp (const double *, const double *, const state_zmp &, double *)
 These functions are documented in the definition of the base abstract class smpc::solver. More...
 
void solve ()
 These functions are documented in the definition of the base abstract class smpc::solver. More...
 
void get_next_state (state_com &) const
 These functions are documented in the definition of the base abstract class smpc::solver. More...
 
void get_next_state (state_zmp &) const
 These functions are documented in the definition of the base abstract class smpc::solver. More...
 
void get_state (state_com &, const int) const
 These functions are documented in the definition of the base abstract class smpc::solver. More...
 
void get_state (state_zmp &, const int) const
 These functions are documented in the definition of the base abstract class smpc::solver. More...
 
void get_first_controls (control &) const
 These functions are documented in the definition of the base abstract class smpc::solver. More...
 
void get_controls (control &, const int) const
 These functions are documented in the definition of the base abstract class smpc::solver. More...
 
- Public Member Functions inherited from smpc::solver
virtual ~solver ()=0
 Virtual destructor. More...
 

Public Attributes

unsigned int added_constraints_num
 Number of added constraints (the constraints, that were removed are also counted). More...
 
unsigned int removed_constraints_num
 Number of removed constraints. More...
 
unsigned int active_set_size
 The final size of the active set. More...
 
std::vector< double > objective_log
 Contains values of objective function after each iteration, the initial value is also included. More...
 
qp_asqp_sol
 Internal representation. More...
 

Detailed Description

API of the sparse MPC solver.

Definition at line 313 of file smpc_solver.h.

Constructor & Destructor Documentation

◆ solver_as()

smpc::solver_as::solver_as ( const int  N,
const double  gain_position = 2000.0,
const double  gain_velocity = 150.0,
const double  gain_acceleration = 0.02,
const double  gain_jerk = 1.0,
const double  tol = 1e-7,
const unsigned int  max_added_constraints_num = 0,
const bool  constraint_removal_on = true,
const bool  obj_computation_on = false 
)

Constructor: initialize an active set method solver.

Parameters
[in]NNumber of sampling times in a preview window
[in]gain_positionPosition gain (Alpha)
[in]gain_velocityVelocity gain (Beta)
[in]gain_accelerationAcceleration gain (Gamma)
[in]gain_jerkJerk gain (Eta)
[in]toltolerance
[in]max_added_constraints_numlimit the number of added constraints (NOT the size of active set), no limit if set to 0.
[in]constraint_removal_onenable/disable removal of activated constraints.
[in]obj_computation_oncompute and keep values of the objective function
Note
smpc::max_added_constraints_num and smpc::constraint_removal_on affect the time required for solution. If the number of added constraints is less than (length of preview window)*2 or constraint removal is disabled, the solution is approximate. How good is this approximation depends on the problem.

Definition at line 46 of file smpc_solver.cpp.

◆ ~solver_as()

smpc::solver_as::~solver_as ( )

Definition at line 69 of file smpc_solver.cpp.

Member Function Documentation

◆ form_init_fp() [1/2]

void smpc::solver_as::form_init_fp ( const double *  x_coord,
const double *  y_coord,
const state_com init_state,
double *  X 
)
virtual

These functions are documented in the definition of the base abstract class smpc::solver.

Implements smpc::solver.

Definition at line 93 of file smpc_solver.cpp.

◆ form_init_fp() [2/2]

void smpc::solver_as::form_init_fp ( const double *  x_coord,
const double *  y_coord,
const state_zmp init_state,
double *  X 
)
virtual

These functions are documented in the definition of the base abstract class smpc::solver.

Implements smpc::solver.

Definition at line 106 of file smpc_solver.cpp.

◆ get_controls()

void smpc::solver_as::get_controls ( control c,
const int  ind 
) const
virtual

These functions are documented in the definition of the base abstract class smpc::solver.

Implements smpc::solver.

Definition at line 204 of file smpc_solver.cpp.

◆ get_first_controls()

void smpc::solver_as::get_first_controls ( control c) const
virtual

These functions are documented in the definition of the base abstract class smpc::solver.

Implements smpc::solver.

Definition at line 198 of file smpc_solver.cpp.

◆ get_next_state() [1/2]

void smpc::solver_as::get_next_state ( state_com s) const
virtual

These functions are documented in the definition of the base abstract class smpc::solver.

Implements smpc::solver.

Definition at line 166 of file smpc_solver.cpp.

◆ get_next_state() [2/2]

void smpc::solver_as::get_next_state ( state_zmp s) const
virtual

These functions are documented in the definition of the base abstract class smpc::solver.

Implements smpc::solver.

Definition at line 135 of file smpc_solver.cpp.

◆ get_state() [1/2]

void smpc::solver_as::get_state ( state_com s,
const int  ind 
) const
virtual

These functions are documented in the definition of the base abstract class smpc::solver.

Implements smpc::solver.

Definition at line 172 of file smpc_solver.cpp.

◆ get_state() [2/2]

void smpc::solver_as::get_state ( state_zmp s,
const int  ind 
) const
virtual

These functions are documented in the definition of the base abstract class smpc::solver.

Implements smpc::solver.

Definition at line 141 of file smpc_solver.cpp.

◆ set_parameters()

void smpc::solver_as::set_parameters ( const double *  T,
const double *  h,
const double  h_initial,
const double *  angle,
const double *  zref_x,
const double *  zref_y,
const double *  lb,
const double *  ub 
)
virtual

These functions are documented in the definition of the base abstract class smpc::solver.

Implements smpc::solver.

Definition at line 80 of file smpc_solver.cpp.

◆ solve()

void smpc::solver_as::solve ( )
virtual

These functions are documented in the definition of the base abstract class smpc::solver.

Implements smpc::solver.

Definition at line 119 of file smpc_solver.cpp.

Member Data Documentation

◆ active_set_size

unsigned int smpc::solver_as::active_set_size

The final size of the active set.

Note
Updated by solve function.

Definition at line 394 of file smpc_solver.h.

◆ added_constraints_num

unsigned int smpc::solver_as::added_constraints_num

Number of added constraints (the constraints, that were removed are also counted).

Note
Updated by solve function.

Definition at line 380 of file smpc_solver.h.

◆ objective_log

std::vector<double> smpc::solver_as::objective_log

Contains values of objective function after each iteration, the initial value is also included.

Note
Updated by solve function (only if the respective flag is set on initialization).

Definition at line 404 of file smpc_solver.h.

◆ qp_sol

qp_as* smpc::solver_as::qp_sol

Internal representation.

Definition at line 413 of file smpc_solver.h.

◆ removed_constraints_num

unsigned int smpc::solver_as::removed_constraints_num

Number of removed constraints.

Note
Updated by solve function.

Definition at line 387 of file smpc_solver.h.


The documentation for this class was generated from the following files: