robotoc
robotoc - efficient ROBOT Optimal Control solvers
Loading...
Searching...
No Matches
robotoc::UnconstrOCPSolver Class Reference

Optimal control problem solver of unconstrained rigid-body systems by Riccati recursion. "Unconstrained" means that the system does not have either a floating base or any contacts. More...

#include <unconstr_ocp_solver.hpp>

Public Member Functions

 UnconstrOCPSolver (const OCP &ocp, const SolverOptions &solver_options=SolverOptions())
 Construct optimal control problem solver. More...
 
 UnconstrOCPSolver ()
 Default constructor. More...
 
 ~UnconstrOCPSolver ()=default
 Destructor. More...
 
 UnconstrOCPSolver (const UnconstrOCPSolver &)=default
 Default copy constructor. More...
 
UnconstrOCPSolveroperator= (const UnconstrOCPSolver &)=default
 Default copy assign operator. More...
 
 UnconstrOCPSolver (UnconstrOCPSolver &&) noexcept=default
 Default move constructor. More...
 
UnconstrOCPSolveroperator= (UnconstrOCPSolver &&) noexcept=default
 Default move assign operator. More...
 
void setSolverOptions (const SolverOptions &solver_options)
 Sets the solver option. More...
 
void discretize (const double t)
 Discretizes the problem and reiszes the data structures. More...
 
void initConstraints ()
 Initializes the priaml-dual interior point method for inequality constraints. More...
 
void solve (const double t, const Eigen::VectorXd &q, const Eigen::VectorXd &v, const bool init_solver=true)
 Solves the optimal control problem. Internally calls updateSolution(). More...
 
const SolverStatisticsgetSolverStatistics () const
 Gets the solver statistics. More...
 
const SplitSolutiongetSolution (const int stage) const
 Get the split solution of a time stage. For example, the control input torques at the initial stage can be obtained by ocp.getSolution(0).u. More...
 
std::vector< Eigen::VectorXd > getSolution (const std::string &name) const
 Get the solution vector over the horizon. More...
 
const std::vector< LQRPolicy > & getLQRPolicy () const
 Gets of the local LQR policies over the horizon. More...
 
void setSolution (const std::string &name, const Eigen::VectorXd &value)
 Sets the solution over the horizon. More...
 
double KKTError (const double t, const Eigen::VectorXd &q, const Eigen::VectorXd &v)
 Computes the KKT residual of the optimal control problem and returns the KKT error, that is, the l2-norm of the KKT residual. More...
 
double KKTError () const
 Returns the l2-norm of the KKT residuals using the results of UnconstrOCPsolver::updateSolution() or UnconstrOCPsolver::solve(). More...
 
const std::vector< GridInfo > & getTimeDiscretization () const
 Gets the discretization. More...
 
void setRobotProperties (const RobotProperties &properties)
 Sets a collection of the properties for robot model in this solver. More...
 

Detailed Description

Optimal control problem solver of unconstrained rigid-body systems by Riccati recursion. "Unconstrained" means that the system does not have either a floating base or any contacts.

Constructor & Destructor Documentation

◆ UnconstrOCPSolver() [1/4]

robotoc::UnconstrOCPSolver::UnconstrOCPSolver ( const OCP ocp,
const SolverOptions solver_options = SolverOptions() 
)

Construct optimal control problem solver.

Parameters
[in]ocpOptimal control problem.
[in]solver_optionsSolver options. Default is SolverOptions().

◆ UnconstrOCPSolver() [2/4]

robotoc::UnconstrOCPSolver::UnconstrOCPSolver ( )

Default constructor.

◆ ~UnconstrOCPSolver()

robotoc::UnconstrOCPSolver::~UnconstrOCPSolver ( )
default

Destructor.

◆ UnconstrOCPSolver() [3/4]

robotoc::UnconstrOCPSolver::UnconstrOCPSolver ( const UnconstrOCPSolver )
default

Default copy constructor.

◆ UnconstrOCPSolver() [4/4]

robotoc::UnconstrOCPSolver::UnconstrOCPSolver ( UnconstrOCPSolver &&  )
defaultnoexcept

Default move constructor.

Member Function Documentation

