robotoc
robotoc - efficient ROBOT Optimal Control solvers
Loading...
Searching...
No Matches
unconstr_ocp_solver.hpp
Go to the documentation of this file.
1#ifndef ROBOTOC_UNCONSTR_OCP_SOLVER_HPP_
2#define ROBOTOC_UNCONSTR_OCP_SOLVER_HPP_
3
4#include <vector>
5#include <memory>
6
7#include "Eigen/Core"
8
20#include "robotoc/ocp/ocp.hpp"
25
26
27namespace robotoc {
28
36public:
43 const SolverOptions& solver_options=SolverOptions());
44
49
53 ~UnconstrOCPSolver() = default;
54
59
64
68 UnconstrOCPSolver(UnconstrOCPSolver&&) noexcept = default;
69
73 UnconstrOCPSolver& operator=(UnconstrOCPSolver&&) noexcept = default;
74
79 void setSolverOptions(const SolverOptions& solver_options);
80
85 void discretize(const double t);
86
92
102 void solve(const double t, const Eigen::VectorXd& q, const Eigen::VectorXd& v,
103 const bool init_solver=true);
109
117 const SplitSolution& getSolution(const int stage) const;
118
124 std::vector<Eigen::VectorXd> getSolution(const std::string& name) const;
125
130 const std::vector<LQRPolicy>& getLQRPolicy() const;
131
137 void setSolution(const std::string& name, const Eigen::VectorXd& value);
138
147 double KKTError(const double t, const Eigen::VectorXd& q,
148 const Eigen::VectorXd& v);
149
155 double KKTError() const;
156
161 const std::vector<GridInfo>& getTimeDiscretization() const;
162
167 void setRobotProperties(const RobotProperties& properties);
168
169private:
170 aligned_vector<Robot> robots_;
171 std::vector<GridInfo> time_discretization_;
173 UnconstrRiccatiRecursion riccati_recursion_;
174 UnconstrLineSearch line_search_;
175 OCP ocp_;
176 KKTMatrix kkt_matrix_;
177 KKTResidual kkt_residual_;
178 Solution s_;
179 Direction d_;
180 UnconstrRiccatiFactorization riccati_factorization_;
181 SolverOptions solver_options_;
182 SolverStatistics solver_statistics_;
183 Timer timer_;
184
192 void updateSolution(const double t, const Eigen::VectorXd& q,
193 const Eigen::VectorXd& v);
194
195};
196
197} // namespace robotoc
198
199#endif // ROBOTOC_UNCONSTR_OCP_SOLVER_HPP_
The state feedback and feedforward policy of LQR subproblem at a time stage.
Definition: lqr_policy.hpp:16
Dynamics and kinematics model of robots. Wraps pinocchio::Model and pinocchio::Data....
Definition: robot.hpp:32
Solution to the optimal control problem split into a time stage.
Definition: split_solution.hpp:20
A timer class to take benchmarks.
Definition: timer.hpp:12
Direct multiple shooting method of optimal control problems of unconstrained rigid-body systems.
Definition: unconstr_direct_multiple_shooting.hpp:31
Line search for optimal control problems for unconstrained rigid-body systems.
Definition: unconstr_line_search.hpp:29
Optimal control problem solver of unconstrained rigid-body systems by Riccati recursion....
Definition: unconstr_ocp_solver.hpp:35
void initConstraints()
Initializes the priaml-dual interior point method for inequality constraints.
UnconstrOCPSolver()
Default constructor.
double KKTError() const
Returns the l2-norm of the KKT residuals using the results of UnconstrOCPsolver::updateSolution() or ...
const std::vector< LQRPolicy > & getLQRPolicy() const
Gets of the local LQR policies over the horizon.
const SplitSolution & getSolution(const int stage) const
Get the split solution of a time stage. For example, the control input torques at the initial stage c...
const std::vector< GridInfo > & getTimeDiscretization() const
Gets the discretization.
void discretize(const double t)
Discretizes the problem and reiszes the data structures.
~UnconstrOCPSolver()=default
Destructor.
void setRobotProperties(const RobotProperties &properties)
Sets a collection of the properties for robot model in this solver.
void solve(const double t, const Eigen::VectorXd &q, const Eigen::VectorXd &v, const bool init_solver=true)
Solves the optimal control problem. Internally calls updateSolution().
void setSolverOptions(const SolverOptions &solver_options)
Sets the solver option.
UnconstrOCPSolver(const OCP &ocp, const SolverOptions &solver_options=SolverOptions())
Construct optimal control problem solver.
void setSolution(const std::string &name, const Eigen::VectorXd &value)
Sets the solution over the horizon.
const SolverStatistics & getSolverStatistics() const
Gets the solver statistics.
UnconstrOCPSolver(const UnconstrOCPSolver &)=default
Default copy constructor.
UnconstrOCPSolver & operator=(const UnconstrOCPSolver &)=default
Default copy assign operator.
UnconstrOCPSolver(UnconstrOCPSolver &&) noexcept=default
Default move constructor.
Riccati recursion solver for optimal control problems of unconstrained rigid-body systems.
Definition: unconstr_riccati_recursion.hpp:32
Definition: constraint_component_base.hpp:17
std::vector< SplitRiccatiFactorization > UnconstrRiccatiFactorization
Riccati factorization matices of the LQR subproblem for the unconstrained optimal control problem.
Definition: unconstr_riccati_recursion.hpp:25
aligned_vector< SplitKKTMatrix > KKTMatrix
The KKT matrix of the optimal control problem.
Definition: kkt_matrix.hpp:16
aligned_vector< SplitSolution > Solution
Solution to the optimal control problem.
Definition: solution.hpp:16
aligned_vector< SplitDirection > Direction
Newton direction of the solution to the optimal control problem.
Definition: direction.hpp:16
std::vector< T, Eigen::aligned_allocator< T > > aligned_vector
std vector with Eigen::aligned_allocator.
Definition: aligned_vector.hpp:14
aligned_vector< SplitKKTResidual > KKTResidual
The KKT residual of the optimal control problem.
Definition: kkt_residual.hpp:16
Grid information.
Definition: grid_info.hpp:24
The optimal control problem.
Definition: ocp.hpp:22
Collection of the robot properties, which can change after constructing robot models.
Definition: robot_properties.hpp:30
Options of optimal control solvers.
Definition: solver_options.hpp:17
Statistics of optimal control solvers.
Definition: solver_statistics.hpp:17