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

KKT residual split into each time stage. More...

#include <split_kkt_residual.hpp>

Public Member Functions

 SplitKKTResidual (const Robot &robot)
 Construct a split KKT residual. More...
 
 SplitKKTResidual ()
 Default constructor. More...
 
 ~SplitKKTResidual ()=default
 Default destructor. More...
 
 SplitKKTResidual (const SplitKKTResidual &)=default
 Default copy constructor. More...
 
SplitKKTResidualoperator= (const SplitKKTResidual &)=default
 Default copy operator. More...
 
 SplitKKTResidual (SplitKKTResidual &&) noexcept=default
 Default move constructor. More...
 
SplitKKTResidualoperator= (SplitKKTResidual &&) noexcept=default
 Default move assign operator. More...
 
void setContactDimension (const int dimf)
 Sets contact status, i.e., set dimension of the contact forces. More...
 
void setSwitchingConstraintDimension (const int dims)
 Sets the dimension of the switching constraint. More...
 
Eigen::VectorBlock< Eigen::VectorXd > Fq ()
 Residual in the state equation w.r.t. the configuration q. More...
 
const Eigen::VectorBlock< const Eigen::VectorXd > Fq () const
 const version of SplitKKTResidual::Fq(). More...
 
Eigen::VectorBlock< Eigen::VectorXd > Fv ()
 Residual in the state equation w.r.t. the velocity v. More...
 
const Eigen::VectorBlock< const Eigen::VectorXd > Fv () const
 const version of SplitKKTResidual::Fq(). More...
 
Eigen::VectorBlock< Eigen::VectorXd > P ()
 Residual in the switching constraint. More...
 
const Eigen::VectorBlock< const Eigen::VectorXd > P () const
 const version of SplitKKTResidual::P(). More...
 
Eigen::VectorBlock< Eigen::VectorXd > lq ()
 KKT residual w.r.t. the configuration q. More...
 
const Eigen::VectorBlock< const Eigen::VectorXd > lq () const
 const version of SplitKKTResidual::lq(). More...
 
Eigen::VectorBlock< Eigen::VectorXd > lv ()
 KKT residual w.r.t. the joint velocity v. More...
 
const Eigen::VectorBlock< const Eigen::VectorXd > lv () const
 const version of SplitKKTResidual::lv(). More...
 
Eigen::VectorBlock< Eigen::VectorXd > lf ()
 KKT residual w.r.t. the stack of the contact forces f. More...
 
const Eigen::VectorBlock< const Eigen::VectorXd > lf () const
 const version of SplitKKTResidual::lf(). More...
 
double KKTError () const
 Returns the squared norm of the KKT residual, that is, the primal and dual residual. More...
 
template<int p = 1>
double primalFeasibility () const
 Returns the lp norm of the primal feasibility, i.e., the constraint violation. Default norm is l1-norm. You can also specify l-infty norm by passing Eigen::Infinity as the template parameter. More...
 
template<int p = 1>
double dualFeasibility () const
 Returns the lp norm of the dual feasibility. Default norm is l1-norm. You can also specify l-infty norm by passing Eigen::Infinity as the template parameter. More...
 
void setZero ()
 Sets the split KKT residual zero. More...
 
int dimf () const
 Returns the dimension of the stack of the contact forces at the current contact status. More...
 
int dims () const
 Returns the dimension of the stack of the contact forces at the current contact status. More...
 
bool isDimensionConsistent () const
 Checks dimensional consistency of each component. More...
 
bool isApprox (const SplitKKTResidual &other) const
 Checks the equivalence of two SplitKKTResidual. More...
 
bool hasNaN () const
 Checks this has at least one NaN. More...
 
void setRandom ()
 Set by random value based on the current contact status. More...
 
void setRandom (const ContactStatus &contact_status)
 Set by random value. Contact status is reset. More...
 
void setRandom (const ImpactStatus &impact_status)
 Set by random value. Contact status is reset. More...
 
void disp (std::ostream &os) const
 Displays the split KKT residual onto a ostream. More...
 

Static Public Member Functions

static SplitKKTResidual Random (const Robot &robot)
 Generates split KKT residual filled randomly. More...
 
static SplitKKTResidual Random (const Robot &robot, const ContactStatus &contact_status)
 Generates split KKT residual filled randomly. More...
 
static SplitKKTResidual Random (const Robot &robot, const ImpactStatus &impact_status)
 Generates split KKT residual filled randomly. More...
 

Public Attributes

