1#ifndef ROBOTOC_COST_FUNCTION_COMPONENT_BASE_HPP_
2#define ROBOTOC_COST_FUNCTION_COMPONENT_BASE_HPP_
212 template <typename Derived>
214 auto ptr = shared_from_this();
215 auto derived_ptr = std::dynamic_pointer_cast<Derived>(ptr);
216 if (derived_ptr ==
nullptr) {
217 throw std::runtime_error(
"[CostFunctionComponentBase] runtime error: failed in down-casting!");
Base class of components of cost function.
Definition: cost_function_component_base.hpp:25
virtual double evalStageCost(Robot &robot, const ContactStatus &contact_status, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s) const =0
Computes the stage cost.
CostFunctionComponentBase(const CostFunctionComponentBase &)=default
Default copy constructor.
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....
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 jus...
virtual double evalTerminalCost(Robot &robot, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s) const =0
Computes the terminal cost.
std::shared_ptr< Derived > as_shared_ptr()
Gets the shared ptr of this object as the specified type. If this fails in dynamic casting,...
Definition: cost_function_component_base.hpp:213
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....
virtual double evalImpactCost(Robot &robot, const ImpactStatus &impact_status, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s) const =0
Computes the impact cost.
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....
CostFunctionComponentBase & operator=(const CostFunctionComponentBase &)=default
Default copy operator.
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 a...
CostFunctionComponentBase(CostFunctionComponentBase &&) noexcept=default
Default move constructor.
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 ...
virtual ~CostFunctionComponentBase()
Destructor.
Definition: cost_function_component_base.hpp:35
CostFunctionComponentBase()
Default constructor.
Definition: cost_function_component_base.hpp:30
Impact status of robot model. Wrapper of ContactStatus to treat impacts.
Definition: impact_status.hpp:21
Dynamics and kinematics model of robots. Wraps pinocchio::Model and pinocchio::Data....
Definition: robot.hpp:32
The KKT matrix split into a time stage.
Definition: split_kkt_matrix.hpp:18
KKT residual split into each time stage.
Definition: split_kkt_residual.hpp:18
Solution to the optimal control problem split into a time stage.
Definition: split_solution.hpp:20
Definition: constraint_component_base.hpp:17
Composed of data used to compute the cost function and its derivatives.
Definition: cost_function_data.hpp:17
Grid information.
Definition: grid_info.hpp:24