1#ifndef ROBOTOC_TASK_SPACE_6D_COST_HPP_
2#define ROBOTOC_TASK_SPACE_6D_COST_HPP_
50 const std::shared_ptr<TaskSpace6DRefBase>& ref);
59 const SE3& const_ref);
69 const Eigen::Vector3d& const_position_ref,
70 const Eigen::Matrix3d& const_rotation_ref);
79 const std::shared_ptr<TaskSpace6DRefBase>& ref);
88 const SE3& const_ref);
98 const Eigen::Vector3d& const_position_ref,
99 const Eigen::Matrix3d& const_rotation_ref);
149 const Eigen::Matrix3d& const_rotation_ref);
157 const Eigen::Vector3d& weight_rotation);
167 const Eigen::Vector3d& weight_rotation_terminal);
177 const Eigen::Vector3d& weight_rotation_impact);
185 if (use_nonconst_ref_) {
186 return ref_->isActive(grid_info);
202 if (use_nonconst_ref_) {
203 if (ref_->isActive(grid_info)) {
204 ref_->updateRef(grid_info, data.
x6d_ref);
258 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
262 SE3 const_ref_, const_ref_inv_;
263 Eigen::VectorXd weight_, weight_terminal_, weight_impact_;
264 std::shared_ptr<TaskSpace6DRefBase> ref_;
265 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 SE3 & framePlacement(const int frame_id) const
Returns the SE(3) of the frame. Before calling this function, updateKinematics() or updateFrameKinema...
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 placement (SE(3)).
Definition: task_space_6d_cost.hpp:26
TaskSpace6DCost(const Robot &robot, const int frame_id, const std::shared_ptr< TaskSpace6DRefBase > &ref)
Constructor.
TaskSpace6DCost(const Robot &robot, const std::string &frame_name)
Constructor.
TaskSpace6DCost(const TaskSpace6DCost &)=default
Default copy constructor.
Eigen::Matrix< double, 6, 1 > Vector6d
Definition: task_space_6d_cost.hpp:28
void set_ref(const std::shared_ptr< TaskSpace6DRefBase > &ref)
Sets the reference task-space placement.
TaskSpace6DCost(const Robot &robot, const int frame_id)
Constructor.
TaskSpace6DCost(const Robot &robot, const std::string &frame_name, const SE3 &const_ref)
Constructor.
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_6d_cost.hpp:200
void set_weight(const Eigen::Vector3d &weight_position, const Eigen::Vector3d &weight_rotation)
Sets the weight vector.
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....
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 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...
bool isCostActive(const GridInfo &grid_info) const
Evaluate if the cost is active for given grid_info.
Definition: task_space_6d_cost.hpp:184
TaskSpace6DCost(const Robot &robot, const int frame_id, const SE3 &const_ref)
Constructor.
double evalTerminalCost(Robot &robot, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s) const override
Computes the terminal cost.
void set_weight_terminal(const Eigen::Vector3d &weight_position_terminal, const Eigen::Vector3d &weight_rotation_terminal)
Sets the weight vector at the terminal stage.
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....
double evalStageCost(Robot &robot, const ContactStatus &contact_status, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s) const override
Computes the stage cost.
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....
TaskSpace6DCost(const Robot &robot, const std::string &frame_name, const Eigen::Vector3d &const_position_ref, const Eigen::Matrix3d &const_rotation_ref)
Constructor.
void set_weight_impact(const Eigen::Vector3d &weight_position_impact, const Eigen::Vector3d &weight_rotation_impact)
Sets the weight vector at the impact stage.
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 ...
void set_const_ref(const SE3 &const_ref)
Sets the const reference task-space placement.
double evalImpactCost(Robot &robot, const ImpactStatus &impact_status, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s) const override
Computes the impact cost.
TaskSpace6DCost()
Default constructor.
~TaskSpace6DCost()
Destructor.
TaskSpace6DCost(const Robot &robot, const std::string &frame_name, const std::shared_ptr< TaskSpace6DRefBase > &ref)
Constructor.
TaskSpace6DCost(TaskSpace6DCost &&) noexcept=default
Default move constructor.
TaskSpace6DCost(const Robot &robot, const int frame_id, const Eigen::Vector3d &const_position_ref, const Eigen::Matrix3d &const_rotation_ref)
Constructor.
TaskSpace6DCost & operator=(const TaskSpace6DCost &)=default
Default copy operator.
Base class of reference task space placement (position and orientation).
Definition: task_space_6d_ref_base.hpp:16
Definition: constraint_component_base.hpp:17
const Eigen::Matrix< double, 6, 1 > Log6Map(const SE3Type &SE3_obj)
Applies Log6 map that transforms the SE3 into 6-dimensional vector.
Definition: se3.hpp:23
pinocchio::SE3 SE3
Using pinocchio::SE3 without its namespace.
Definition: se3.hpp:15
Composed of data used to compute the cost function and its derivatives.
Definition: cost_function_data.hpp:17
Eigen::VectorXd diff_6d
Vector used for computing the difference of the position and rotation of the end-effector in TaskSpac...
Definition: cost_function_data.hpp:92
SE3 x6d_ref_inv
Vector used for computing the inverse of the reference SE3 of the end-effector in TaskSpace6DCost.
Definition: cost_function_data.hpp:104
SE3 diff_x6d
Vector used for computing the difference of the SE3 of the end-effector in TaskSpace6DCost....
Definition: cost_function_data.hpp:111
SE3 x6d_ref
Vector used for computing the reference SE3 of the end-effector in TaskSpace6DCost.
Definition: cost_function_data.hpp:98
Grid information.
Definition: grid_info.hpp:24