System for controlling a vehicle comprising a perception system that uses at least one trajectory sensor to determine a road layout, the road layout representing the trajectory to be followed by the vehicle, characterized in that the system comprises a lateral control device comprising: - a road detector configured to determine, for a current state of the vehicle, information about the road layout ahead of the vehicle on the basis of information provided by said perception system, the road layout being represented by a polynomial function having a given order; - a lateral controller based on a location of a control target point, the lateral controller being configured to perform a lateral control of the vehicle defined by a set of control parameters, on the basis of a minimization of a difference in a control value between a reference trajectory curve of the vehicle and a current trajectory curve being described by the vehicle, corresponding to the current state of the vehicle; - a maximum distance determination unit configured to project the road layout information that has been determined to a given distance ahead of the vehicle, and to determine the maximum distance at which said polynomial function satisfies one or more control conditions on the basis of the projected road layout information; - a limit checking unit configured to determine, for the current state of the vehicle, a vehicle stability envelope which is defined by limits corresponding to the application conditions of a control adapter of the vehicle, and to check whether said limits of the stability envelope have been reached by the vehicle on the basis of the maximum distance that has been determined; the control adapter being configured to adapt said control parameters of the lateral controller to the electronic horizon of said at least one sensor if said limits have been reached, on the basis of the current state of the vehicle. - a road detector configured to determine, for a current state of the vehicle, information about the road layout ahead of the vehicle on the basis of information provided by said perception system, the road layout being represented by a polynomial function having a given order; - a lateral controller based on a location of a control target point, the lateral controller being configured to perform a lateral control of the vehicle defined by a set of control parameters, on the basis of a minimization of a difference in a control value between a reference trajectory curve of the vehicle and a current trajectory curve being described by the vehicle, corresponding to the current state of the vehicle; - a maximum distance determination unit configured to project the road layout information that has been determined to a given distance ahead of the vehicle, and to determine the maximum distance at which said polynomial function satisfies one or more control conditions on the basis of the projected road layout information; - a limit checking unit configured to determine, for the current state of the vehicle, a vehicle stability envelope which is defined by limits corresponding to the application conditions of a control adapter of the vehicle, and to check whether said limits of the stability envelope have been reached by the vehicle on the basis of the maximum distance that has been determined;