1#ifndef ROBOTOC_TASK_SPACE_3D_COST_HPP_
2#define ROBOTOC_TASK_SPACE_3D_COST_HPP_
49 const std::shared_ptr<TaskSpace3DRefBase>& ref);
58 const Eigen::Vector3d& const_ref);
67 const std::shared_ptr<TaskSpace3DRefBase>& ref);
76 const Eigen::Vector3d& const_ref);
146 if (use_nonconst_ref_) {
147 return ref_->isActive(grid_info);
163 if (use_nonconst_ref_) {
164 if (ref_->isActive(grid_info)) {
165 ref_->updateRef(grid_info, data.
x3d_ref);
216 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
220 Eigen::Vector3d const_ref_, weight_, weight_terminal_, weight_impact_;
221 std::shared_ptr<TaskSpace3DRefBase> ref_;
222 bool use_nonconst_ref_, enable_cost_, enable_cost_terminal_, enable_cost_impact_;
Base class of components of cost function.
Definition: cost_function_component_base.hpp:25
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
const Eigen::Vector3d & framePosition(const int frame_id) const
Returns the position of the frame. Before calling this function, updateKinematics() or updateFrameKin...
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
Cost on the task space position.
Definition: task_space_3d_cost.hpp:26
TaskSpace3DCost(const Robot &robot, const int frame_id)
Constructor.
TaskSpace3DCost(const Robot &robot, const std::string &frame_name, const std::shared_ptr< TaskSpace3DRefBase > &ref)
Constructor.
~TaskSpace3DCost()
Destructor.
TaskSpace3DCost & operator=(const TaskSpace3DCost &)=default
Default copy operator.
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 jus...
void set_const_ref(const Eigen::Vector3d &const_ref)
Sets the const reference task-space position.
TaskSpace3DCost(const Robot &robot, const std::string &frame_name, const Eigen::Vector3d &const_ref)
Constructor.
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 ...
TaskSpace3DCost(TaskSpace3DCost &&) noexcept=default
Default move constructor.
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 a...
TaskSpace3DCost(const TaskSpace3DCost &)=default
Default copy constructor.
void set_weight(const Eigen::Vector3d &weight)
Sets the weight vector.
TaskSpace3DCost(const Robot &robot, const std::string &frame_name)
Constructor.
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....
double evalTerminalCost(Robot &robot, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s) const override
Computes the terminal cost.
double evalStageCost(Robot &robot, const ContactStatus &contact_status, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s) const override
Computes the stage cost.
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....
TaskSpace3DCost(const Robot &robot, const int frame_id, const Eigen::Vector3d &const_ref)
Constructor.
void set_ref(const std::shared_ptr< TaskSpace3DRefBase > &ref)
Sets the reference task-space position.
bool isCostActive(const GridInfo &grid_info) const
Evaluate if the cost is active for given grid_info.
Definition: task_space_3d_cost.hpp:145
void set_weight_impact(const Eigen::Vector3d &weight_impact)
Sets the weight vector for the impact stage.
TaskSpace3DCost()
Default constructor.
void set_weight_terminal(const Eigen::Vector3d &weight_terminal)
Sets the weight vector for the terminal stage.
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....
double evalImpactCost(Robot &robot, const ImpactStatus &impact_status, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s) const override
Computes the impact cost.
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.
Definition: task_space_3d_cost.hpp:161
TaskSpace3DCost(const Robot &robot, const int frame_id, const std::shared_ptr< TaskSpace3DRefBase > &ref)
Constructor.
Base class of reference task space position.
Definition: task_space_3d_ref_base.hpp:15
Definition: constraint_component_base.hpp:17
Composed of data used to compute the cost function and its derivatives.
Definition: cost_function_data.hpp:17
Eigen::VectorXd x3d_ref
Vector used for set the reference position of the end-effector in TaskSpace3DCost....
Definition: cost_function_data.hpp:76
Eigen::VectorXd diff_3d
Vector used for computing the difference of the position of the end-effector in TaskSpace3DCost....
Definition: cost_function_data.hpp:84
Grid information.
Definition: grid_info.hpp:24