A computer-implemented method for autonomously charging autonomous vehicles, comprising: receiving, from a sensor in an autonomous driving vehicle, indication that a battery level of the ADV falls below a threshold, wherein the travelling trajectory is generated and smoothed by a planning module and a routing module in the ADV, wherein the planning module and routing module are configured to generate and smooth trajectories for the ADV in areas with traffic lanes; selecting a charging pile from a plurality of charging piles (606, 608, 610, 612) at a charging station based on information received from a cloud server, wherein the charging station comprises the plurality of charging piles (606, 608, 610, 612), each charging pile has a designated point at which the ADV must park in order to use the charging pile, and each designated point is located in a parking space marked by visible parking lines; the method further comprises: setting a temporary destination point of the selected charging pile, and generating a first trajectory to connect an initial point representing a current location of the ADV to the temporary destination point, wherein the temporary destination point of the selected charging pile is on an edge of the parking space associated with the charging pile, and the first trajectory is generated and smoothed by an open space parking planner, wherein the open space parking planner is configured to generate and smooth trajectories for the ADV in an open space; stopping following the travelling trajectory and driving forward along the first trajectory until the ADV comes to a point where the ADV issues control commands to make a wide turn such that the ADV can drive backward along a segment from this point to the temporary destination point; when the ADV reaches the temporary destination point, generating a second trajectory that connects the temporary destination point and the designated point; driving backward along the second trajectory to the designated point for charging the ADV after the ADV is parked at the designated point, wherein the second trajectory is a straight line. receiving, from a sensor in an autonomous driving vehicle, indication that a battery level of the ADV falls below a threshold, wherein the travelling trajectory is generated and smoothed by a planning module and a routing module in the ADV, wherein the planning module and routing module are configured to generate and smooth trajectories for the ADV in areas with traffic lanes; selecting a charging pile from a plurality of charging piles (606, 608, 610, 612) at a charging station based on information received from a cloud server, wherein the charging station comprises the plurality of charging piles (606, 608, 610, 612), each charging pile has a designated point at which the ADV must park in order to use the charging pile, and each designated point is located in a parking space marked by visible parking lines; the method further comprises: setting a temporary destination point of the selected charging pile, and generating a first trajectory to connect an initial point representing a current location of the ADV to the temporary destination point, wherein the temporary destination point of the selected charging pile is on an edge of the parking space associated with the charging pile, and the first trajectory is generated and smoothed by an open space parking planner, wherein the open space parking planner is configured to generate and smooth trajectories for the ADV in an open space; stopping following the travelling trajectory and driving forward along the first trajectory until the ADV comes to a point where the ADV issues control commands to make a wide turn such that the ADV can drive backward along a segment from this point to the temporary destination point; when the ADV reaches the temporary destination point, generating a second trajectory that connects the temporary destination point and the designated point; driving backward along the second trajectory to the designated point for charging the ADV after the ADV is parked at the designated point, wherein the second trajectory is a straight line.