## 2 Local Path Generation Based on Spatial Perception
### Obstacle Avoidance Path Generation  
Upon determining the dynamic control points, B-spline curves facilitate the creation of the local obstacle avoidance path via discrete interpolation. These curves, constructed from established control points, can employ either uniform or non-uniform parametric techniques. The methodology entails formulating expressions for the basis functions, followed by the assembly of diagonal matrices through the linear combination of these functions. This culminates in the production of a smooth curve [37].  
Consider a scenario where we have a total of \(n+1\) control points, represented as \(P_{0},P_{1},P_{2},\ldots,P_{n}\). These control points serve to delineate the direction and boundary constraints of the spline curve. Based on these control points, the B-spline curve can be defined as follows:  
\[P(u)=[P_{0}\;P_{1}\;P_{2}\ldots P_{n}]\begin{bmatrix}B_{0,k}(u)\\ B_{1,k}(u)\\ \vdots\\ B_{n,k}(u)\end{bmatrix}=\sum_{i=0}^{n}P_{i}B_{i,k}(u) \tag{8}\]  
where \(B_{i,k}(u)\) represents the \(i\)-th \(k\)-th order B-spline basis function, \(P_{i}\) is a control point, and \(k\geq 1\). The variable \(u\) is the independent variable. The basis function \(B_{i,k}(u)\) is derived from the [PERSON] recursion formula [38]  
\[B_{i,k}(u)=\left\{\begin{array}{ll}\left\{\begin{array}{ll}1,&u_{i}\leq u<u_ {i+1}\\ 0,&\mbox{others}\end{array}\right.,&k=1\\ \frac{u-u_{i}}{u_{i+1}-u_{i}}B_{i,k-1}(u)+\frac{u_{i+k}-u}{u_{i+k}-u_{i+1}}B_{ i+1,k-1}(u),&k\geq 2\end{array}\right. \tag{9}\]  
Conventionally, the indeterminate form \(\frac{0}{0}\) is defined as 0. Here, \(u_{i}\) represents a set of continuously varying values known as knot vectors, with the initial and final values typically defined as 0 and 1. The sequence of \(u_{i}\) can be expressed as \([u_{0}\;u_{1}\ldots u_{k},u_{k+1},\ldots,u_{n},u_{n+1},\ldots,u_{n+k}]\).  
B-spline curves, as categorized by the distribution of knot vectors, fall into two main types: uniform B-spline curves and quasi-uniform B-spline curves [39]. The latter, with its non-uniform parameter distribution, is distinguished by its capacity for greater shape flexibility. This makes it especially adept at adapting to intricate road conditions and meeting obstacle avoidance criteria. Further enhancing their utility, quasi-uniform B-spline curves retain the characteristics of Bezier curves at their extremities. This ensures that the tangent at the endpoints matches the line joining the last two endpoints, thereby guaranteeing the continuity of the curvature in the obstacle avoidance trajectory.  
Drawing from the global path, alongside real-time vehicular positioning and obstacle perception data, it is feasible to ascertain and refine the control points of the B-spline curve in a localized context. This culminates in the final set of control points. Interpolation conducted on these six terminal points facilitates the creation of a smooth B-spline curve. To forge a real-time, local obstacle-avoidance trajectory, this curve undergoes a process of discretization. It is pivotal to synchronize the discretization sampling time with that used to derive the global path. Subsequently, the resulting discrete spatial coordinates compose the definitive local obstacle-avoidance spatiotemporal trajectory.  
Figure 4 illustrates the local obstacle-avoidance trajectory, derived from the finalized control points. Notably, this trajectory adheres to stringent safety standards throughout the driving process and aligns with vehicular kinematic constraints. This alignment guarantees a minimal variation in curvature during obstacle evasion.