ApolloAuto / apollo

An open autonomous driving platform
Apache License 2.0
24.99k stars 9.66k forks source link

[Planning] what is the difference between PIECEWISE_JERK_SPEED_OPTIMIZER and PIECEWISE_JERK_NONLINEAR_SPEED_OPTIMIZER #12072

Closed qwetqwe closed 4 years ago

qwetqwe commented 4 years ago

As I see in lane_follow_config, there are two tasks PIECEWISE_JERK_SPEED_OPTIMIZER and PIECEWISE_JERK_NONLINEAR_SPEED_OPTIMIZER. It seems that they both use QP to smooth the st path,what is the difference between them?

zerolover commented 4 years ago

PIECEWISE_JERK_SPEED_OPTIMIZER is formulated as a QP problem. PIECEWISE_JERK_NONLINEAR_SPEED_OPTIMIZER is formulated as a NLP(non linear program) problem since it considered the smoothness of Centripetal Acceleration (it's a non linear objective function)meanwhile. You can refer to code or this paper for more details.

Zhang, Yajia, et al. "Optimal Trajectory Generation for Autonomous Vehicles Under Centripetal Acceleration Constraints for In-lane Driving Scenarios." 2019 IEEE Intelligent Transportation Systems Conference (ITSC). IEEE, 2019.

qwetqwe commented 4 years ago

@zerolover ,thanks. I have another question. Before using NLP optimize, it uses QP optimize to smooth the curvature first.But I think curvature is related with path geometry. It only changes curvature and path point does not change. So what is the reason? here is the code

zerolover commented 4 years ago

You can read the paper first. In short, the NLP required the kappa should be differentiable, so the code here is to compute a curve "kappa(s)" which has constant jerk (you can also use other algothrim to fit the curve).

qwetqwe commented 4 years ago

@zerolover ,But the path from PIECEWISE_JERK_PATH_OPTIMIZER has been smoothed, so the curvature should be differentiable.Here smoothing again is for redundancy?

zerolover commented 4 years ago

We want to get kappa(s), a close form and smooth curve, hence we can get the 1st and 2nd derivative of kappa. See piecewise_jerk_speed_nonlinear_ipopt_interface.cc

qwetqwe commented 4 years ago

@zerolover thanks, you really help me a lot. Another question,do you know why they use soft safety bounds? The paper did not mention that. they add two slack variables to state variable and give them variable bounds: lower_s_slack[i]>=0 upper_s_slack[i]>=0 the objection function is: f=lower_s_slack[i]w_softbounds+upper_s_slack[i]w_softbounds and add some constraints: s[i] - soft_lower_s[i] + lower_slack[i] >= 0.0 s[i] - soft_upper_s[i] - upper_slack[i] <= 0.0 I think it is equal to s[i] - soft_lower_s[i]>=0 s[i] - soft_upper_s[i] <=0 why not add s bounds directly like: s[i]>=soft_lower_s[i] s[i]<=soft_upper_s[i]

LiJiangnanBit commented 4 years ago

@qwetqwe s[i] - soft_lower_s[i] + lower_slack[i] >= 0.0 s[i] - soft_upper_s[i] - upper_slack[i] <= 0.0

These are two soft constraits on s[i], which means it is possible that s[i] < soft_lower_s[i] or s[i] > soft_upper_s[i], if the slack variable lower_slack[i] or upper_slack[i] is positive enough. However, this would be punished by the cost function.

It expects s[i] to be within the range between soft_lower_s[i] and soft_upper_s[i], but it's ok to go beyond that if necessary.

qwetqwe commented 4 years ago

@LiJiangnanBit , I understand it, soft constraints means a buffer. thanks a lot

lucianzhong commented 3 years ago

@zerolover Could you please send me pdf of the paper "Optimal Trajectory Generation for Autonomous Vehicles Under Centripetal Acceleration Constraints for In-lane Driving Scenarios", can not find one on internet. My email is 373605178@qq.com Thanks a lot

zerolover commented 3 years ago

@lucianzhong use sci-hub to search the paper :)

lucianzhong commented 3 years ago

@zerolover Got it. Thanks a lot

breezygogo commented 1 year ago

@zerolover ,But the path from PIECEWISE_JERK_PATH_OPTIMIZER has been smoothed, so the curvature should be differentiable.Here smoothing again is for redundancy? path is using piecewise to generate so dkappa is 0,so use piecewise to fit not smoothed just fit。