Eigen::VectorXd Fx
 Residual in the state equation. Size is 2 * Robot::dimv(). More...
 
Eigen::VectorXd lx
 KKT Residual w.r.t. the state x. Size is 2 * Robot::dimv(). More...
 
Eigen::VectorXd la
 KKT residual w.r.t. the acceleration a. Size is Robot::dimv(). More...
 
Eigen::VectorXd ldv
 KKT residual w.r.t. the impact change in the velocity ddv. Size is Robot::dimv(). More...
 
Eigen::VectorXd lu
 KKT residual w.r.t. the control input torques u. Size is Robot::dimu(). More...
 
double h
 KKT residual w.r.t. the switching time, that is, this is the value of the Hamiltonian. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const SplitKKTResidual &kkt_residual)
 

Detailed Description

KKT residual split into each time stage.

Constructor & Destructor Documentation

◆ SplitKKTResidual() [1/4]

robotoc::SplitKKTResidual::SplitKKTResidual ( const Robot robot)

Construct a split KKT residual.

Parameters
[in]robotRobot model.

◆ SplitKKTResidual() [2/4]

robotoc::SplitKKTResidual::SplitKKTResidual ( )

Default constructor.

◆ ~SplitKKTResidual()

robotoc::SplitKKTResidual::~SplitKKTResidual ( )
default

Default destructor.

◆ SplitKKTResidual() [3/4]

robotoc::SplitKKTResidual::SplitKKTResidual ( const SplitKKTResidual )
default

Default copy constructor.

◆ SplitKKTResidual() [4/4]

robotoc::SplitKKTResidual::SplitKKTResidual ( SplitKKTResidual &&  )
defaultnoexcept

Default move constructor.

Member Function Documentation

◆ dimf()

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

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

Returns
Dimension of the stack of the contact forces.

◆ dims()

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

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

Returns
Dimension of the stack of the contact forces.

◆ disp()

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

Displays the split KKT residual onto a ostream.

◆ dualFeasibility()

template<int p = 1>
double robotoc::SplitKKTResidual::dualFeasibility
inline

Returns the lp norm of the dual feasibility. Default norm is l1-norm. You can also specify l-infty norm by passing Eigen::Infinity as the template parameter.

Template Parameters
pIndex of norm. Default is 1 (l1-norm).
Returns
The lp norm of the dual feasibility.

◆ Fq() [1/2]

Eigen::VectorBlock< Eigen::VectorXd > robotoc::SplitKKTResidual::Fq ( )
inline

Residual in the state equation w.r.t. the configuration q.

Returns
Reference to the residual in the state equation w.r.t. q. Size is Robot::dimv().

◆ Fq() [2/2]

const Eigen::VectorBlock< const Eigen::VectorXd > robotoc::SplitKKTResidual::Fq ( ) const
inline

const version of SplitKKTResidual::Fq().

◆ Fv() [1/2]

Eigen::VectorBlock< Eigen::VectorXd > robotoc::SplitKKTResidual::Fv ( )
inline

Residual in the state equation w.r.t. the velocity v.

Returns
Reference to the residual in the state equation w.r.t. v. Size is Robot::dimv().

◆ Fv() [2/2]

const Eigen::VectorBlock< const Eigen::VectorXd > robotoc::SplitKKTResidual::Fv ( ) const
inline

const version of SplitKKTResidual::Fq().

◆ hasNaN()

bool robotoc::SplitKKTResidual::hasNaN ( ) const

Checks this has at least one NaN.

Returns
true if this has at least one NaN. false otherwise.

◆ isApprox()

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

Checks the equivalence of two SplitKKTResidual.

Parameters
[in]otherOther object.
Returns
true if this and other is same. false otherwise.

◆ isDimensionConsistent()

bool robotoc::SplitKKTResidual::isDimensionConsistent ( ) const

Checks dimensional consistency of each component.

Returns
true if the dimension is consistent. false if not.

◆ KKTError()

double robotoc::SplitKKTResidual::KKTError ( ) const
inline

Returns the squared norm of the KKT residual, that is, the primal and dual residual.

Returns
The squared norm of the KKT residual.

◆ lf() [1/2]

Eigen::VectorBlock< Eigen::VectorXd > robotoc::SplitKKTResidual::lf ( )
inline

KKT residual w.r.t. the stack of the contact forces f.

Returns
Reference to the residual w.r.t. f. Size is SplitKKTResidual::dimf().

◆ lf() [2/2]

const Eigen::VectorBlock< const Eigen::VectorXd > robotoc::SplitKKTResidual::lf ( ) const
inline

