apollo icon indicating copy to clipboard operation
apollo copied to clipboard

raw lateral error

Open turinglife opened this issue 8 years ago • 7 comments

@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 avatar Feb 07 '18 09:02 turinglife

@turinglife I am not exactly sure about the question you ask, can you elaborate more on this?

Capri2014 avatar Feb 07 '18 18:02 Capri2014

@Capri2014

426847717

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 avatar Feb 08 '18 02:02 turinglife

@turinglife Thanks for sharing, I will update with you ASAP

Capri2014 avatar Feb 08 '18 17:02 Capri2014

It looks like you are correct @turinglife ...

lianglia-apollo avatar Feb 10 '18 09:02 lianglia-apollo

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 avatar Mar 31 '18 09:03 turinglife

@turinglife has this issue been resolved?

natashadsouza avatar Aug 24 '18 00:08 natashadsouza

@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. default

Which one is correct? I am confused also.

seniorstudent avatar Dec 17 '18 02:12 seniorstudent