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

Solution to the optimal control problem split into a time stage. More...

#include <split_solution.hpp>

Public Types

using Vector6d = Eigen::Matrix< double, 6, 1 >
 

Public Member Functions

 SplitSolution (const Robot &robot)
 Construct a split solution. More...
 
 SplitSolution ()
 Default constructor. More...
 
 ~SplitSolution ()=default
 Default destructor. More...
 
 SplitSolution (const SplitSolution &)=default
 Default copy constructor. More...
 
SplitSolutionoperator= (const SplitSolution &)=default
 Default copy assign operator. More...
 
 SplitSolution (SplitSolution &&) noexcept=default
 Default move constructor. More...
 
SplitSolutionoperator= (SplitSolution &&) noexcept=default
 Default move assign operator. More...
 
void setContactStatus (const ContactStatus &contact_status)
 Set contact status, i.e., set the dimension of the contacts. More...
 
void setContactStatus (const ImpactStatus &contact_status)
 Set contact status, i.e., set the dimension of the contacts. More...
 
void setContactStatus (const SplitSolution &other)
 Set contact status, i.e., set the dimension of the contacts. More...
 
void setSwitchingConstraintDimension (const int dims)
 Sets the dimension of the switching constraint. More...
 
Eigen::VectorBlock< Eigen::VectorXd > f_stack ()
 Stack of the active contact forces. Size is ContactStatus::dimf(). More...
 
const Eigen::VectorBlock< const Eigen::VectorXd > f_stack () const
 Const version of SplitSolution::f_stack(). More...
 
void set_f_stack ()
 Sets SplitSolution::f_stack() from SplitSolution::f. More...
 
void set_f_vector ()
 Sets SplitSolution::f from SplitSolution::f_stack(). More...
 
Eigen::VectorBlock< Eigen::VectorXd > mu_stack ()
 Stack of the Lagrange multipliers w.r.t. the acceleration-level contact constraints that is active at the current contact status. Size is SplitSolution::dimf(). More...
 
const Eigen::VectorBlock< const Eigen::VectorXd > mu_stack () const
 Const version of SplitSolution::mu_stack(). More...
 
void set_mu_stack ()
 Set SplitSolution::mu_stack() from SplitSolution::mu. More...
 
void set_mu_vector ()
 Set SplitSolution::mu from SplitSolution::mu_stack(). More...
 
Eigen::VectorBlock< Eigen::VectorXd > xi_stack ()
 Stack of the Lagrange multipliers w.r.t. the switching constraints that is active at the future impact status. Size is SplitSolution::dimf(). More...
 
const Eigen::VectorBlock< const Eigen::VectorXd > xi_stack () const
 const version of SplitSolution::xi_stack(). More...
 
int dimf () const
 Returns the dimension of the contact at the current contact status. More...
 
int dims () const
 Returns the dimension of the switching constraint. More...
 
bool isContactActive (const int contact_index) const
 Return true if contact is active and false if not. More...
 
std::vector< bool > isContactActive () const
 Return activities of contacts. More...
 
void integrate (const Robot &robot, const double step_size, const SplitDirection &d, const bool impact=false)
 Integrates the solution based on step size and direction. More...
 
void copyPrimal (const SplitSolution &other)
 Copies the primal solution from another solution. More...
 
void copyDual (const SplitSolution &other)
 Copies the dual solution from another solution. More...
 
bool isApprox (const SplitSolution &other) const
 Return true if two SplitSolution have the same value and false if not. More...
 
double lagrangeMultiplierLinfNorm () const
 Return L-infinity Norm of the lagrange multipliers. Used in line search. More...
 
void setRandom (const Robot &robot)
 Set each component vector by random value based on the current contact status. More...
 
void setRandom (const Robot &robot, const ContactStatus &contact_status)
 Set each component vector by random value. Contact status is reset. More...
 
void setRandom (const Robot &robot, const ImpactStatus &impact_status)
 Set each component vector by random value. Impact status is reset. More...
 
void setRandom (const Robot &robot, const ContactStatus &contact_status, const ImpactStatus &impact_status)
 Set each component vector by random value. Contact status and impact status are reset. More...
 
void disp (std::ostream &os) const
 Displays the split solution onto a ostream. More...
 

