Exotica
levenberg_marquardt_solver.h
Go to the documentation of this file.
1 //
2 // Copyright 2018, University of Edinburgh
3 //
4 // Permission is hereby granted, free of charge, to any person obtaining a copy
5 // of this software and associated documentation files (the "Software"), to
6 // deal in the Software without restriction, including without limitation the
7 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 // sell copies of the Software, and to permit persons to whom the Software is
9 // furnished to do so, subject to the following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included in
12 // all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 // SOFTWARE.
21 //
22 
23 #ifndef EXOTICA_LEVENBERG_MARQUARDT_SOLVER_LEVENBERG_MARQUARDT_SOLVER_H_
24 #define EXOTICA_LEVENBERG_MARQUARDT_SOLVER_LEVENBERG_MARQUARDT_SOLVER_H_
25 
28 
29 #include <exotica_levenberg_marquardt_solver/levenberg_marquardt_solver_initializer.h>
30 
31 namespace exotica
32 {
33 class LevenbergMarquardtSolver : public MotionSolver, public Instantiable<LevenbergMarquardtSolverInitializer>
34 {
35 public:
36  void Solve(Eigen::MatrixXd& solution) override;
37 
38  void SpecifyProblem(PlanningProblemPtr pointer) override;
39 
40 private:
42 
43  // Pre-allocation of variables used during optimisation
44  double lambda_ = 0;
45  Eigen::MatrixXd M_;
46  Eigen::MatrixXd JT_times_J_;
47  Eigen::VectorXd q_;
48  Eigen::VectorXd qd_;
49  Eigen::VectorXd yd_;
50  Eigen::MatrixXd cost_jacobian_;
51  double error_;
52  double error_prev_;
53  Eigen::LLT<Eigen::MatrixXd> llt_;
54 };
55 } // namespace exotica
56 
57 #endif // EXOTICA_LEVENBERG_MARQUARDT_SOLVER_LEVENBERG_MARQUARDT_SOLVER_H_
exotica::LevenbergMarquardtSolver
Definition: levenberg_marquardt_solver.h:33
exotica::LevenbergMarquardtSolver::lambda_
double lambda_
Damping factor.
Definition: levenberg_marquardt_solver.h:44
exotica::LevenbergMarquardtSolver::qd_
Eigen::VectorXd qd_
Change in joint configuration, used during optimisation.
Definition: levenberg_marquardt_solver.h:48
unconstrained_end_pose_problem.h
exotica::Instantiable
Definition: property.h:110
exotica
Definition: cartpole_dynamics_solver.h:38
exotica::LevenbergMarquardtSolver::yd_
Eigen::VectorXd yd_
Task space difference/error, used during optimisation.
Definition: levenberg_marquardt_solver.h:49
exotica::UnconstrainedEndPoseProblemPtr
std::shared_ptr< exotica::UnconstrainedEndPoseProblem > UnconstrainedEndPoseProblemPtr
Definition: unconstrained_end_pose_problem.h:81
exotica::LevenbergMarquardtSolver::llt_
Eigen::LLT< Eigen::MatrixXd > llt_
Cholesky decomposition for J^T*J.
Definition: levenberg_marquardt_solver.h:53
exotica::LevenbergMarquardtSolver::error_prev_
double error_prev_
Previous iteration error, used during optimisation.
Definition: levenberg_marquardt_solver.h:52
motion_solver.h
exotica::LevenbergMarquardtSolver::q_
Eigen::VectorXd q_
Joint configuration vector, used during optimisation.
Definition: levenberg_marquardt_solver.h:47
exotica::MotionSolver
Definition: motion_solver.h:42
exotica::PlanningProblemPtr
std::shared_ptr< PlanningProblem > PlanningProblemPtr
Definition: planning_problem.h:116
exotica::LevenbergMarquardtSolver::SpecifyProblem
void SpecifyProblem(PlanningProblemPtr pointer) override
exotica::LevenbergMarquardtSolver::prob_
UnconstrainedEndPoseProblemPtr prob_
Shared pointer to the planning problem.
Definition: levenberg_marquardt_solver.h:41
exotica::LevenbergMarquardtSolver::cost_jacobian_
Eigen::MatrixXd cost_jacobian_
Jacobian, used during optimisation.
Definition: levenberg_marquardt_solver.h:50
exotica::LevenbergMarquardtSolver::M_
Eigen::MatrixXd M_
Scaling matrix, used for regularisation.
Definition: levenberg_marquardt_solver.h:45
exotica::LevenbergMarquardtSolver::error_
double error_
Error, used during optimisation.
Definition: levenberg_marquardt_solver.h:51
exotica::LevenbergMarquardtSolver::JT_times_J_
Eigen::MatrixXd JT_times_J_
Gauss-Newton Hessian approximation (J^T * J)
Definition: levenberg_marquardt_solver.h:46
exotica::LevenbergMarquardtSolver::Solve
void Solve(Eigen::MatrixXd &solution) override