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

MPC solver for the jump control. More...

#include <mpc_jump.hpp>

Public Member Functions

 MPCJump (const Robot &robot, const double T, const int N)
 Construct MPC solver. More...
 
 MPCJump ()
 Default constructor. More...
 
 ~MPCJump ()
 Destructor. More...
 
 MPCJump (const MPCJump &)=default
 Default copy constructor. More...
 
MPCJumpoperator= (const MPCJump &)=default
 Default copy assign operator. More...
 
 MPCJump (MPCJump &&) noexcept=default
 Default move constructor. More...
 
MPCJumpoperator= (MPCJump &&) noexcept=default
 Default move assign operator. More...
 
void setJumpPattern (const std::shared_ptr< ContactPlannerBase > &foot_step_planner, const double flying_time, const double min_flying_time, const double ground_time, const double min_ground_time)
 Sets the gait pattern. More...
 
void init (const double t, const Eigen::VectorXd &q, const Eigen::VectorXd &v, const SolverOptions &solver_options, const bool sto=false)
 Initializes the optimal control problem solover. More...
 
void reset ()
 Resets the optimal control problem solover via the solution computed by init() or reset(). More...
 
void reset (const Eigen::VectorXd &q, const Eigen::VectorXd &v)
 Resets the optimal control problem solover via the solution computed by init(), q, and v. More...
 
void reset (const double t, const Eigen::VectorXd &q, const Eigen::VectorXd &v, const SolverOptions &solver_options, const bool sto=false)
 Resets the optimal control problem solver using the previous results of init() or reset(). More...
 
void setSolverOptions (const SolverOptions &solver_options)
 Sets the solver options. More...
 
void updateSolution (const double t, const double dt, const Eigen::VectorXd &q, const Eigen::VectorXd &v)
 Updates the solution by iterationg the Newton-type method. More...
 
const Eigen::VectorXd & getInitialControlInput () const
 Get the initial control input. More...
 
const SolutiongetSolution () const
 Get the solution over the horizon. More...
 
const aligned_vector< LQRPolicy > & getLQRPolicy () const
 Gets of the local LQR policies over the horizon. More...
 
ControlPolicy getControlPolicy (const double t) const
 Gets the control policy at the specified time.
More...
 
double KKTError (const double t, const Eigen::VectorXd &q, const Eigen::VectorXd &v)
 Computes the KKT residual of the optimal control problem. More...
 
double KKTError () const
 Returns the l2-norm of the KKT residuals. MPCJump::updateSolution() must be computed.
More...
 
std::shared_ptr< CostFunctiongetCostHandle ()
 Gets the cost function handle.
More...
 
std::shared_ptr< ConfigurationSpaceCostgetConfigCostHandle ()
 Gets the configuration space cost handle.
More...
 
std::shared_ptr< ConstraintsgetConstraintsHandle ()
 Gets the constraints handle.
More...
 
std::shared_ptr< FrictionConegetFrictionConeHandle ()
 Gets the friction cone constraints handle.
More...
 
std::shared_ptr< ContactWrenchConegetContactWrenchConeHandle ()
 Gets the contact wrench cone constraints handle.
More...
 
const OCPSolvergetSolver () const
 Gets the const handle of the MPC solver.
More...
 
const std::shared_ptr< ContactSequence > & getContactSequence () const
 Gets the const handle of the contact sequence.
More...
 
void setRobotProperties (const RobotProperties &properties)
 Sets a collection of the properties for robot model in this MPC. More...
 

Detailed Description

MPC solver for the jump control.

Constructor & Destructor Documentation

◆ MPCJump() [1/4]

robotoc::MPCJump::MPCJump ( const Robot robot,
const double  T,
const int  N 
)

Construct MPC solver.

Parameters
[in]robotRobot model.
[in]TLength of the horizon.
[in]NNumber of the discretization grids of the horizon.

◆ MPCJump() [2/4]

robotoc::MPCJump::MPCJump ( )

Default constructor.

◆ ~MPCJump()

robotoc::MPCJump::~MPCJump ( )

Destructor.

◆ MPCJump() [3/4]

robotoc::MPCJump::MPCJump ( const MPCJump )
default

Default copy constructor.

◆ MPCJump() [4/4]

robotoc::MPCJump::MPCJump ( MPCJump &&  )
defaultnoexcept

Default move constructor.

Member Function Documentation

◆ getConfigCostHandle()

std::shared_ptr< ConfigurationSpaceCost > robotoc::MPCJump::getConfigCostHandle ( )

Gets the configuration space cost handle.

Returns
Shared ptr to the configuration space cost.

◆ getConstraintsHandle()

std::shared_ptr< Constraints > robotoc::MPCJump::getConstraintsHandle ( )

Gets the constraints handle.

Returns
Shared ptr to the constraints.

◆ getContactSequence()

const std::shared_ptr< ContactSequence > & robotoc::MPCJump::getContactSequence ( ) const
inline

Gets the const handle of the contact sequence.

Returns
Const reference to the shared_ptr of the contact sequence.

◆ getContactWrenchConeHandle()

std::shared_ptr< ContactWrenchCone > robotoc::MPCJump::getContactWrenchConeHandle ( )

Gets the contact wrench cone constraints handle.