◆ discretize()

void robotoc::UnconstrOCPSolver::discretize ( const double  t)

Discretizes the problem and reiszes the data structures.

Parameters
[in]tInitial time of the horizon.

◆ getLQRPolicy()

const std::vector< LQRPolicy > & robotoc::UnconstrOCPSolver::getLQRPolicy ( ) const

Gets of the local LQR policies over the horizon.

Returns
const reference to the local LQR policies.

◆ getSolution() [1/2]

const SplitSolution & robotoc::UnconstrOCPSolver::getSolution ( const int  stage) const

Get the split solution of a time stage. For example, the control input torques at the initial stage can be obtained by ocp.getSolution(0).u.

Parameters
[in]stageTime stage of interest. Must be larger than 0 and smaller than N.
Returns
Const reference to the split solution of the specified time stage.

◆ getSolution() [2/2]

std::vector< Eigen::VectorXd > robotoc::UnconstrOCPSolver::getSolution ( const std::string &  name) const

Get the solution vector over the horizon.

Parameters
[in]nameName of the variable.
Returns
Solution vector.

◆ getSolverStatistics()

const SolverStatistics & robotoc::UnconstrOCPSolver::getSolverStatistics ( ) const

Gets the solver statistics.

Returns
Solver statistics.

◆ getTimeDiscretization()

const std::vector< GridInfo > & robotoc::UnconstrOCPSolver::getTimeDiscretization ( ) const

Gets the discretization.

Returns
Returns const reference to the time discretization.

◆ initConstraints()

void robotoc::UnconstrOCPSolver::initConstraints ( )

Initializes the priaml-dual interior point method for inequality constraints.

◆ KKTError() [1/2]

double robotoc::UnconstrOCPSolver::KKTError ( ) const

Returns the l2-norm of the KKT residuals using the results of UnconstrOCPsolver::updateSolution() or UnconstrOCPsolver::solve().

Returns
The l2-norm of the KKT residual.

◆ KKTError() [2/2]

double robotoc::UnconstrOCPSolver::KKTError ( const double  t,
const Eigen::VectorXd &  q,
const Eigen::VectorXd &  v 
)

Computes the KKT residual of the optimal control problem and returns the KKT error, that is, the l2-norm of the KKT residual.

Parameters
[in]tInitial time of the horizon.
[in]qInitial configuration. Size must be Robot::dimq().
[in]vInitial velocity. Size must be Robot::dimv().
Returns
The KKT error, that is, the l2-norm of the KKT residual.

◆ operator=() [1/2]

UnconstrOCPSolver & robotoc::UnconstrOCPSolver::operator= ( const UnconstrOCPSolver )
default

Default copy assign operator.

◆ operator=() [2/2]

UnconstrOCPSolver & robotoc::UnconstrOCPSolver::operator= ( UnconstrOCPSolver &&  )
defaultnoexcept

Default move assign operator.

◆ setRobotProperties()

void robotoc::UnconstrOCPSolver::setRobotProperties ( const RobotProperties properties)

Sets a collection of the properties for robot model in this solver.

Parameters
[in]propertiesA collection of the properties for the robot model.

◆ setSolution()

void robotoc::UnconstrOCPSolver::setSolution ( const std::string &  name,
const Eigen::VectorXd &  value 
)

Sets the solution over the horizon.

Parameters
[in]nameName of the variable.
[in]valueValue of the specified variable.

◆ setSolverOptions()

void robotoc::UnconstrOCPSolver::setSolverOptions ( const SolverOptions solver_options)

Sets the solver option.

Parameters
[in]solver_optionsSolver options.

◆ solve()

void robotoc::UnconstrOCPSolver::solve ( const double  t,
const Eigen::VectorXd &  q,
const Eigen::VectorXd &  v,
const bool  init_solver = true 
)

Solves the optimal control problem. Internally calls updateSolution().

Parameters
[in]tInitial time of the horizon.
[in]qInitial configuration. Size must be Robot::dimq().
[in]vInitial velocity. Size must be Robot::dimv().
[in]init_solverIf true, initializes the solver, that is, calls initConstraints() and clears the line search filter. Default is true.

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