calculation of station_error in trajectory_analyzer
System information
- OS Platform and Distribution (e.g., Linux Ubuntu 14.04):
- Apollo installed from (source or binary):
- Apollo version (master):
Description of the issue:
I think the calculation method in apollo::control::TrajectoryAnalyser::ToTrajectoryFrame (line #124) is not reasonable, it's like: dot_rd_nd = dx * cos_ref_theta + dy * sin_ref_theta; Why not: dot_rd_nd = dx * sin_ref_theta + dy * cos_ref_theta
Supporting materials (screenshots, command lines, code/script snippets):
apollo/modules/control/common/trajectory_analyzer.cc (line #124)
Hello there! Please refer this (https://github.com/ApolloAuto/apollo/blob/master/docs/specs/coordination.pdf) for the coordination systems in Apollo. "ref_theta" here is the heading angle that the ego vehicle tracks. And this angle is defined with respect to y_axis instead of x-axis.
Some additional explanations: In the trajectory analyzer, (1) x-axis, y-axis are the absolute coordinate (ENU coordinate) and (2) dx = x - ref_point.x(), dy = y - ref_point.y() are the distance vectors (real position minus reference position; +- sign matters! ) projected at the absolute x-axis, and y-axis; (3) ref_theta is the reference car heading angle from the x-axis, with the anti-clockwise direction as the positive direction; (4) dot_rd_nd is the station distance (real position minus reference position; +- sign matters!) projected along the reference direction.
Then, you will easily get the equation: dot_rd_nd = dx * cos_ref_theta + dy * sin_ref_theta