26 #include "osqp/osqp.h" 38 const std::vector<std::pair<double, double>>& ref_points) {
39 ref_points_ = ref_points;
43 bounds_around_refs_ = bounds_around_refs;
47 weight_fem_pos_deviation_ = weight_fem_pos_deviation;
51 weight_path_length_ = weight_path_length;
55 weight_ref_deviation_ = weight_ref_deviation;
59 const double weight_curvature_constraint_slack_var) {
60 weight_curvature_constraint_slack_var_ =
61 weight_curvature_constraint_slack_var;
65 curvature_constraint_ = curvature_constraint;
75 scaled_termination_ = scaled_termination;
81 sqp_pen_max_iter_ = sqp_pen_max_iter;
87 sqp_sub_max_iter_ = sqp_sub_max_iter;
94 const std::vector<std::pair<double, double>>&
opt_xy()
const {
99 void CalculateKernel(std::vector<c_float>* P_data,
100 std::vector<c_int>* P_indices,
101 std::vector<c_int>* P_indptr);
103 void CalculateOffset(std::vector<c_float>* q);
105 std::vector<double> CalculateLinearizedFemPosParams(
106 const std::vector<std::pair<double, double>>& points,
const size_t index);
108 void CalculateAffineConstraint(
109 const std::vector<std::pair<double, double>>& points,
110 std::vector<c_float>* A_data, std::vector<c_int>* A_indices,
111 std::vector<c_int>* A_indptr, std::vector<c_float>* lower_bounds,
112 std::vector<c_float>* upper_bounds);
114 void SetPrimalWarmStart(
const std::vector<std::pair<double, double>>& points,
115 std::vector<c_float>* primal_warm_start);
117 bool OptimizeWithOsqp(
const std::vector<c_float>& primal_warm_start,
118 OSQPWorkspace** work);
120 double CalculateConstraintViolation(
121 const std::vector<std::pair<double, double>>& points);
125 std::vector<std::pair<double, double>> ref_points_;
126 std::vector<double> bounds_around_refs_;
127 double curvature_constraint_ = 0.2;
130 double weight_fem_pos_deviation_ = 1.0e5;
131 double weight_path_length_ = 1.0;
132 double weight_ref_deviation_ = 1.0;
133 double weight_curvature_constraint_slack_var_ = 1.0e5;
136 int max_iter_ = 4000;
137 double time_limit_ = 0.0;
138 bool verbose_ =
false;
139 bool scaled_termination_ =
true;
140 bool warm_start_ =
true;
143 int sqp_pen_max_iter_ = 100;
144 double sqp_ftol_ = 1e-2;
145 int sqp_sub_max_iter_ = 100;
146 double sqp_ctol_ = 1e-2;
149 int num_of_points_ = 0;
150 int num_of_pos_variables_ = 0;
151 int num_of_slack_variables_ = 0;
152 int num_of_variables_ = 0;
153 int num_of_variable_constraints_ = 0;
154 int num_of_curvature_constraints_ = 0;
155 int num_of_constraints_ = 0;
158 std::vector<std::pair<double, double>> opt_xy_;
159 std::vector<double> slack_;
160 double average_interval_length_ = 0.0;
void set_sqp_ctol(const double sqp_ctol)
Definition: fem_pos_deviation_sqp_osqp_interface.h:90
void set_curvature_constraint(const double curvature_constraint)
Definition: fem_pos_deviation_sqp_osqp_interface.h:64
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
void set_max_iter(const int max_iter)
Definition: fem_pos_deviation_sqp_osqp_interface.h:68
void set_time_limit(const double time_limit)
Definition: fem_pos_deviation_sqp_osqp_interface.h:70
void set_warm_start(const bool warm_start)
Definition: fem_pos_deviation_sqp_osqp_interface.h:78
Planning module main class. It processes GPS and IMU as input, to generate planning info...
FemPosDeviationSqpOsqpInterface()=default
void set_weight_path_length(const double weight_path_length)
Definition: fem_pos_deviation_sqp_osqp_interface.h:50
void set_sqp_sub_max_iter(const int sqp_sub_max_iter)
Definition: fem_pos_deviation_sqp_osqp_interface.h:86
void set_ref_points(const std::vector< std::pair< double, double >> &ref_points)
Definition: fem_pos_deviation_sqp_osqp_interface.h:37
void set_bounds_around_refs(const std::vector< double > &bounds_around_refs)
Definition: fem_pos_deviation_sqp_osqp_interface.h:42
const std::vector< std::pair< double, double > > & opt_xy() const
Definition: fem_pos_deviation_sqp_osqp_interface.h:94
void set_verbose(const bool verbose)
Definition: fem_pos_deviation_sqp_osqp_interface.h:72
Definition: fem_pos_deviation_sqp_osqp_interface.h:31
void set_weight_curvature_constraint_slack_var(const double weight_curvature_constraint_slack_var)
Definition: fem_pos_deviation_sqp_osqp_interface.h:58
void set_weight_ref_deviation(const double weight_ref_deviation)
Definition: fem_pos_deviation_sqp_osqp_interface.h:54
void set_weight_fem_pos_deviation(const double weight_fem_pos_deviation)
Definition: fem_pos_deviation_sqp_osqp_interface.h:46
void set_scaled_termination(const bool scaled_termination)
Definition: fem_pos_deviation_sqp_osqp_interface.h:74
void set_sqp_ftol(const double sqp_ftol)
Definition: fem_pos_deviation_sqp_osqp_interface.h:84
void set_sqp_pen_max_iter(const int sqp_pen_max_iter)
Definition: fem_pos_deviation_sqp_osqp_interface.h:80
virtual ~FemPosDeviationSqpOsqpInterface()=default