robotoc
robotoc - efficient ROBOT Optimal Control solvers
Loading...
Searching...
No Matches
robotoc::CoMCost Class Referencefinal

Cost on the position of the center of mass. More...

#include <com_cost.hpp>

Inheritance diagram for robotoc::CoMCost:
Collaboration diagram for robotoc::CoMCost:

Public Member Functions

 CoMCost (const Robot &robot)
 Constructor. More...
 
 CoMCost (const Robot &robot, const std::shared_ptr< CoMRefBase > &ref)
 Constructor. More...
 
 CoMCost (const Robot &robot, const Eigen::Vector3d &const_ref)
 Constructor. More...
 
 CoMCost ()
 Default constructor. More...
 
 ~CoMCost ()
 Destructor. More...
 
 CoMCost (const CoMCost &)=default
 Default copy constructor. More...
 
CoMCostoperator= (const CoMCost &)=default
 Default copy operator. More...
 
 CoMCost (CoMCost &&) noexcept=default
 Default move constructor. More...
 
CoMCostoperator= (CoMCost &&) noexcept=default
 Default move assign operator. More...
 
void set_ref (const std::shared_ptr< CoMRefBase > &ref)
 Sets the reference CoM position. More...
 
void set_const_ref (const Eigen::Vector3d &const_ref)
 Sets the const reference CoM position. More...
 
void set_weight (const Eigen::Vector3d &weight)
 Sets the weight vector. More...
 
void set_weight_terminal (const Eigen::Vector3d &weight_terminal)
 Sets the weight vector for the terminal stage. More...
 
void set_weight_impact (const Eigen::Vector3d &weight_impact)
 Sets the weight vector for the impact stage. More...
 
bool isCostActive (const GridInfo &grid_info) const
 Evaluate if the cost is active for given grid_info. More...
 
void evalDiff (const Robot &robot, CostFunctionData &data, const GridInfo &grid_info) const
 Evaluate the difference between the robot's task-space position status and reference. More...
 
double evalStageCost (Robot &robot, const ContactStatus &contact_status, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s) const override
 Computes the stage cost. More...
 
void evalStageCostDerivatives (Robot &robot, const ContactStatus &contact_status, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s, SplitKKTResidual &kkt_residual) const override
 Computes the first-order partial derivatives of the stage cost. This function is always called just after evalStageCost(). More...
 
void evalStageCostHessian (Robot &robot, const ContactStatus &contact_status, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s, SplitKKTMatrix &kkt_matrix) const override
 Computes the Hessian, i.e., the second-order partial derivatives of the stage cost. This function is always called just after evalStageCostDerivatives(). More...
 
double evalTerminalCost (Robot &robot, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s) const override
 Computes the terminal cost. More...
 
void evalTerminalCostDerivatives (Robot &robot, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s, SplitKKTResidual &kkt_residual) const override
 Computes the first-order partial derivatives of the terminal cost. This function is always called just after evalTerminalCost(). More...
 
void evalTerminalCostHessian (Robot &robot, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s, SplitKKTMatrix &kkt_matrix) const override
 Computes the Hessian, i.e., the second-order partial derivatives of the teminal cost. This function is always called just after evalTerminalCostDerivatives(). More...
 
double evalImpactCost (Robot &robot, const ImpactStatus &impact_status, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s) const override
 Computes the impact cost. More...
 
void evalImpactCostDerivatives (Robot &robot, const ImpactStatus &impact_status, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s, SplitKKTResidual &kkt_residual) const override
 Computes the first-order partial derivatives of the impact cost. This function is always called just after evalImpactCost(). More...
 
void evalImpactCostHessian (Robot &robot, const ImpactStatus &impact_status, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s, SplitKKTMatrix &kkt_matrix) const override
 Computes the Hessian, i.e., the second-order partial derivatives of the impact cost. This function is always called just after evalImpactCostDerivatives(). More...
 
