A method (400, 500) for path planning for an autonomous or semi-autonomous vehicle, the method comprising: obtaining (402a-d) a drivable area of a surrounding environment of the vehicle; generating (403a-d, 502) a path within the drivable area at a time step t based on a predefined set of characteristics for the path, and a predefined set of constraints, wherein the predefined set of characteristics is related to comfort aspects of the path, and wherein the predefined set of characteristics comprises at least one of a path smoothness level, a distance to lane centre, and a length of the path; wherein the predefined set of constraints comprises at least one constraint based on a current pose of the vehicle at the time step t; wherein the step of generating (403a-d, 502) a path within the drivable area at the time step t comprises: computing a cost function, wherein the cost function is a mathematical representation of the predefined set of characteristics for the path, computing the predefined set of constraints, wherein the predefined set of constraints further comprise at least one constraint based on a boundary of the drivable area and at least one constraint based on vehicle characteristics, solving an optimization problem based on the computed cost function and the computed predefined set of constraints, and forming the path based on the solved optimization problem; characterized in that the at least one constraint based on the current pose of the vehicle comprises two lateral boundaries extending along and in parallel with a longitudinal axis of the vehicle at a first predefined lateral distance from the longitudinal axis; and in that an area between the two lateral boundaries defines an allowable area within which at least a portion of the path at the time step t is allowed to be formed. obtaining (402a-d) a drivable area of a surrounding environment of the vehicle; generating (403a-d, 502) a path within the drivable area at a time step t based on a predefined set of characteristics for the path, and a predefined set of constraints, wherein the predefined set of characteristics is related to comfort aspects of the path, and wherein the predefined set of characteristics comprises at least one of a path smoothness level, a distance to lane centre, and a length of the path; wherein the predefined set of constraints comprises at least one constraint based on a current pose of the vehicle at the time step t; wherein the step of generating (403a-d, 502) a path within the drivable area at the time step t comprises: computing a cost function, wherein the cost function is a mathematical representation of the predefined set of characteristics for the path, computing the predefined set of constraints, wherein the predefined set of constraints further comprise at least one constraint based on a boundary of the drivable area and at least one constraint based on vehicle characteristics, solving an optimization problem based on the computed cost function and the computed predefined set of constraints, and forming the path based on the solved optimization problem; computing a cost function, wherein the cost function is a mathematical representation of the predefined set of characteristics for the path, computing the predefined set of constraints, wherein the predefined set of constraints further comprise at least one constraint based on a boundary of the drivable area and at least one constraint based on vehicle characteristics, solving an optimization problem based on the computed cost function and the computed predefined set of constraints, and forming the path based on the solved optimization problem; characterized in that the at least one constraint based on the current pose of the vehicle comprises two lateral boundaries extending along and in parallel with a longitudinal axis of the vehicle at a first predefined lateral distance from the longitudinal axis; and in that an area between the two lateral boundaries defines an allowable area within which at least a portion of the path at the time step t is allowed to be formed.