robotoc
robotoc - efficient ROBOT Optimal Control solvers
Loading...
Searching...
No Matches
parnmpc_intermediate_stage.hpp
Go to the documentation of this file.
1#ifndef ROBOTOC_SPLIT_UNCONSTR_PARNMPC_HPP_
2#define ROBOTOC_SPLIT_UNCONSTR_PARNMPC_HPP_
3
4#include <memory>
5
6#include "Eigen/Core"
7
20
21
22namespace robotoc {
23
29public:
37 const std::shared_ptr<CostFunction>& cost,
38 const std::shared_ptr<Constraints>& constraints);
39
44
49
54
59
64
68 ParNMPCIntermediateStage& operator=(ParNMPCIntermediateStage&&) noexcept = default;
69
74 UnconstrOCPData createData(const Robot& robot) const;
75
83 bool isFeasible(Robot& robot, const GridInfo& grid_info,
84 const SplitSolution& s, UnconstrOCPData& data) const;
85
93 void initConstraints(Robot& robot, const GridInfo& grid_info,
94 const SplitSolution& s, UnconstrOCPData& data) const;
95
106 void evalOCP(Robot& robot, const GridInfo& grid_info,
107 const Eigen::VectorXd& q_prev, const Eigen::VectorXd& v_prev,
108 const SplitSolution& s, UnconstrOCPData& data,
109 SplitKKTResidual& kkt_residual) const;
110
123 void evalKKT(Robot& robot, const GridInfo& grid_info,
124 const Eigen::VectorXd& q_prev, const Eigen::VectorXd& v_prev,
125 const SplitSolution& s, const SplitSolution& s_next,
126 UnconstrOCPData& data, SplitKKTMatrix& kkt_matrix,
127 SplitKKTResidual& kkt_residual) const;
128
138 void expandPrimalAndDual(const double dt, const SplitKKTMatrix& kkt_matrix,
139 const SplitKKTResidual& kkt_residual,
140 UnconstrOCPData& data, SplitDirection& d) const;
141
147 double maxPrimalStepSize(const UnconstrOCPData& data) const;
148
154 double maxDualStepSize(const UnconstrOCPData& data) const;
155
164 void updatePrimal(const Robot& robot, const double primal_step_size,
165 const SplitDirection& d, SplitSolution& s,
166 UnconstrOCPData& data) const;
167
173 void updateDual(const double dual_step_size, UnconstrOCPData& data) const;
174
175private:
176 std::shared_ptr<CostFunction> cost_;
177 std::shared_ptr<Constraints> constraints_;
178 ContactStatus contact_status_;
179};
180
181} // namespace robotoc
182
183#endif // ROBOTOC_SPLIT_UNCONSTR_PARNMPC_HPP_
Stack of the inequality constraints. Composed by constraint components that inherits ConstraintCompon...
Definition: constraints.hpp:30
Contact status of robot model.
Definition: contact_status.hpp:32
Stack of the cost function. Composed by cost function components that inherits CostFunctionComponentB...
Definition: cost_function.hpp:30
The intermediate stage of ParNMPC for unconstrained rigid-body systems.
Definition: parnmpc_intermediate_stage.hpp:28
double maxPrimalStepSize(const UnconstrOCPData &data) const
Computes the maximum primal step size.
void initConstraints(Robot &robot, const GridInfo &grid_info, const SplitSolution &s, UnconstrOCPData &data) const
Initializes the constraints, i.e., set slack and dual variables.
void updateDual(const double dual_step_size, UnconstrOCPData &data) const
Updates dual variables of the inequality constraints.
double maxDualStepSize(const UnconstrOCPData &data) const
Computes the maximum dual size.
void evalKKT(Robot &robot, const GridInfo &grid_info, const Eigen::VectorXd &q_prev, const Eigen::VectorXd &v_prev, const SplitSolution &s, const SplitSolution &s_next, UnconstrOCPData &data, SplitKKTMatrix &kkt_matrix, SplitKKTResidual &kkt_residual) const
Computes the KKT matrix and residual of this stage.
void updatePrimal(const Robot &robot, const double primal_step_size, const SplitDirection &d, SplitSolution &s, UnconstrOCPData &data) const
Updates primal variables of this stage.
void evalOCP(Robot &robot, const GridInfo &grid_info, const Eigen::VectorXd &q_prev, const Eigen::VectorXd &v_prev, const SplitSolution &s, UnconstrOCPData &data, SplitKKTResidual &kkt_residual) const
Computes the stage cost and constraint violation of this stage.
ParNMPCIntermediateStage()
Default constructor.
ParNMPCIntermediateStage(const ParNMPCIntermediateStage &)=default
Default copy constructor.
ParNMPCIntermediateStage(const Robot &robot, const std::shared_ptr< CostFunction > &cost, const std::shared_ptr< Constraints > &constraints)
Constructs the intermediate stage.
ParNMPCIntermediateStage & operator=(const ParNMPCIntermediateStage &)=default
Default copy assign operator.
UnconstrOCPData createData(const Robot &robot) const
Creates the data.
~ParNMPCIntermediateStage()=default
Default destructor.
bool isFeasible(Robot &robot, const GridInfo &grid_info, const SplitSolution &s, UnconstrOCPData &data) const
Checks whether the solution is feasible w.r.t. the inequality constraints.
void expandPrimalAndDual(const double dt, const SplitKKTMatrix &kkt_matrix, const SplitKKTResidual &kkt_residual, UnconstrOCPData &data, SplitDirection &d) const
Expands the primal and dual variables, i.e., computes the Newton direction of the condensed variables...
ParNMPCIntermediateStage(ParNMPCIntermediateStage &&) noexcept=default
Default move constructor.
Dynamics and kinematics model of robots. Wraps pinocchio::Model and pinocchio::Data....
Definition: robot.hpp:32
Newton direction of the solution to the optimal control problem split into a time stage.
Definition: split_direction.hpp:20
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
Grid information.
Definition: grid_info.hpp:24
Data structure for the optimal control problem of unconstrained rigid-body systems.
Definition: unconstr_ocp_data.hpp:17