# E2-VINS: An Event-Enhanced Visual-Inertial SLAM Scheme for Dynamic Environments
## 3 Methodology
### Event-Based Dynamicity-Adaptive Bundle Adjustment
\(\lambda_{w}\in\mathbb{R}^{+}\) is a regularization parameter that adjusts the impact of dynamic features on the loss function. With the dynamicity metrics derived from event observations, the enhanced BA can be performed in a dynamicity-adaptive manner. Unfortunately, the stability of dynamicity weights for the same feature across preceding and succeeding frames cannot be ensured solely by only introducing event-based metrics. The metric values of the same feature may experience abrupt changes between preceding and succeeding timestamps, which can interfere with the dynamicity assessment of that feature. To address this issue, an additional factor called the weight momentum factor, was introduced to ensure a smooth transition in dynamicity weights for the same feature over time. * Weight Momentum Factor Since the features are continuously tracked, we assume that the feature \(f_{l}\) is optimized \(n_{l}\) times using its previous weight \(\bar{w}_{ev}^{l}\). The weight momentum factor \(\Psi(w_{ev}^{l})\) is defined as \[\Psi(w_{ev}^{l})=n_{l}(w_{ev}^{l}-\bar{w}_{ev}^{l}),\] (9) where \(n_{l}\) represents the number of optimization times of the feature \(f_{l}\), and \(\bar{w}_{ev}^{l}\) is the previous weight of the feature. This term helps preserve the weight trend over time by penalizing deviations from the previous weight. Therefore, the weight momentum factor is incorporated into the loss term, resulting in the final enhanced loss term as follows: \[\dot{\rho}(w_{ev}^{l},\mathbf{r}_{C}^{l})=w_{ev}^{l}{}^{2}\mathbf{r}_{C}^{l}+ \lambda_{ev}(1-w_{ev}^{l})^{2}+\lambda_{m}\Psi^{2}(w_{ev}^{l}),\] (10)where \(\lambda_{m}\in\mathbb{R}^{+}\) represents a constant parameter to adjust the effect of the momentum factor on the BA. Thus, the final BA optimization problem is expressed as  
\[\min_{\mathcal{X},\mathcal{W}}\Biggl{\{}\left\|\mathbf{r}_{p}-\mathbf{H}_{p} \mathcal{X}\right\|^{2}+\sum_{k\in\mathcal{B}}\Bigl{\|}\mathbf{r}_{\mathcal{B }}\Bigl{(}\hat{\mathbf{z}}_{b_{k+1}}^{b_{k}},\mathcal{X}\Bigr{)}\Bigr{\|}_{ \mathbf{p}_{\mathbf{h}_{k+1}}^{\text{\tiny{B}}}}^{2}+\sum_{l\in\mathbf{F}_{ \mathcal{C}}}\tilde{\rho}(w_{ev}^{l},\dot{\mathcal{L}}_{\mathcal{C}})\Biggr{\}}, \tag{11}\]  
where \(\mathbf{F}_{\mathcal{C}}\) denotes the set of indices of all tracked features in the current moving window, and \(\mathcal{W}=\left\{w_{ev}^{l}|l\in\mathbf{F}_{\mathcal{C}}\right\}\) represents the set of all feature weights. * Details on Weights Optimization and Update Strategies  
Notably, event cameras have a much lower signal-to-noise ratio (SNR) compared to frame-based cameras [38], and in cases of aggressive motion, event observations become significantly more inaccurate. Therefore, it is crucial to evaluate whether the system remains effective in the presence of high observation noise or observation failures. We propose optimizing and updating the dynamic weights during each round of state estimation in BA to mitigate the impact of outliers or dynamic features with large visual reprojection residuals. In our E\({}^{2}\)-VINS, we employed alternative optimization [37] to solve the problem presented in Equation (11). Specifically, we first optimized the dynamicity weights \(\mathcal{W}\) while keeping the state vector \(\mathcal{X}\) fixed, and subsequently optimized the state vector \(\mathcal{X}\) with the dynamicity weights \(\mathcal{W}\) held constant. By optimizing \(\mathcal{W}\) and \(\mathcal{X}\) alternatively, the BA can robustly and stably converge. While optimizing \(\mathcal{W}\), all terms except weights are constants. Hence, the objective function for optimizing weights can be expressed as follows:  
\[\min_{w_{ev}^{l}\in[0,1]}\left\{w_{ev}^{l}\sum_{j\in\mathcal{C}(f_{l})}\Bigl{\|} \mathbf{F}_{\mathcal{C}}^{ij}\Bigr{\|}^{2}+\lambda_{w}(1-w_{ev}^{l})^{2}+ \lambda_{m}\Psi^{2}(w_{ev}^{l})\right\}, \tag{12}\]  
where weight \(w_{ev}^{l}\) is independent of each other, and each \(w_{ev}^{l}\) could be optimized independently.