Static Public Member Functions

static SplitSolution Random (const Robot &robot)
 Generates split solution filled randomly. More...
 
static SplitSolution Random (const Robot &robot, const ContactStatus &contact_status)
 Generates split solution filled randomly. More...
 
static SplitSolution Random (const Robot &robot, const ImpactStatus &impact_status)
 Generates split solution filled randomly. More...
 
static SplitSolution Random (const Robot &robot, const ContactStatus &contact_status, const ImpactStatus &impact_status)
 Generates split solution filled randomly. More...
 

Public Attributes

Eigen::VectorXd q
 Configuration. Size is Robot::dimq(). More...
 
Eigen::VectorXd v
 Generalized velocity. Size is Robot::dimv(). More...
 
Eigen::VectorXd a
 Generalized acceleration. Size is Robot::dimv(). More...
 
Eigen::VectorXd dv
 Generalized acceleration. Size is Robot::dimv(). More...
 
Eigen::VectorXd u
 Control input torques. Size is Robot::dimu(). More...
 
std::vector< Vector6df
 Contact wrenches. Upper 3 elements are linear contact force and the lower 3 elements are the angular momentum. Size is Robot::maxNumContacts(). More...
 
Eigen::VectorXd lmd
 Lagrange multiplier w.r.t. the state equation w.r.t. q. Size is Robot::dimv(). More...
 
Eigen::VectorXd gmm
 Lagrange multiplier w.r.t. the state equation w.r.t. v. Size is Robot::dimv(). More...
 
Eigen::VectorXd beta
 Lagrange multiplier w.r.t. the inverse dynamics constraint. Size is Robot::dimv(). More...
 
std::vector< Vector6dmu
 Lagrange multiplier w.r.t. the acceleration-level contact
constraint. Upper 3 elements are w.r.t. the linear contact acceleration and the lower 3 elements are w.r.t. the angular contact acceleration. Size is Robot::maxNumContacts(). More...
 
Eigen::VectorXd nu_passive
 Lagrange multiplier w.r.t. the passive joint constraint. Size is Robot::dim_passive(). More...
 

Friends

std::ostream & operator<< (std::ostream &os, const SplitSolution &s)
 

Detailed Description

Solution to the optimal control problem split into a time stage.

Member Typedef Documentation

◆ Vector6d

using robotoc::SplitSolution::Vector6d = Eigen::Matrix<double, 6, 1>

Constructor & Destructor Documentation

◆ SplitSolution() [1/4]

robotoc::SplitSolution::SplitSolution ( const Robot robot)

Construct a split solution.

Parameters
[in]robotRobot model.

◆ SplitSolution() [2/4]

robotoc::SplitSolution::SplitSolution ( )

Default constructor.

◆ ~SplitSolution()

robotoc::SplitSolution::~SplitSolution ( )
default

Default destructor.

◆ SplitSolution() [3/4]

robotoc::SplitSolution::SplitSolution ( const SplitSolution )
default

Default copy constructor.

◆ SplitSolution() [4/4]

robotoc::SplitSolution::SplitSolution ( SplitSolution &&  )
defaultnoexcept

Default move constructor.

Member Function Documentation

◆ copyDual()

void robotoc::SplitSolution::copyDual ( const SplitSolution other)

Copies the dual solution from another solution.

Parameters
[in]otherAnother split solution.

◆ copyPrimal()

void robotoc::SplitSolution::copyPrimal ( const SplitSolution other)

Copies the primal solution from another solution.

Parameters
[in]otherAnother split solution.

◆ dimf()

int robotoc::SplitSolution::dimf ( ) const
inline

Returns the dimension of the contact at the current contact status.

Returns
Dimension of the contact.

◆ dims()

int robotoc::SplitSolution::dims ( ) const
inline

Returns the dimension of the switching constraint.

Returns
Dimension of the switching constraint.

◆ disp()

void robotoc::SplitSolution::disp ( std::ostream &  os) const

Displays the split solution onto a ostream.

◆ f_stack() [1/2]

Eigen::VectorBlock< Eigen::VectorXd > robotoc::SplitSolution::f_stack ( )
inline