Returns
Shared ptr to the wrench cone constraints.

◆ getControlPolicy()

ControlPolicy robotoc::MPCJump::getControlPolicy ( const double  t) const
inline

Gets the control policy at the specified time.

Parameters
[in]tThe specified time.
Returns
Control poclity at the specified time.

◆ getCostHandle()

std::shared_ptr< CostFunction > robotoc::MPCJump::getCostHandle ( )

Gets the cost function handle.

Returns
Shared ptr to the cost function.

◆ getFrictionConeHandle()

std::shared_ptr< FrictionCone > robotoc::MPCJump::getFrictionConeHandle ( )

Gets the friction cone constraints handle.

Returns
Shared ptr to the friction cone constraints.

◆ getInitialControlInput()

const Eigen::VectorXd & robotoc::MPCJump::getInitialControlInput ( ) const

Get the initial control input.

Returns
Const reference to the control input.

◆ getLQRPolicy()

const aligned_vector< LQRPolicy > & robotoc::MPCJump::getLQRPolicy ( ) const

Gets of the local LQR policies over the horizon.

Returns
const reference to the local LQR policies.

◆ getSolution()

const Solution & robotoc::MPCJump::getSolution ( ) const

Get the solution over the horizon.

Returns
const reference to the solution.

◆ getSolver()

const OCPSolver & robotoc::MPCJump::getSolver ( ) const
inline

Gets the const handle of the MPC solver.

Returns
Const reference to the MPC solver.

◆ init()

void robotoc::MPCJump::init ( const double  t,
const Eigen::VectorXd &  q,
const Eigen::VectorXd &  v,
const SolverOptions solver_options,
const bool  sto = false 
)

Initializes the optimal control problem solover.

Parameters
[in]tInitial time of the horizon.
[in]qInitial configuration. Size must be Robot::dimq().
[in]vInitial velocity. Size must be Robot::dimv().
[in]solver_optionsSolver options for the initialization.
[in]stoIf true, the STO algorithm is enabled, that is, the lift-off and touch-down timings are optimized.

◆ KKTError() [1/2]

double robotoc::MPCJump::KKTError ( ) const

Returns the l2-norm of the KKT residuals. MPCJump::updateSolution() must be computed.

Returns
The l2-norm of the KKT residual.

◆ KKTError() [2/2]

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

Computes the KKT residual of the optimal control problem.

Parameters
[in]tInitial time of the horizon.
[in]qInitial configuration. Size must be Robot::dimq().
[in]vInitial velocity. Size must be Robot::dimv().
Remarks
The linear and angular velocities of the floating base are assumed to be expressed in the body local coordinate.

◆ operator=() [1/2]

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

Default copy assign operator.

◆ operator=() [2/2]

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

Default move assign operator.

◆ reset() [1/3]

void robotoc::MPCJump::reset ( )

Resets the optimal control problem solover via the solution computed by init() or reset().

◆ reset() [2/3]

void robotoc::MPCJump::reset ( const double  t,
const Eigen::VectorXd &  q,
const Eigen::VectorXd &  v,
const SolverOptions solver_options,
const bool  sto = false 
)

Resets the optimal control problem solver using the previous results of init() or reset().

Parameters
[in]tInitial time of the horizon.
[in]qInitial configuration. Size must be Robot::dimq().
[in]vInitial velocity. Size must be Robot::dimv().
[in]solver_optionsSolver options for the initialization.
[in]stoIf true, lift-off and touch-down timings are optimized.
Remarks
The linear and angular velocities of the floating base are assumed to be expressed in the body local coordinate.

◆ reset() [3/3]

void robotoc::MPCJump::reset ( const Eigen::VectorXd &  q,
const Eigen::VectorXd &  v 
)

Resets the optimal control problem solover via the solution computed by init(), q, and v.

◆ setJumpPattern()

void robotoc::MPCJump::setJumpPattern ( const std::shared_ptr< ContactPlannerBase > &  foot_step_planner,
const double  flying_time,
const double  min_flying_time,
const double  ground_time,
const double  min_ground_time 
)

Sets the gait pattern.

Parameters
[in]foot_step_plannerFoot step planner of the jump.
[in]flying_timeIf STO is enabled, this is initial guess of the flying time. Otherwise, this is used as the fixed flying time.
[in]min_flying_timeMinimum flying time.
[in]ground_timeIf STO is enabled, this is initial guess of the ground time. Otherwise, this is used as the fixed ground time.
[in]min_ground_timeMinimum time duration after landing.

◆ setRobotProperties()

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

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

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

◆ setSolverOptions()

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

Sets the solver options.

Parameters
[in]solver_optionsSolver options.

◆ updateSolution()

void robotoc::MPCJump::updateSolution ( const double  t,
const double  dt,
const Eigen::VectorXd &  q,
const Eigen::VectorXd &  v 
)

Updates the solution by iterationg the Newton-type method.

Parameters
[in]tInitial time of the horizon.
[in]dtSampling time of MPC. Must be positive.
[in]qConfiguration. Size must be Robot::dimq().
[in]vVelocity. Size must be Robot::dimv().
Remarks
The linear and angular velocities of the floating base are assumed to be expressed in the body local coordinate.

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