ilqg_solver.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2019, University of Edinburgh
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 //
8 // * Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of nor the names of its contributors may be used to
14 // endorse or promote products derived from this software without specific
15 // prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 // POSSIBILITY OF SUCH DAMAGE.
28 //
29 
30 #ifndef EXOTICA_ILQG_SOLVER_ILQG_SOLVER_H_
31 #define EXOTICA_ILQG_SOLVER_ILQG_SOLVER_H_
32 
35 #include <exotica_core/server.h>
36 #include <Eigen/Eigenvalues>
37 
38 #include <exotica_ilqg_solver/ilqg_solver_initializer.h>
39 
40 namespace exotica
41 {
42 // This code is based on:
43 // E. Todorov, W. Li A generalized iterative LQG method for locally-optimal feedback
44 // control of constrained nonlinear stochastic systems
45 // http://maeresearch.ucsd.edu/skelton/publications/weiwei_ilqg_CDC43.pdf
46 class ILQGSolver : public FeedbackMotionSolver, public Instantiable<ILQGSolverInitializer>
47 {
48 public:
51  void Solve(Eigen::MatrixXd& solution) override;
52 
56  void SpecifyProblem(PlanningProblemPtr pointer) override;
57 
58  Eigen::VectorXd GetFeedbackControl(Eigen::VectorXdRefConst x, int t) const override;
59 
60 private:
63  std::vector<Eigen::MatrixXd> l_gains_, L_gains_;
64 
65  Eigen::MatrixXd best_ref_x_, best_ref_u_;
66 
69  void BackwardPass();
70 
76  double ForwardPass(const double alpha, Eigen::MatrixXdRefConst ref_x, Eigen::MatrixXdRefConst ref_u);
77 };
78 } // namespace exotica
79 
80 #endif // EXOTICA_ILQG_SOLVER_ILQG_SOLVER_H_
DynamicTimeIndexedShootingProblemPtr prob_
Definition: ilqg_solver.h:61
std::vector< Eigen::MatrixXd > L_gains_
Definition: ilqg_solver.h:63
Eigen::VectorXd GetFeedbackControl(Eigen::VectorXdRefConst x, int t) const override
DynamicsSolverPtr dynamics_solver_
!< Shared pointer to the planning problem.
Definition: ilqg_solver.h:62
Eigen::MatrixXd best_ref_u_
Definition: ilqg_solver.h:65
std::shared_ptr< exotica::DynamicsSolver > DynamicsSolverPtr
const Eigen::Ref< const Eigen::MatrixXd > & MatrixXdRefConst
void BackwardPass()
!< Reference trajectory for feedback control.
Definition: ilqg_solver.cpp:49
void Solve(Eigen::MatrixXd &solution) override
Solves the problem.
const Eigen::Ref< const Eigen::VectorXd > & VectorXdRefConst
void SpecifyProblem(PlanningProblemPtr pointer) override
Binds the solver to a specific problem which must be pre-initalised.
Definition: ilqg_solver.cpp:36
Eigen::MatrixXd best_ref_x_
!< Control gains.
Definition: ilqg_solver.h:65
std::shared_ptr< exotica::DynamicTimeIndexedShootingProblem > DynamicTimeIndexedShootingProblemPtr
std::shared_ptr< PlanningProblem > PlanningProblemPtr
std::vector< Eigen::MatrixXd > l_gains_
!< Shared pointer to the dynamics solver.
Definition: ilqg_solver.h:63
double x
double ForwardPass(const double alpha, Eigen::MatrixXdRefConst ref_x, Eigen::MatrixXdRefConst ref_u)
Forward simulates the dynamics using the gains computed in the last BackwardPass;.


exotica_ilqg_solver
Author(s): Traiko Dinev
autogenerated on Sat Apr 10 2021 02:36:28