raw lateral error
@Capri2014
in LatController::ComputeLateralErrors@lat_controller.cc
const double cos_matched_theta = std::cos(target_point.path_point().theta()); const double sin_matched_theta = std::sin(target_point.path_point().theta());
const double raw_lateral_error = cos_matched_theta * dy - sin_matched_theta * dx;
I was wondering whether we need to replace cos_matched_theta and sin_matched_theta with cos_theta and sin_theta?
According to page 42, Chapter 2, Vehicle Dynamics and Control, Maybe we need to choose theta to help us compute lateral error?
Many thanks.
@turinglife I am not exactly sure about the question you ask, can you elaborate more on this?
@Capri2014

What I mean is that when we calculate the lateral error, we possibly should use vehicle's yaw angle(theta) instead of the desired/target trajectory point's angle(target_point.path_point().theta()).
@turinglife Thanks for sharing, I will update with you ASAP
It looks like you are correct @turinglife ...
case 1: when the car is on the top of lane centerline, dx < 0 (x_current - x_des) , dy > 0. (y_current - y_des) , we can use raw_lateral_error = cos_theta * dy - sin_theta * dx;
case 2: when the car is on the down of the lane centerline, dx < 0 (x_current - x_des), , dy < 0. (y_current - y_des), in this case, maybe we can not still use this formula of raw_lateral_error = cos_theta * dy - sin_theta * dx;
The dx is always minus one, since we have to make the sedan to follow the future trajectory points which are always in front of the sedan. However, the sign of the dy depends on which side(top or down of the lane centerline) the sedan is located.
@Capri2014
@turinglife has this issue been resolved?
@turinglife
First, we should figured out which angle is right-angle.
Lateral error means the distance in the normal vector for the vehicle and the referance line.

Which one is correct? I am confused also.