# Early Gapping and Platoon Merging Strategies for Autonomous Vehicles using Local Controllers
## 2 Methods
### Gap Profile Types  
Figure 2 presents a schematic description of the two types of gap profiles \(g_{d}(x)\), which we examined. \(x_{merge}\) denotes the _preparation section_, which ends at the merging point where the desired gap is \(g_{merge}\). The _maneuvering section_ (\(d_{acc}\)) marks the portion of the road where the imposed deceleration occurs, measured from the beginning of the road, with \(d_{acc}\leq x_{merge}\). The rationale is to allow vehicles to gradually enlarge their gaps from the vehicles ahead while minimizing the need for abrupt braking, preventing motion sickness and phantom jams. After obtaining the desired gap, the remaining portion of the road, which we denote as _stabilization section_ (\(d_{stb}\)), measured from \(d_{acc}\) to \(x_{merge}\), is dedicated to stabilizing the gaps along the vehicle line (i.e., to allow the gained gaps to accumulate and the local controllers to reach a steady state). When designing the desired gap profiles, it is beneficial to apply optimization methods such as trajectory optimization [10; 11] or predictive control methods [25]. As a first approximation, we examine here the gap profiles of two simplified types:  
**A linear profile** (dashed line in Figure 2): The vehicles are required to decelerate and open a gap in a constant manner throughout the maneuvering section:  
\[g_{d}(x)=g_{0}+\frac{\big{(}g_{merge}-g_{0}\big{)}x}{d_{acc}} \tag{5}\]  
**A sigmoid profile** (solid line in Figure 2): Only a portion of the maneuvering section is effectively used for gapping. At the extreme, this resembles a late merge approach with human driver behavior [16; 21]. An _error function_ sigmoid was used to construct the sigmoid gap profile:\[g_{d}(x|d_{acc},g_{0},g_{merge})=\frac{g_{merge}+g_{0}}{2}+\frac{g_{merge}-g_{0}}{2 }\cdot\text{erf}\left[\frac{6\left(x-\frac{1}{2}d_{acc}\right)}{d_{acc}}\right] \tag{6}\]  
Here, \(\text{erf}(\cdot)\) denotes the error function. Note that, if possible, vehicle \(i\) opens a gap from the vehicle ahead (\(i-1\)) according to \(g_{d}(x)\) and is expected to reach \(d_{acc}\) with the desired gap for merging \(g_{merge}\). These accumulated gaps are distributed between the AVs while driving along the stabilization section to allow a higher merging percentage until reaching the merging point \(x_{merge}\). After passing the merging point, vehicle \(i\) accelerates back to \(v_{s}\), regardless of any profile. Vehicle \(i\) follows the gap profile \(g_{d}(x)\) only if the vehicle ahead is above a certain speed, i.e., \(v_{i-1}\geq v_{gapping}\). Intuitively, one can suggest making an immediate deceleration to increase the gap, but this may result in phantom upstream jams, as shown for human drivers [26]. Additionally, consecutive vehicles should not try to increase the gap at the same time. Since vehicle \(i+1\) must follow vehicle \(i\)'s speed to prevent a collision, it must decelerate more than that of vehicle \(i\) to increase its gap at the same time. In addition, vehicle \(i+2\) must decelerate even more than vehicle \(i+1\), and so on; thus, a jam forms. Hence, only once vehicle \(i-1\) regains \(v_{gapping}\), vehicle \(i\) is able to accumulate a gap. If vehicle \(i-1\) again reduces its speed to lower than \(v_{gapping}\), vehicle \(i\) stops the gapping maneuver until vehicle \(i-1\) regains \(v_{gapping}\). Therefore, to prevent the formation of a braking shockwave, we introduced the \"onset gapping speed\" \(v_{gapping}\), which is a minimum speed that vehicle \(i-1\) reaches before the gapping of vehicle \(i\) is introduced. Vehicle \(i\) can approximate \(v_{i-1}\) by calculating the change in the distance to vehicle \(i-1\), measured by vehicle \(i\). Following Equation (1), the way to calculate the speed of the vehicle ahead using the gap measurements over one time step \(\Delta t\) is according to \(\lim\limits_{\Delta t\to 0}\frac{g_{i-1}(t)-g_{i-1}(t-\Delta t)}{ \Delta t}=v_{i-1}(t-\Delta t)-v_{i}(t-\Delta t))\), where the length \(l_{i-1}\) is canceled out.