ApolloAuto / apollo

An open autonomous driving platform
Apache License 2.0
25.2k stars 9.71k forks source link

What does A/P OSQP tuning means? #13039

Open glebkiselev opened 3 years ago

glebkiselev commented 3 years ago

Good afternoon. In the basic version of the problem formulation of optimizing a polynomial using a quadratic formulation, the matrix P explains the integrated analytical description of the polynomial function (the 6x6 matrix, resulting from the product of the transposed and ordinary vectors of the first derivative coefficients of the polynomial with respect to s), and in the matrix A - the factors at the coefficients of the polynomial. Each line in A is a spline equation in S. In the Apollo code, I did not find the calculation of integrals and derivatives, but I saw the formulas for filling the matrices P and A using strange weight functions.

weight_x_ + weight_x_ref_vec_[i]) /(scale_factor_[0] * scale_factor_[0])
weight_x_ + weight_x_ref_vec_[n - 1] + weight_end_state_[0]) /(scale_factor_[0] * scale_factor_[0])
weight_dx_ / (scale_factor_[1] * scale_factor_[1])
(weight_dx_ + weight_end_state_[1]) /(scale_factor_[1] * scale_factor_[1])
(weight_ddx_ + weight_dddx_ / delta_s_square) /(scale_factor_[2] * scale_factor_[2])
(weight_ddx_ + 2.0 * weight_dddx_ / delta_s_square) /(scale_factor_[2] * scale_factor_[2])
(weight_ddx_ + weight_dddx_ / delta_s_square + weight_end_state_[2]) /(scale_factor_[2] * scale_factor_[2])
(-2.0 * weight_dddx_ / delta_s_square) /(scale_factor_[2] * scale_factor_[2])

Could you explain in more detail why this was done? Based on the code, I was able to understand that in general, A and P have the following structure: (description of 0 derivative | description of 1 derivative (graph growth rate) | description of 2 and 3 derivatives (acceleration of graph growth and jerk)) do I understand correctly what have you done?

zerolover commented 3 years ago

The code is from PiecewiseJerkProblem which optimizing a piecewise-jerk trajectory (not polynomial). A and P is defined in OSQP, see https://osqp.org/docs/solver/index.html How to caculate A and P, see paper Optimal Trajectory Generation for Autonomous Vehicles Under Centripetal Acceleration Constraints for In-lane Driving Scenarios