- Public Member Functions inherited from robotoc::CostFunctionComponentBase
 CostFunctionComponentBase ()
 Default constructor. More...
 
virtual ~CostFunctionComponentBase ()
 Destructor. More...
 
 CostFunctionComponentBase (const CostFunctionComponentBase &)=default
 Default copy constructor. More...
 
CostFunctionComponentBaseoperator= (const CostFunctionComponentBase &)=default
 Default copy operator. More...
 
 CostFunctionComponentBase (CostFunctionComponentBase &&) noexcept=default
 Default move constructor. More...
 
CostFunctionComponentBaseoperator= (CostFunctionComponentBase &&) noexcept=default
 Default move assign operator. More...
 
virtual double evalStageCost (Robot &robot, const ContactStatus &contact_status, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s) const =0
 Computes the stage cost. More...
 
virtual void evalStageCostDerivatives (Robot &robot, const ContactStatus &contact_status, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s, SplitKKTResidual &kkt_residual) const =0
 Computes the first-order partial derivatives of the stage cost. This function is always called just after evalStageCost(). More...
 
virtual void evalStageCostHessian (Robot &robot, const ContactStatus &contact_status, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s, SplitKKTMatrix &kkt_matrix) const =0
 Computes the Hessian, i.e., the second-order partial derivatives of the stage cost. This function is always called just after evalStageCostDerivatives(). More...
 
virtual double evalTerminalCost (Robot &robot, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s) const =0
 Computes the terminal cost. More...
 
virtual void evalTerminalCostDerivatives (Robot &robot, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s, SplitKKTResidual &kkt_residual) const =0
 Computes the first-order partial derivatives of the terminal cost. This function is always called just after evalTerminalCost(). More...
 
virtual void evalTerminalCostHessian (Robot &robot, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s, SplitKKTMatrix &kkt_matrix) const =0
 Computes the Hessian, i.e., the second-order partial derivatives of the teminal cost. This function is always called just after evalTerminalCostDerivatives(). More...
 
virtual double evalImpactCost (Robot &robot, const ImpactStatus &impact_status, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s) const =0
 Computes the impact cost. More...
 
virtual void evalImpactCostDerivatives (Robot &robot, const ImpactStatus &impact_status, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s, SplitKKTResidual &kkt_residual) const =0
 Computes the first-order partial derivatives of the impact cost. This function is always called just after evalImpactCost(). More...
 
virtual void evalImpactCostHessian (Robot &robot, const ImpactStatus &impact_status, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s, SplitKKTMatrix &kkt_matrix) const =0
 Computes the Hessian, i.e., the second-order partial derivatives of the impact cost. This function is always called just after evalImpactCostDerivatives(). More...
 
template<typename Derived >
std::shared_ptr< Derived > as_shared_ptr ()
 Gets the shared ptr of this object as the specified type. If this fails in dynamic casting, throws an exception. More...
 

Detailed Description

Cost on the position of the center of mass.

Constructor & Destructor Documentation

◆ CoMCost() [1/6]

robotoc::CoMCost::CoMCost ( const Robot robot)

Constructor.

Parameters
[in]robotRobot model.

◆ CoMCost() [2/6]

robotoc::CoMCost::CoMCost ( const Robot robot,
const std::shared_ptr< CoMRefBase > &  ref 
)

Constructor.

Parameters
[in]robotRobot model.
[in]refReference CoM position.

◆ CoMCost() [3/6]

robotoc::CoMCost::CoMCost ( const Robot robot,
const Eigen::Vector3d &  const_ref 
)

Constructor.

Parameters
[in]robotRobot model.
[in]const_refConst reference CoM position.

◆ CoMCost() [4/6]

robotoc::CoMCost::CoMCost ( )

Default constructor.

◆ ~CoMCost()

robotoc::CoMCost::~CoMCost ( )

Destructor.

◆ CoMCost() [5/6]