Stack of the active contact forces. Size is ContactStatus::dimf().

Returns
Reference to the stack of the active contact forces.

◆ f_stack() [2/2]

const Eigen::VectorBlock< const Eigen::VectorXd > robotoc::SplitSolution::f_stack ( ) const
inline

Const version of SplitSolution::f_stack().

◆ integrate()

void robotoc::SplitSolution::integrate ( const Robot robot,
const double  step_size,
const SplitDirection d,
const bool  impact = false 
)

Integrates the solution based on step size and direction.

Parameters
[in]robotRobot model.
[in]step_sizeStep size.
[in]dSplit direction.
[in]impactFlaf if this is impact stage or not.

◆ isApprox()

bool robotoc::SplitSolution::isApprox ( const SplitSolution other) const

Return true if two SplitSolution have the same value and false if not.

Parameters
[in]otherSplit solution that is compared with this object.

◆ isContactActive() [1/2]

std::vector< bool > robotoc::SplitSolution::isContactActive ( ) const
inline

Return activities of contacts.

Returns
Activities of contacts.

◆ isContactActive() [2/2]

bool robotoc::SplitSolution::isContactActive ( const int  contact_index) const
inline

Return true if contact is active and false if not.

Parameters
[in]contact_indexIndex of a contact of interedted.
Returns
true if a contact is active and false if not.

◆ lagrangeMultiplierLinfNorm()

double robotoc::SplitSolution::lagrangeMultiplierLinfNorm ( ) const

Return L-infinity Norm of the lagrange multipliers. Used in line search.

◆ mu_stack() [1/2]

Eigen::VectorBlock< Eigen::VectorXd > robotoc::SplitSolution::mu_stack ( )
inline

Stack of the Lagrange multipliers w.r.t. the acceleration-level contact constraints that is active at the current contact status. Size is SplitSolution::dimf().

Returns
Reference to the stack of the Lagrange multipliers w.r.t. the acceleration-level contact constraints.

◆ mu_stack() [2/2]

const Eigen::VectorBlock< const Eigen::VectorXd > robotoc::SplitSolution::mu_stack ( ) const
inline

Const version of SplitSolution::mu_stack().

◆ operator=() [1/2]

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

Default copy assign operator.

◆ operator=() [2/2]

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

Default move assign operator.

◆ Random() [1/4]

static SplitSolution robotoc::SplitSolution::Random ( const Robot robot)
static

Generates split solution filled randomly.

Returns
Split solution filled randomly.
Parameters
[in]robotRobot model.

◆ Random() [2/4]

static SplitSolution robotoc::SplitSolution::Random ( const Robot robot,
const ContactStatus contact_status 
)
static

Generates split solution filled randomly.

Returns
Split solution filled randomly.
Parameters
[in]robotRobot model.
[in]contact_statusContact status.

◆ Random() [3/4]

static SplitSolution robotoc::SplitSolution::Random ( const Robot robot,
const ContactStatus contact_status,
const ImpactStatus impact_status 
)
static

Generates split solution filled randomly.

Returns
Split solution filled randomly.
Parameters
[in]robotRobot model.
[in]contact_statusContact status.
[in]impact_statusImpact status.

◆ Random() [4/4]

static SplitSolution robotoc::SplitSolution::Random ( const Robot robot,
const ImpactStatus impact_status 
)
static

Generates split solution filled randomly.

Returns
Split solution filled randomly.
Parameters
[in]robotRobot model.
[in]impact_statusImpact status.

◆ set_f_stack()

void robotoc::SplitSolution::set_f_stack ( )
inline

◆ set_f_vector()

void robotoc::SplitSolution::set_f_vector ( )
inline

◆ set_mu_stack()

void robotoc::SplitSolution::set_mu_stack ( )
inline

◆ set_mu_vector()

void robotoc::SplitSolution::set_mu_vector ( )
inline

◆ setContactStatus() [1/3]

void robotoc::SplitSolution::setContactStatus ( const ContactStatus contact_status)
inline

Set contact status, i.e., set the dimension of the contacts.

Parameters
[in]contact_statusContact status.

◆ setContactStatus() [2/3]

void robotoc::SplitSolution::setContactStatus ( const ImpactStatus contact_status)
inline

