27 #include "osqp/osqp.h" 52 const std::array<double, 3>& x_init);
56 void set_x_bounds(std::vector<std::pair<double, double>> x_bounds);
58 void set_x_bounds(
const double x_lower_bound,
const double x_upper_bound);
60 void set_dx_bounds(std::vector<std::pair<double, double>> dx_bounds);
62 void set_dx_bounds(
const double dx_lower_bound,
const double dx_upper_bound);
64 void set_ddx_bounds(std::vector<std::pair<double, double>> ddx_bounds);
67 const double ddx_upper_bound);
74 const double dddx_upper_bound) {
97 void set_x_ref(
const double weight_x_ref, std::vector<double> x_ref);
105 void set_x_ref(std::vector<double> weight_x_ref_vec,
106 std::vector<double> x_ref);
109 const std::array<double, 3>& end_state_ref);
111 virtual bool Optimize(
const int max_iter = 4000);
113 const std::vector<double>&
opt_x()
const {
return x_; }
115 const std::vector<double>&
opt_dx()
const {
return dx_; }
122 std::vector<c_int>* P_indices,
123 std::vector<c_int>* P_indptr) = 0;
128 std::vector<c_int>* A_indices,
129 std::vector<c_int>* A_indptr,
130 std::vector<c_float>* lower_bounds,
131 std::vector<c_float>* upper_bounds);
139 template <
typename T>
141 T* data =
new T[vec.size()];
142 memcpy(data, vec.data(),
sizeof(T) * vec.size());
150 std::vector<double>
x_;
std::array< double, 3 > weight_end_state_
Definition: piecewise_jerk_problem.h:176
virtual ~PiecewiseJerkProblem()=default
std::array< double, 3 > x_init_
Definition: piecewise_jerk_problem.h:154
virtual bool Optimize(const int max_iter=4000)
virtual void CalculateAffineConstraint(std::vector< c_float > *A_data, std::vector< c_int > *A_indices, std::vector< c_int > *A_indptr, std::vector< c_float > *lower_bounds, std::vector< c_float > *upper_bounds)
virtual void CalculateKernel(std::vector< c_float > *P_data, std::vector< c_int > *P_indices, std::vector< c_int > *P_indptr)=0
std::vector< double > x_ref_
Definition: piecewise_jerk_problem.h:171
size_t num_of_knots_
Definition: piecewise_jerk_problem.h:147
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
OSQPData * FormulateProblem()
virtual void CalculateOffset(std::vector< c_float > *q)=0
void set_weight_x(const double weight_x)
Definition: piecewise_jerk_problem.h:79
Planning module main class. It processes GPS and IMU as input, to generate planning info...
const std::vector< double > & opt_x() const
Definition: piecewise_jerk_problem.h:113
std::vector< std::pair< double, double > > x_bounds_
Definition: piecewise_jerk_problem.h:157
void set_dddx_bound(const double dddx_bound)
Definition: piecewise_jerk_problem.h:69
double delta_s_
Definition: piecewise_jerk_problem.h:167
std::vector< std::pair< double, double > > dx_bounds_
Definition: piecewise_jerk_problem.h:158
void set_x_bounds(std::vector< std::pair< double, double >> x_bounds)
double weight_ddx_
Definition: piecewise_jerk_problem.h:164
std::vector< std::pair< double, double > > ddx_bounds_
Definition: piecewise_jerk_problem.h:159
std::vector< double > weight_x_ref_vec_
Definition: piecewise_jerk_problem.h:173
const std::vector< double > & opt_dx() const
Definition: piecewise_jerk_problem.h:115
std::vector< double > ddx_
Definition: piecewise_jerk_problem.h:152
bool has_x_ref_
Definition: piecewise_jerk_problem.h:169
Definition: piecewise_jerk_problem.h:49
std::vector< double > dx_
Definition: piecewise_jerk_problem.h:151
double weight_x_ref_
Definition: piecewise_jerk_problem.h:170
bool has_end_state_ref_
Definition: piecewise_jerk_problem.h:175
double weight_dddx_
Definition: piecewise_jerk_problem.h:165
std::pair< double, double > dddx_bound_
Definition: piecewise_jerk_problem.h:160
void set_weight_dx(const double weight_dx)
Definition: piecewise_jerk_problem.h:81
double weight_dx_
Definition: piecewise_jerk_problem.h:163
void FreeData(OSQPData *data)
void set_dddx_bound(const double dddx_lower_bound, const double dddx_upper_bound)
Definition: piecewise_jerk_problem.h:73
PiecewiseJerkProblem(const size_t num_of_knots, const double delta_s, const std::array< double, 3 > &x_init)
void set_x_ref(const double weight_x_ref, std::vector< double > x_ref)
Set the x ref object and the uniform x_ref weighting.
void set_weight_dddx(const double weight_dddx)
Definition: piecewise_jerk_problem.h:85
T * CopyData(const std::vector< T > &vec)
Definition: piecewise_jerk_problem.h:140
std::array< double, 3 > scale_factor_
Definition: piecewise_jerk_problem.h:155
std::array< double, 3 > end_state_ref_
Definition: piecewise_jerk_problem.h:177
double weight_x_
Definition: piecewise_jerk_problem.h:162
void set_weight_ddx(const double weight_ddx)
Definition: piecewise_jerk_problem.h:83
void set_ddx_bounds(std::vector< std::pair< double, double >> ddx_bounds)
void set_dx_bounds(std::vector< std::pair< double, double >> dx_bounds)
void set_scale_factor(const std::array< double, 3 > &scale_factor)
Definition: piecewise_jerk_problem.h:87
std::vector< double > x_
Definition: piecewise_jerk_problem.h:150
virtual OSQPSettings * SolverDefaultSettings()
void set_end_state_ref(const std::array< double, 3 > &weight_end_state, const std::array< double, 3 > &end_state_ref)
const std::vector< double > & opt_ddx() const
Definition: piecewise_jerk_problem.h:117