const version of SplitKKTResidual::lf().

◆ lq() [1/2]

Eigen::VectorBlock< Eigen::VectorXd > robotoc::SplitKKTResidual::lq ( )
inline

KKT residual w.r.t. the configuration q.

Returns
Reference to the KKT residual w.r.t. q. Size is Robot::dimv().

◆ lq() [2/2]

const Eigen::VectorBlock< const Eigen::VectorXd > robotoc::SplitKKTResidual::lq ( ) const
inline

const version of SplitKKTResidual::lq().

◆ lv() [1/2]

Eigen::VectorBlock< Eigen::VectorXd > robotoc::SplitKKTResidual::lv ( )
inline

KKT residual w.r.t. the joint velocity v.

Returns
Reference to the KKT residual w.r.t. v. Size is Robot::dimv().

◆ lv() [2/2]

const Eigen::VectorBlock< const Eigen::VectorXd > robotoc::SplitKKTResidual::lv ( ) const
inline

const version of SplitKKTResidual::lv().

◆ operator=() [1/2]

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

Default copy operator.

◆ operator=() [2/2]

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

Default move assign operator.

◆ P() [1/2]

Eigen::VectorBlock< Eigen::VectorXd > robotoc::SplitKKTResidual::P ( )
inline

Residual in the switching constraint.

Returns
Reference to the residual in the switching constraints. Size is SplitKKTResidual::dims().

◆ P() [2/2]

const Eigen::VectorBlock< const Eigen::VectorXd > robotoc::SplitKKTResidual::P ( ) const
inline

const version of SplitKKTResidual::P().

◆ primalFeasibility()

template<int p = 1>
double robotoc::SplitKKTResidual::primalFeasibility
inline

Returns the lp norm of the primal feasibility, i.e., the constraint violation. Default norm is l1-norm. You can also specify l-infty norm by passing Eigen::Infinity as the template parameter.

Template Parameters
pIndex of norm. Default is 1 (l1-norm).
Returns
The lp norm of the primal feasibility.

◆ Random() [1/3]

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

Generates split KKT residual filled randomly.

Returns
Split KKT residual filled randomly.
Parameters
[in]robotRobot model.

◆ Random() [2/3]

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

Generates split KKT residual filled randomly.

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

◆ Random() [3/3]

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

Generates split KKT residual filled randomly.

Returns
Split KKT residual filled randomly.
Parameters
[in]robotRobot model.
[in]impact_statusContact status.

◆ setContactDimension()

void robotoc::SplitKKTResidual::setContactDimension ( const int  dimf)
inline

Sets contact status, i.e., set dimension of the contact forces.

Parameters
[in]dimfThe dimension of the contact. Must be non-negative.

◆ setRandom() [1/3]

void robotoc::SplitKKTResidual::setRandom ( )

Set by random value based on the current contact status.

◆ setRandom() [2/3]

void robotoc::SplitKKTResidual::setRandom ( const ContactStatus contact_status)

Set by random value. Contact status is reset.

Parameters
[in]contact_statusContact status.

◆ setRandom() [3/3]

void robotoc::SplitKKTResidual::setRandom ( const ImpactStatus impact_status)

Set by random value. Contact status is reset.

Parameters
[in]impact_statusContact status.

◆ setSwitchingConstraintDimension()

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

Sets the dimension of the switching constraint.

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

◆ setZero()

void robotoc::SplitKKTResidual::setZero ( )
inline

Sets the split KKT residual zero.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const SplitKKTResidual kkt_residual 
)
friend

Member Data Documentation

◆ Fx

Eigen::VectorXd robotoc::SplitKKTResidual::Fx

Residual in the state equation. Size is 2 * Robot::dimv().

◆ h

double robotoc::SplitKKTResidual::h

KKT residual w.r.t. the switching time, that is, this is the value of the Hamiltonian.

◆ la

Eigen::VectorXd robotoc::SplitKKTResidual::la

KKT residual w.r.t. the acceleration a. Size is Robot::dimv().

◆ ldv

Eigen::VectorXd robotoc::SplitKKTResidual::ldv

KKT residual w.r.t. the impact change in the velocity ddv. Size is Robot::dimv().

◆ lu

Eigen::VectorXd robotoc::SplitKKTResidual::lu

KKT residual w.r.t. the control input torques u. Size is Robot::dimu().

◆ lx

Eigen::VectorXd robotoc::SplitKKTResidual::lx

KKT Residual w.r.t. the state x. Size is 2 * Robot::dimv().


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