# Trajectory Optimization with Dynamic Drivable Corridor-Based Collision Avoidance
## 3 Collision Avoidance Constraint Formulation
### Dynamic Construction of DC  
The construction of DC is a crucial issue in collision avoidance constraint modeling. Unlike traditional stepwise expansion schemes for DC [27] (c.f. Figure 6a), this paper adopts a dynamic DC expansion approach (c.f. Figure 6b). Typically, in the early stages of DC expansion, the available space for expansion is relatively large. In this case, we can expand the DC simultaneously in all four directions in one step, as shown in Figure 6c. This method allows us to complete in one step what would normally require four expansions, meaning that instead of performing four collision checks, only one is needed. However, relying solely on this omnidirectional expansion strategy may prematurely terminate the expansion process if a collision is detected in any direction, leaving unused expandablespace in other directions. This results in an undersized DC and consequently reduces the vehicle's drivable space (c.f. Figure 6d). Therefore, when collisions are detected during simultaneous omnidirectional expansion, the current expansion is rolled back. The system then switches to a stepwise directional expansion strategy to ensure full utilization of expandable space in all directions. The complete process of DC construction is illustrated in Figure 7. The core of the proposed method lies in dynamically adjusting the expansion strategy based on the available expandable space of the DC. By comparing the results in Figure 6a,b, it is evident that this approach significantly accelerates DC construction in the initial stages without reducing the final DC size. The implementation of dynamic DC construction is presented in Algorithm 4: The input of Algorithm 4 is the expansion center point \((x_{0},y_{0})\) and the merged occupied grid; the output of Algorithm 4 is the expansion increments of the DC region in four directions. Define the set of expansion directions as direction = \([\pi/2,0,-\pi/2,\pi]\) (clockwise direction). Initialize the expansion increments for all four directions to zero. Determine the expansion step size \(\Delta\)s, and set the maximum expansion length parameter L\({}_{\text{limit}}\) to avoid excessive expansion in each direction (c.f. lines 1-5 in Algorithm 4). Execute the function SimultaneousExpansion() (c.f. line 6 in Algorithm 4): Starting from the center point\((x_{0},y_{0})\), expand simultaneously in four directions by step size \(\Delta\)s and  
Figure 6: Schematics on DC expansion: (**a**) stepwise DC expansion; (**b**) dynamic DC expansion; (**c**) stepwise expansion (**left**) with simultaneous extension in all directions (**right**); and (**d**) simultaneous expansion of DC in all directions. The number indicates the expansion step of the DC region. perform collision detection between the expanded rectangular region and the previously obtained merged occupied grid. If no collision occurs, repeat the above expansion process until the preset maximum expansion length L\({}_{\text{limit}}\) is reached or a collision occurs. As shown in lines 7-11 in Algorithm 4, check the expansion increment length obtained from executing SimultaneousExpansion(). If all four directions reach the maximum expansion limit, return length and terminate Algorithm 4 early. If the length has not reached the maximum expansion limit, it indicates that at least one direction has encountered a collision, but it does not necessarily mean that all four directions have no expandable space. In such cases, we need to switch to a stepwise directional expansion strategy to ensure comprehensive expansion in all directions. Execute the function StepwiseExpansion() (c.f. line 12 in Algorithm 4): Specifically, based on the predefined set of expansion direction = {\(\pi/2\), \(0\), \(-\pi/2\), \(\pi\)}, the DC is expanded sequentially in each direction. If a collision occurs in a direction or the predefined maximum expansion limit is reached, the system abandons the current expansion and excludes that direction from subsequent expansions.