robotoc::CoMCost::CoMCost ( const CoMCost )
default

Default copy constructor.

◆ CoMCost() [6/6]

robotoc::CoMCost::CoMCost ( CoMCost &&  )
defaultnoexcept

Default move constructor.

Member Function Documentation

◆ evalDiff()

void robotoc::CoMCost::evalDiff ( const Robot robot,
CostFunctionData data,
const GridInfo grid_info 
) const
inline

Evaluate the difference between the robot's task-space position status and reference.

Parameters
[in]robotRobot model.
[in,out]dataCost funciton data.
[in]grid_infoGrid info

◆ evalImpactCost()

double robotoc::CoMCost::evalImpactCost ( Robot robot,
const ImpactStatus impact_status,
CostFunctionData data,
const GridInfo grid_info,
const SplitSolution s 
) const
overridevirtual

Computes the impact cost.

Parameters
[in]robotRobot model.
[in]impact_statusImpact status.
[in]dataCost function data.
[in]grid_infoGrid info.
[in]sSplit solution.
Returns
Impact cost.

Implements robotoc::CostFunctionComponentBase.

◆ evalImpactCostDerivatives()

void robotoc::CoMCost::evalImpactCostDerivatives ( Robot robot,
const ImpactStatus impact_status,
CostFunctionData data,
const GridInfo grid_info,
const SplitSolution s,
SplitKKTResidual kkt_residual 
) const
overridevirtual

Computes the first-order partial derivatives of the impact cost. This function is always called just after evalImpactCost().

Parameters
[in]robotRobot model.
[in]impact_statusImpact status.
[in]dataCost function data.
[in]grid_infoGrid info.
[in]sSplit solution.
[in,out]kkt_residualSplit KKT residual. The partial derivatives are added to this object.

Implements robotoc::CostFunctionComponentBase.

◆ evalImpactCostHessian()

void robotoc::CoMCost::evalImpactCostHessian ( Robot robot,
const ImpactStatus impact_status,
CostFunctionData data,
const GridInfo grid_info,
const SplitSolution s,
SplitKKTMatrix kkt_matrix 
) const
overridevirtual

Computes the Hessian, i.e., the second-order partial derivatives of the impact cost. This function is always called just after evalImpactCostDerivatives().

Parameters
[in]robotRobot model.
[in]impact_statusImpact status.
[in]dataCost function data.
[in]grid_infoGrid info.
[in]sSplit solution.
[in,out]kkt_matrixImpact split KKT matrix. The Hessians are
added to this object.

Implements robotoc::CostFunctionComponentBase.

◆ evalStageCost()

double robotoc::CoMCost::evalStageCost ( Robot robot,
const ContactStatus contact_status,
CostFunctionData data,
const GridInfo grid_info,
const SplitSolution s 
) const
overridevirtual

Computes the stage cost.

Parameters
[in]robotRobot model.
[in]contact_statusContact status.
[in]dataCost function data.
[in]grid_infoGrid info.
[in]sSplit solution.
Returns
Stage cost.

Implements robotoc::CostFunctionComponentBase.

◆ evalStageCostDerivatives()

void robotoc::CoMCost::evalStageCostDerivatives ( Robot robot,
const ContactStatus contact_status,
CostFunctionData data,
const GridInfo grid_info,
const SplitSolution s,
SplitKKTResidual kkt_residual 
) const
overridevirtual

Computes the first-order partial derivatives of the stage cost. This function is always called just after evalStageCost().

Parameters
[in]robotRobot model.
[in]contact_statusContact status.
[in]dataCost function data.
[in]grid_infoGrid info.
[in]sSplit solution.
[in,out]kkt_residualSplit KKT residual. The partial derivatives are added to this object.

Implements robotoc::CostFunctionComponentBase.

◆ evalStageCostHessian()

