1#ifndef ROBOTOC_CONFIGURATION_SPACE_COST_HPP_
2#define ROBOTOC_CONFIGURATION_SPACE_COST_HPP_
39 const std::shared_ptr<ConfigurationSpaceRefBase>& ref);
167 if (use_nonconst_ref_) {
168 return ref_->isActive(grid_info);
185 const Eigen::VectorXd& q)
const {
186 if (use_nonconst_ref_) {
187 if (ref_->isActive(grid_info)) {
188 ref_->updateRef(robot, grid_info, data.
q_ref);
207 const Eigen::VectorXd& q)
const {
208 if (use_nonconst_ref_) {
209 if (ref_->isActive(grid_info)) {
258 int dimq_, dimv_, dimu_;
259 Eigen::VectorXd q_ref_, v_ref_, u_ref_,
260 q_weight_, v_weight_, a_weight_, u_weight_,
261 q_weight_terminal_, v_weight_terminal_,
262 q_weight_impact_, v_weight_impact_, dv_weight_impact_;
263 std::shared_ptr<ConfigurationSpaceRefBase> ref_;
264 bool use_nonconst_ref_,
265 enable_q_cost_, enable_v_cost_, enable_a_cost_, enable_u_cost_,
266 enable_q_cost_terminal_, enable_v_cost_terminal_,
267 enable_q_cost_impact_, enable_v_cost_impact_, enable_dv_cost_impact_;
Configuration space cost.
Definition: configuration_space_cost.hpp:23
~ConfigurationSpaceCost()
Destructor.
bool isCostConfigActive(const GridInfo &grid_info) const
Evaluate if the cost on the configuration q is active for given grid_info.
Definition: configuration_space_cost.hpp:166
void evalConfigDiffJac(const Robot &robot, CostFunctionData &data, const GridInfo &grid_info, const Eigen::VectorXd &q) const
Evaluate the Jacobian of the difference between the configuration and the reference configuration.
Definition: configuration_space_cost.hpp:205
void set_v_ref(const Eigen::VectorXd &v_ref)
Sets the const reference velocity v.
void set_q_weight(const Eigen::VectorXd &q_weight)
Sets the weight vector on the configuration q.
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...
void set_u_weight(const Eigen::VectorXd &u_weight)
Sets the weight on the control input torques u.
ConfigurationSpaceCost(const Robot &robot, const std::shared_ptr< ConfigurationSpaceRefBase > &ref)
Constructor.
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...
double evalStageCost(Robot &robot, const ContactStatus &contact_status, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s) const override
Computes the stage cost.
void set_a_weight(const Eigen::VectorXd &a_weight)
Sets the weight on the acceleration a.
ConfigurationSpaceCost(const ConfigurationSpaceCost &)=default
Default copy constructor.
ConfigurationSpaceCost(ConfigurationSpaceCost &&) noexcept=default
Default move constructor.
void set_v_weight(const Eigen::VectorXd &v_weight)
Sets the weight on the velocity v.
ConfigurationSpaceCost & operator=(const ConfigurationSpaceCost &)=default
Default copy operator.
ConfigurationSpaceCost(const Robot &robot)
Constructor.
void set_q_weight_impact(const Eigen::VectorXd &q_weight_impact)
Sets the weight vector on the configuration q at impact stages.
void evalConfigDiff(const Robot &robot, CostFunctionData &data, const GridInfo &grid_info, const Eigen::VectorXd &q) const
Evaluate the difference between the configuration and the reference configuration.
Definition: configuration_space_cost.hpp:183
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....
void set_dv_weight_impact(const Eigen::VectorXd &dv_weight_impact)
Sets the weight vector on the impact change in the velocity dv at the impact stages.
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 set_v_weight_terminal(const Eigen::VectorXd &v_weight_terminal)
Sets the weight vector on the velocity v at the terminal stage.
void set_v_weight_impact(const Eigen::VectorXd &v_weight_impact)
Sets the weight vector on the velocity v at the impact stages.
void set_ref(const std::shared_ptr< ConfigurationSpaceRefBase > &ref)
Sets the reference configuration.
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....
void set_u_ref(const Eigen::VectorXd &u_ref)
Sets the const reference control input torques u.
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 ...
double evalImpactCost(Robot &robot, const ImpactStatus &impact_status, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s) const override
Computes the impact cost.
void set_q_weight_terminal(const Eigen::VectorXd &q_weight_terminal)
Sets the weight vector on the configuration q at the terminal stage.
double evalTerminalCost(Robot &robot, CostFunctionData &data, const GridInfo &grid_info, const SplitSolution &s) const override
Computes the terminal cost.
ConfigurationSpaceCost()
Default constructor.
void set_q_ref(const Eigen::VectorXd &q_ref)
Sets the const reference configuration q.
Eigen::Matrix< double, 6, 1 > Vector6d
Definition: configuration_space_cost.hpp:25
Base class of the configuration.
Definition: configuration_space_ref_base.hpp:16
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
void subtractConfiguration(const Eigen::MatrixBase< ConfigVectorType1 > &qf, const Eigen::MatrixBase< ConfigVectorType2 > &q0, const Eigen::MatrixBase< TangentVectorType > &qdiff) const
Computes qf - q0 at the tangent space. The result means that the unit velocity from initial configura...
Definition: robot.hxx:97
void dSubtractConfiguration_dqf(const Eigen::MatrixBase< ConfigVectorType1 > &qf, const Eigen::MatrixBase< ConfigVectorType2 > &q0, const Eigen::MatrixBase< MatrixType > &dqdiff_dqf) const
Computes the partial derivative of the function of subtraction qf - q0 w.r.t. the terminal configurat...
Definition: robot.hxx:112
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
Eigen::MatrixXd J_qdiff
Jacobian of the difference of the configurations used in JointSpaceCost. Be allocated only when Robot...
Definition: cost_function_data.hpp:119
Eigen::VectorXd q_ref
Vector used for computing the time-varying reference configuration in ConfigurationCost....
Definition: cost_function_data.hpp:68
Eigen::VectorXd qdiff
Vector used for computing the difference of the configurations in JointSpaceCost. Be allocated only w...
Definition: cost_function_data.hpp:61
Grid information.
Definition: grid_info.hpp:24