The paper introduces a quadratic programming algorithm for real-time local path planning of autonomous vehicles. The algorithm relies on discretized sampling points and an enhanced cost function. Initially, we formulate the cost function to optimize the reference trajectory and establish the Frenet coordinate system. The drivable region undergoes discretization to generate sampling points in the Frenet coordinate system. We apply the principles of convex spatial obstacle avoidance to define the vehicle's drivable area, taking into account the vehicle's kinematics and establishing barrier boundary conditions. Subsequently, quadratic programming is employed to determine an optimal path within the vehicle's drivable area. Concurrently, two cost functions are devised, the first evaluates the distance between the vehicle and obstacles, while the second assesses ride comfort, these cost functions are employed to evaluate sampling points and speed profiles, facilitating the planning of an optimal speed profile on the selected path. Finally, the algorithm undergoes validation through co-simulation using Matlab/Simulink, PreScan, and CarSim software. Various road scenarios, including straight and S-curve roads with both dynamic and static obstacles, are created to assess the method's feasibility. The test results demonstrate the algorithm's efficacy in avoiding moving and stationary obstacles and generating an ideal path compliant with driving conditions.INDEX TERMS Autonomous driving, path planning, quadratic programming, cost function