Autonomous driving offers a convenient and comfortable means of transportation, while the addition of external communication interfaces renders the vehicle communication more vulnerable to cyber attacks. In contrast to conventional attacks, well-designed stealthy attacks are more adept at evading conventional detectors. To address this problem, this paper proposes a robust detector based on controlled invariant subspace to identify stealthy attacks. This paper stands out not only by relying on the vehicle dynamics model for system state estimation, but rather by employing a real-time trajectory space generation method. Our detector develops a rapidly expanding random tree method based on offline incremental learning to generate trajectory subspace, and any trajectories that diverge from this subspace are identified as anomalies. Additionally, this paper designs distance measurement method that combines the linear quadratic regulation algorithm with a radial basis function neural network while also taking into account the vehicle's dynamic performance constraints. To assess the theoretical performance of the proposed detector, this paper presents rigorous proofs that demonstrate the asymptotical optimality of the generated trajectory and the robustness of the stealthy attack detection method based on controlled invariant subspace. Finally, simulation results demonstrate that the proposed robust detector can effectively identify stealthy attacks and outperforms advanced techniques in terms of accuracy and false-positive rate.