Set contact status, i.e., set the dimension of the contacts.

Parameters
[in]contact_statusContact status.

◆ setContactStatus() [3/3]

void robotoc::SplitSolution::setContactStatus ( const SplitSolution other)
inline

Set contact status, i.e., set the dimension of the contacts.

Parameters
[in]otherOther split solution.

◆ setRandom() [1/4]

void robotoc::SplitSolution::setRandom ( const Robot robot)

Set each component vector by random value based on the current contact status.

Parameters
[in]robotRobot model.

◆ setRandom() [2/4]

void robotoc::SplitSolution::setRandom ( const Robot robot,
const ContactStatus contact_status 
)

Set each component vector by random value. Contact status is reset.

Parameters
[in]robotRobot model.
[in]contact_statusContact status.

◆ setRandom() [3/4]

void robotoc::SplitSolution::setRandom ( const Robot robot,
const ContactStatus contact_status,
const ImpactStatus impact_status 
)

Set each component vector by random value. Contact status and impact status are reset.

Parameters
[in]robotRobot model.
[in]contact_statusContact status.
[in]impact_statusImpact status.

◆ setRandom() [4/4]

void robotoc::SplitSolution::setRandom ( const Robot robot,
const ImpactStatus impact_status 
)

Set each component vector by random value. Impact status is reset.

Parameters
[in]robotRobot model.
[in]impact_statusImpact status.

◆ setSwitchingConstraintDimension()

void robotoc::SplitSolution::setSwitchingConstraintDimension ( const int  dims)
inline

Sets the dimension of the switching constraint.

Parameters
[in]dimsThe dimension of the switching constraint. Must be non-negative.

◆ xi_stack() [1/2]

Eigen::VectorBlock< Eigen::VectorXd > robotoc::SplitSolution::xi_stack ( )
inline

Stack of the Lagrange multipliers w.r.t. the switching constraints that is active at the future impact status. Size is SplitSolution::dimf().

Returns
Reference to the stack of the Lagrange multipliers w.r.t. the switching constraints.

◆ xi_stack() [2/2]

const Eigen::VectorBlock< const Eigen::VectorXd > robotoc::SplitSolution::xi_stack ( ) const
inline

const version of SplitSolution::xi_stack().

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const SplitSolution s 
)
friend

Member Data Documentation

◆ a

Eigen::VectorXd robotoc::SplitSolution::a

Generalized acceleration. Size is Robot::dimv().

◆ beta

Eigen::VectorXd robotoc::SplitSolution::beta

Lagrange multiplier w.r.t. the inverse dynamics constraint. Size is Robot::dimv().

◆ dv

Eigen::VectorXd robotoc::SplitSolution::dv

Generalized acceleration. Size is Robot::dimv().

◆ f

std::vector<Vector6d> robotoc::SplitSolution::f

Contact wrenches. Upper 3 elements are linear contact force and the lower 3 elements are the angular momentum. Size is Robot::maxNumContacts().

◆ gmm

Eigen::VectorXd robotoc::SplitSolution::gmm

Lagrange multiplier w.r.t. the state equation w.r.t. v. Size is Robot::dimv().

◆ lmd

Eigen::VectorXd robotoc::SplitSolution::lmd

Lagrange multiplier w.r.t. the state equation w.r.t. q. Size is Robot::dimv().

◆ mu

std::vector<Vector6d> robotoc::SplitSolution::mu

Lagrange multiplier w.r.t. the acceleration-level contact
constraint. Upper 3 elements are w.r.t. the linear contact acceleration and the lower 3 elements are w.r.t. the angular contact acceleration. Size is Robot::maxNumContacts().

◆ nu_passive

Eigen::VectorXd robotoc::SplitSolution::nu_passive

Lagrange multiplier w.r.t. the passive joint constraint. Size is Robot::dim_passive().

◆ q

Eigen::VectorXd robotoc::SplitSolution::q

Configuration. Size is Robot::dimq().

◆ u

Eigen::VectorXd robotoc::SplitSolution::u

Control input torques. Size is Robot::dimu().

◆ v

Eigen::VectorXd robotoc::SplitSolution::v

Generalized velocity. Size is Robot::dimv().


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