A non-transitory machine-readable medium having instructions stored therein, which when executed by a processor, cause the processor to perform operations, the operations comprising:
- predicting that an obstacle is moving from a starting point to an end point based on perception data generated through perceiving a driving environment of an autonomous driving vehicle (ADV) driving within a lane;
- generating a longitudinal movement trajectory of the obstacle from the starting point to the end point in view of a shape of the lane, including determining an initial longitudinal state and an end longitudinal state, the end longitudinal state including an end longitudinal speed, wherein
- a) when a maximum curvature of the lane is greater than a threshold, a speed at a point of the maximum curvature is calculated and used as the end longitudinal speed, and when the maximum curvature of the lane is less than the threshold, a current speed of the obstacle is used as the end longitudinal speed, wherein a time to reach the end longitudinal speed is set to a default value representing a duration of a prediction period, and
- b) the initial longitudinal state and the end longitudinal state are used as constraints to a second polynomial function used to optimize a shape of the longitudinal movement trajectory;
- generating a lateral movement trajectory of the obstacle from the starting point to the end point, including optimizing a shape of the lateral movement trajectory using a first polynomial function, wherein the first polynomial function is a quintic polynomial function that satisfies at least one of the following set of initial lateral constraints a) an initial value of the first polynomial function is equal to an initial lateral offset of the obstacle, b) an initial value of a first derivative of the first polynomial function is equal to an initial lateral speed of the obstacle, and c) an initial value of the second derivative of the first polynomial function is equal to an initial lateral acceleration of the obstacle, the generating the lateral movement trajectory of the obstacle from the starting point to the end point further comprising:
- determining an initial lateral state including an initial lateral offset and an initial lateral speed of the ADV, and
- determining an end lateral state by calculating a time to reach a central line of a target lane center from the initial lateral offset and the initial lateral speed, wherein the end lateral state includes an end lateral offset is zero indicating that the ADV reaches the central line of the target lane since an offset distance between the ADV and the central line of the target lane is zero, wherein the ADV moves along the central line of the target lane after the ADV reaches the central line of the target lane, and wherein the end lateral state includes that an end lateral speed is zero;
- combining the longitudinal movement trajectory and the lateral movement trajectory to generate a predicted trajectory predicting how the obstacle is to move;
- and
- controlling the ADV to move in view of the predicted trajectory of the obstacle.