void robotoc::CoMCost::evalStageCostHessian ( Robot robot,
const ContactStatus contact_status,
CostFunctionData data,
const GridInfo grid_info,
const SplitSolution s,
SplitKKTMatrix kkt_matrix 
) const
overridevirtual

Computes the Hessian, i.e., the second-order partial derivatives of the stage cost. This function is always called just after evalStageCostDerivatives().

Parameters
[in]robotRobot model.
[in]contact_statusContact status.
[in]dataCost function data.
[in]grid_infoGrid info.
[in]sSplit solution.
[in,out]kkt_matrixSplit KKT matrix. The Hessians are added to this object.

Implements robotoc::CostFunctionComponentBase.

◆ evalTerminalCost()

double robotoc::CoMCost::evalTerminalCost ( Robot robot,
CostFunctionData data,
const GridInfo grid_info,
const SplitSolution s 
) const
overridevirtual

Computes the terminal cost.

Parameters
[in]robotRobot model.
[in]dataCost function data.
[in]grid_infoGrid info.
[in]sSplit solution.
Returns
Terminal cost.

Implements robotoc::CostFunctionComponentBase.

◆ evalTerminalCostDerivatives()

void robotoc::CoMCost::evalTerminalCostDerivatives ( Robot robot,
CostFunctionData data,
const GridInfo grid_info,
const SplitSolution s,
SplitKKTResidual kkt_residual 
) const
overridevirtual

Computes the first-order partial derivatives of the terminal cost. This function is always called just after evalTerminalCost().

Parameters
[in]robotRobot model.
[in]dataCost function data.
[in]grid_infoGrid info.
[in]sSplit solution.
[in,out]kkt_residualSplit KKT residual. The partial derivatives are added to this object.

Implements robotoc::CostFunctionComponentBase.

◆ evalTerminalCostHessian()

void robotoc::CoMCost::evalTerminalCostHessian ( Robot robot,
CostFunctionData data,
const GridInfo grid_info,
const SplitSolution s,
SplitKKTMatrix kkt_matrix 
) const
overridevirtual

Computes the Hessian, i.e., the second-order partial derivatives of the teminal cost. This function is always called just after evalTerminalCostDerivatives().

Parameters
[in]robotRobot model.
[in]dataCost function data.
[in]grid_infoGrid info.
[in]sSplit solution.
[in,out]kkt_matrixSplit KKT matrix. The Hessians are added to this object.

Implements robotoc::CostFunctionComponentBase.

◆ isCostActive()

bool robotoc::CoMCost::isCostActive ( const GridInfo grid_info) const
inline

Evaluate if the cost is active for given grid_info.

Parameters
[in]grid_infoGrid info.
Returns
Cost status (if the cost is active or not).

◆ operator=() [1/2]

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

Default move assign operator.

◆ operator=() [2/2]

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

Default copy operator.

◆ set_const_ref()

void robotoc::CoMCost::set_const_ref ( const Eigen::Vector3d &  const_ref)

Sets the const reference CoM position.

Parameters
[in]const_refConst reference CoM position.

◆ set_ref()

void robotoc::CoMCost::set_ref ( const std::shared_ptr< CoMRefBase > &  ref)

Sets the reference CoM position.

Parameters
[in]refReference CoM position.

◆ set_weight()

void robotoc::CoMCost::set_weight ( const Eigen::Vector3d &  weight)

Sets the weight vector.

Parameters
[in]weightWeight vector on the CoM position error.

◆ set_weight_impact()

void robotoc::CoMCost::set_weight_impact ( const Eigen::Vector3d &  weight_impact)

Sets the weight vector for the impact stage.

Parameters
[in]weight_impactWeight vector on the CoM position error at the impact stage.

◆ set_weight_terminal()

void robotoc::CoMCost::set_weight_terminal ( const Eigen::Vector3d &  weight_terminal)

Sets the weight vector for the terminal stage.

Parameters
[in]weight_terminalWeight vector on the CoM position error at the terminal stage.

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