Polynomial function for x/f and y/g is based on "world frame". When consider boundary constraint in reference line smoother, we should map polynomial function coordinates (x,y) into FLU frame to calculate difference of lateral distance and longitudinal distance between predict position and ground truth position.
"longi_coef" is the projection coefficient vector in L axis, while 'longitudinal_coef ' is the projection coefficient vector in F axis.
assume:
$$ x = f(t) = a_0 + a_1t + a_2t^2 + a_3t^3 + a_4t^4 + a_5t^5 $$
$$ y = g(t) = b_0 +b_1t + b_2t^2 + b_3t^3 + b_4t^4 + b_5t^5 $$
define:
$$ A = [a_0, a_1, a_2, a_3, a_4, a_5]^T $$
$$ B = [b_0, b_1, b_2, b_3, b_4, b_5]^T $$
$$ C = [ 1, t, t^2, t^3, t^4, t^5] $$
$$ (A,B) = (A^T, B^T)^T $$
such that:
x = f(t) = CA
y = g(t) = CB
According to anchor point's heading, we know:
unit direction in F axis: (cos(heading), sin(heading)), also equal to (-sin(heading-pi/2), cos(heading-pi/2))
unit direction in L axis: (cos(heading+pi/2), sin(heading+pi/2)), also equal to (-sin(heading), cos(heading))
Then map predict point from "world frame" to FLU frame, we can get lateral and longitudinal distance:
lateral distance: (-sin(heading), cos(heading)) 路 (CA, CB) = (-Csin(heading), Ccos(heading))(A, B)
longitudinal distance: (-sin(heading-pi/2), cos(heading-pi/2)) 路 (CA, CB) = (-Csin(heading-pi/2), Ccos(heading-pi/2))(A, B)
Note:
A 路 B means two vector inner product
AB means matrix multiplay(dot)
路above means inner product. Here (-Csin(heading), Ccos(heading)) is the "longi_coef", which is the projection coefficient vector in L axis. (-Csin(heading-pi/2), Ccos(heading-pi/2)) is the 'longitudinal_coef ' , the projection coefficient vector in F axis.
d_lateral and d_longitudinal is the lateral and longitudinal distance of ground truth point(anchor point), so we can boundary constraint:
constraint in L axis: |d_lateral - longi_coef(A,B)| <= lateral_bound
constraint in F axis: |d_longitudinal - longitudinal_coef(A,B) | <= longitudinal_bound
Remove absolute symbol:
upper lateral boundary: longi_coef(A,B) >= d_lateral - lateral_bound
lower lateral boundary: -longi_coef(A,B) >= -d_lateral - lateral_bound
upper longitudinal boundary: longitudinal_coef(A,B) >= d_longitudinal - longitudinal_bound
lower longitudinal boundary: -longitudinal_coef(A,B) >= -d_longitudinal - longitudinal_bound
By the way, will it be better to change the name "longi_coef" to "lateral_coef"?
For me, the confusing part is the name of the variable itself. Renaming longi_coef into lateral_coef might help the understanding.
Thanks to @YannZyl and @jilinzhou for your answers, which are very awesome! Thanks!
I am closing the issue.
Most helpful comment
Polynomial function for x/f and y/g is based on "world frame". When consider boundary constraint in reference line smoother, we should map polynomial function coordinates (x,y) into FLU frame to calculate difference of lateral distance and longitudinal distance between predict position and ground truth position.
"longi_coef" is the projection coefficient vector in L axis, while 'longitudinal_coef ' is the projection coefficient vector in F axis.
assume:
$$ x = f(t) = a_0 + a_1t + a_2t^2 + a_3t^3 + a_4t^4 + a_5t^5 $$
$$ y = g(t) = b_0 +b_1t + b_2t^2 + b_3t^3 + b_4t^4 + b_5t^5 $$
define:
$$ A = [a_0, a_1, a_2, a_3, a_4, a_5]^T $$
$$ B = [b_0, b_1, b_2, b_3, b_4, b_5]^T $$
$$ C = [ 1, t, t^2, t^3, t^4, t^5] $$
$$ (A,B) = (A^T, B^T)^T $$
such that:
x = f(t) = CA
y = g(t) = CB
According to anchor point's heading, we know:
unit direction in F axis: (cos(heading), sin(heading)), also equal to (-sin(heading-pi/2), cos(heading-pi/2))
unit direction in L axis: (cos(heading+pi/2), sin(heading+pi/2)), also equal to (-sin(heading), cos(heading))
Then map predict point from "world frame" to FLU frame, we can get lateral and longitudinal distance:
lateral distance: (-sin(heading), cos(heading)) 路 (CA, CB) = (-Csin(heading), Ccos(heading))(A, B)
longitudinal distance: (-sin(heading-pi/2), cos(heading-pi/2)) 路 (CA, CB) = (-Csin(heading-pi/2), Ccos(heading-pi/2))(A, B)
Note:
A 路 B means two vector inner product
AB means matrix multiplay(dot)
路above means inner product. Here (-Csin(heading), Ccos(heading)) is the "longi_coef", which is the projection coefficient vector in L axis. (-Csin(heading-pi/2), Ccos(heading-pi/2)) is the 'longitudinal_coef ' , the projection coefficient vector in F axis.d_lateral and d_longitudinal is the lateral and longitudinal distance of ground truth point(anchor point), so we can boundary constraint:
constraint in L axis: |d_lateral - longi_coef(A,B)| <= lateral_bound
constraint in F axis: |d_longitudinal - longitudinal_coef(A,B) | <= longitudinal_bound
Remove absolute symbol:
upper lateral boundary: longi_coef(A,B) >= d_lateral - lateral_bound
lower lateral boundary: -longi_coef(A,B) >= -d_lateral - lateral_bound
upper longitudinal boundary: longitudinal_coef(A,B) >= d_longitudinal - longitudinal_bound
lower longitudinal boundary: -longitudinal_coef(A,B) >= -d_longitudinal - longitudinal_bound
By the way, will it be better to change the name "longi_coef" to "lateral_coef"?