wbc
HierarchicalLSSolver.hpp
Go to the documentation of this file.
1#ifndef WBC_SOLVERS_HIERARCHICAL_LS_SOLVER_HPP
2#define WBC_SOLVERS_HIERARCHICAL_LS_SOLVER_HPP
3
4#include <base/Eigen.hpp>
5#include <vector>
7
8namespace wbc{
9
10class HierarchicalQP;
11
33private:
35
36public:
37
43 public:
45 PriorityData(const unsigned int _n_constraint_variables, const unsigned int n_joints){
46 n_constraint_variables = _n_constraint_variables;
47 solution_prio.setZero(n_joints);
48 A_proj.setZero(_n_constraint_variables, n_joints);
49 A_proj_w.setZero(_n_constraint_variables,n_joints);
50 U.setZero(_n_constraint_variables, n_joints);
51 A_proj_inv_wls.setZero(_n_constraint_variables, n_joints);
52 A_proj_inv_wdls.setZero(_n_constraint_variables, n_joints);
53 y_comp.setZero(_n_constraint_variables);
54 constraint_weight_mat.resize(_n_constraint_variables, _n_constraint_variables);
55 constraint_weight_mat.setIdentity();
56 joint_weight_mat.resize(n_joints, n_joints);
57 joint_weight_mat.setIdentity();
58 u_t_weight_mat.setZero(n_joints, _n_constraint_variables);
59 sing_vals.resize(n_joints);
60 }
61 base::VectorXd solution_prio;
62 base::MatrixXd A_proj;
63 base::MatrixXd A_proj_w;
64 base::MatrixXd U;
65 base::MatrixXd A_proj_inv_wls;
66 base::MatrixXd A_proj_inv_wdls;
67 base::VectorXd y_comp;
68 base::MatrixXd constraint_weight_mat;
69 base::MatrixXd joint_weight_mat;
70 base::MatrixXd u_t_weight_mat;
71 base::VectorXd sing_vals;
72 double damping;
74 };
75
77 virtual ~HierarchicalLSSolver();
78
85 bool configure(const std::vector<int>& n_constraints_per_prio, const unsigned int n_joints);
86
92 virtual void solve(const wbc::HierarchicalQP &hierarchical_qp, base::VectorXd &solver_output);
93
99 void setJointWeights(const base::VectorXd& weights);
100
107 void setJointWeights(const base::VectorXd& weights, const uint prio);
108
114 void setTaskWeights(const base::VectorXd& weights, const uint prio);
115
122 void setMinEigenvalue(double min_eigenvalue);
123
126
132 void setMaxSolverOutputNorm(double norm_max);
133
136
140 bool isConfigured(){return configured;}
141
142protected:
143 std::vector<PriorityData> priorities;
144 base::MatrixXd proj_mat;
145 base::VectorXd s_vals;
146 base::MatrixXd s_vals_inv;
147 base::MatrixXd sing_vect_r;
148 base::MatrixXd damped_s_vals_inv;
149 base::MatrixXd Wq_V;
150 base::MatrixXd Wq_V_s_vals_inv;
151 base::MatrixXd Wq_V_damped_s_vals_inv;
153 unsigned int no_of_joints;
155 //Properties
159 //Helpers
160 base::VectorXd tmp;
161};
162}
163#endif
164
The PriorityDataIntern class Manages all priority dependent information, i.e. all matrices that have ...
Definition HierarchicalLSSolver.hpp:42
base::MatrixXd A_proj
Definition HierarchicalLSSolver.hpp:62
unsigned int n_constraint_variables
Definition HierarchicalLSSolver.hpp:73
double damping
Definition HierarchicalLSSolver.hpp:72
base::MatrixXd A_proj_inv_wdls
Definition HierarchicalLSSolver.hpp:66
base::MatrixXd joint_weight_mat
Definition HierarchicalLSSolver.hpp:69
PriorityData()
Definition HierarchicalLSSolver.hpp:44
base::VectorXd solution_prio
Definition HierarchicalLSSolver.hpp:61
base::MatrixXd A_proj_w
Definition HierarchicalLSSolver.hpp:63
base::MatrixXd constraint_weight_mat
Definition HierarchicalLSSolver.hpp:68
PriorityData(const unsigned int _n_constraint_variables, const unsigned int n_joints)
Definition HierarchicalLSSolver.hpp:45
base::VectorXd y_comp
Definition HierarchicalLSSolver.hpp:67
base::MatrixXd u_t_weight_mat
Definition HierarchicalLSSolver.hpp:70
base::VectorXd sing_vals
Definition HierarchicalLSSolver.hpp:71
base::MatrixXd U
Definition HierarchicalLSSolver.hpp:64
base::MatrixXd A_proj_inv_wls
Definition HierarchicalLSSolver.hpp:65
Implementation of the hierarchical weighted damped least squares solver (HWLS), similar to Schutter,...
Definition HierarchicalLSSolver.hpp:32
double min_eigenvalue
Definition HierarchicalLSSolver.hpp:156
double max_solver_output_norm
Definition HierarchicalLSSolver.hpp:157
base::MatrixXd Wq_V
Definition HierarchicalLSSolver.hpp:149
base::VectorXd tmp
Definition HierarchicalLSSolver.hpp:160
bool isConfigured()
Has configure() been called already?
Definition HierarchicalLSSolver.hpp:140
double getMinEigenvalue()
Definition HierarchicalLSSolver.hpp:125
virtual void solve(const wbc::HierarchicalQP &hierarchical_qp, base::VectorXd &solver_output)
solve Solve the given quadratic program
Definition HierarchicalLSSolver.cpp:56
virtual ~HierarchicalLSSolver()
Definition HierarchicalLSSolver.cpp:18
void setJointWeights(const base::VectorXd &weights)
setJointWeights Sets the joint weight vector for all priorities
Definition HierarchicalLSSolver.cpp:179
void setTaskWeights(const base::VectorXd &weights, const uint prio)
setTaskWeights Sets the weights for the constraints of the given priority.
Definition HierarchicalLSSolver.cpp:208
double getMaxSolverOutputNorm()
Definition HierarchicalLSSolver.hpp:135
base::MatrixXd sing_vect_r
Definition HierarchicalLSSolver.hpp:147
base::MatrixXd damped_s_vals_inv
Definition HierarchicalLSSolver.hpp:148
base::VectorXd s_vals
Definition HierarchicalLSSolver.hpp:145
unsigned int no_of_joints
Definition HierarchicalLSSolver.hpp:153
base::MatrixXd Wq_V_s_vals_inv
Definition HierarchicalLSSolver.hpp:150
std::vector< PriorityData > priorities
Definition HierarchicalLSSolver.hpp:143
base::MatrixXd s_vals_inv
Definition HierarchicalLSSolver.hpp:146
bool configure(const std::vector< int > &n_constraints_per_prio, const unsigned int n_joints)
configure Resizes member variables
Definition HierarchicalLSSolver.cpp:21
base::MatrixXd Wq_V_damped_s_vals_inv
Definition HierarchicalLSSolver.hpp:151
base::MatrixXd proj_mat
Definition HierarchicalLSSolver.hpp:144
void setMinEigenvalue(double min_eigenvalue)
setMinEigenvalue Sets the minimum Eigenvalue that is allowed to occur in normal (undamped) matrix inv...
Definition HierarchicalLSSolver.cpp:229
void setMaxSolverOutputNorm(double norm_max)
setMaxSolverOutputNorm Sets the maximum norm term. The solution of the solver will have a norm that i...
Definition HierarchicalLSSolver.cpp:236
HierarchicalLSSolver()
Definition HierarchicalLSSolver.cpp:12
Definition QPSolver.hpp:14
bool configured
Definition QPSolver.hpp:16
Definition ContactsAccelerationConstraint.cpp:3
Describes a hierarchy of quadratic programs.
Definition QuadraticProgram.hpp:57
Definition QPSolver.hpp:67