robotoc
robotoc - efficient ROBOT Optimal Control solvers
Loading...
Searching...
No Matches
terminal_stage.hpp
Go to the documentation of this file.
1#ifndef ROBOTOC_TERMINAL_STAGE_HPP_
2#define ROBOTOC_TERMINAL_STAGE_HPP_
3
4#include <memory>
5
6#include "Eigen/Core"
7
18
19
20namespace robotoc {
21
27public:
34 TerminalStage(const std::shared_ptr<CostFunction>& cost,
35 const std::shared_ptr<Constraints>& constraints,
36 const std::shared_ptr<ContactSequence>& contact_sequence);
37
42
46 ~TerminalStage() = default;
47
51 TerminalStage(const TerminalStage&) = default;
52
57
61 TerminalStage(TerminalStage&&) noexcept = default;
62
66 TerminalStage& operator=(TerminalStage&&) noexcept = default;
67
72 OCPData createData(const Robot& robot) const;
73
81 bool isFeasible(Robot& robot, const GridInfo& grid_info,
82 const SplitSolution& s, OCPData& data) const;
83
91 void initConstraints(Robot& robot, const GridInfo& grid_info,
92 const SplitSolution& s, OCPData& data) const;
93
102 void evalOCP(Robot& robot, const GridInfo& grid_info, const SplitSolution& s,
103 OCPData& data, SplitKKTResidual& kkt_residual) const;
104
115 void evalKKT(Robot& robot, const GridInfo& grid_info,
116 const Eigen::VectorXd& q_prev, const SplitSolution& s,
117 OCPData& data, SplitKKTMatrix& kkt_matrix,
118 SplitKKTResidual& kkt_residual) const;
119
127 void expandPrimal(const GridInfo& grid_info, OCPData& data, SplitDirection& d) const;
128
136 void expandDual(const GridInfo& grid_info, OCPData& data, SplitDirection& d) const;
137
145 double maxPrimalStepSize(const OCPData& data) const;
146
154 double maxDualStepSize(const OCPData& data) const;
155
164 void updatePrimal(const Robot& robot, const double primal_step_size,
165 const SplitDirection& d, SplitSolution& s, OCPData& data) const;
166
172 void updateDual(const double dual_step_size, OCPData& data) const;
173
174private:
175 std::shared_ptr<CostFunction> cost_;
176 std::shared_ptr<Constraints> constraints_;
177 std::shared_ptr<ContactSequence> contact_sequence_;
178};
179
180} // namespace robotoc
181
182#endif // ROBOTOC_TERMINAL_STAGE_HPP_
Stack of the inequality constraints. Composed by constraint components that inherits ConstraintCompon...
Definition: constraints.hpp:30
The sequence of contact status and discrete events (impact and lift).
Definition: contact_sequence.hpp:23
Stack of the cost function. Composed by cost function components that inherits CostFunctionComponentB...
Definition: cost_function.hpp:30
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
Terminal stage computations for optimal control problems.
Definition: terminal_stage.hpp:26
void updateDual(const double dual_step_size, OCPData &data) const
Updates dual variables of this stage.
void updatePrimal(const Robot &robot, const double primal_step_size, const SplitDirection &d, SplitSolution &s, OCPData &data) const
Updates primal variables of this stage.
void expandDual(const GridInfo &grid_info, OCPData &data, SplitDirection &d) const
Expands the condensed dual variables, i.e., computes the Newton direction of the condensed dual varia...
double maxPrimalStepSize(const OCPData &data) const
Returns maximum stap size of the primal variables that satisfies the inequality constraints.
void evalOCP(Robot &robot, const GridInfo &grid_info, const SplitSolution &s, OCPData &data, SplitKKTResidual &kkt_residual) const
Computes the stage cost and constraint violation.
TerminalStage & operator=(const TerminalStage &)=default
Default copy assign operator.
void evalKKT(Robot &robot, const GridInfo &grid_info, const Eigen::VectorXd &q_prev, const SplitSolution &s, OCPData &data, SplitKKTMatrix &kkt_matrix, SplitKKTResidual &kkt_residual) const
Computes the KKT residual and matrix of this stage.
double maxDualStepSize(const OCPData &data) const
Returns maximum stap size of the dual variables that satisfies the inequality constraints.
~TerminalStage()=default
Default destructor.
TerminalStage()
Default constructor.
TerminalStage(TerminalStage &&) noexcept=default
Default move constructor.
bool isFeasible(Robot &robot, const GridInfo &grid_info, const SplitSolution &s, OCPData &data) const
Checks whether the solution is feasible under inequality constraints.
TerminalStage(const TerminalStage &)=default
Default copy constructor.
OCPData createData(const Robot &robot) const
Creates the data.
TerminalStage(const std::shared_ptr< CostFunction > &cost, const std::shared_ptr< Constraints > &constraints, const std::shared_ptr< ContactSequence > &contact_sequence)
Constructs the impact stage.
void expandPrimal(const GridInfo &grid_info, OCPData &data, SplitDirection &d) const
Expands the condensed primal variables, i.e., computes the Newton direction of the condensed primal v...
void initConstraints(Robot &robot, const GridInfo &grid_info, const SplitSolution &s, OCPData &data) const
Initializes the constraints, i.e., set slack and dual variables.
Definition: constraint_component_base.hpp:17
Grid information.
Definition: grid_info.hpp:24
A data structure for an optimal control problem.
Definition: ocp_data.hpp:18