## 2 Methodology
### State Vector and System Model  
In the integration of RTK and INS measurements using the EKF, the state vector is a crucial component that encapsulates all of the necessary variables representing the system's current state. This state vector allows the system to continuously update and refine the positioning and navigation solutions by incorporating data from both the GNSS (RTK) and INS subsystems. The state vector \(x\) in this study is designed to comprehensively represent the system's state, including key variables that are essential for accurate positioning and navigation. The state vector is defined as follows:  
\[x=\left[ \begin{array}{c}p\\ v\\ \theta\\ b_{\text{GNSS}}\\ b_{\text{INS}}\end{array} \right] \tag{17}\]  
where \(p\) represents the position vector, which includes the \(x\), \(y\), and \(z\) coordinates of the system, \(v\) denotes the velocity vector, which includes the velocities along the \(x\), \(y\), and \(z\) axes, \(\theta\) stands for the orientation, typically represented as Euler angles or quaternions, which define the system's attitude, and \(b_{\text{GNSS}}\) and \(b_{\text{INS}}\) are the bias terms associated with the GNSS and INS measurements, respectively. These biases account for any systematic errors or drifts that may affect the accuracy of the measurements. The state vector is critical in maintaining an accurate and continuous estimate of the vehicle's position and orientation, even when one of the measurement systems (e.g., the GNSS) is unreliable or temporarily unavailable. The system model predicts the evolution of the state vector over time based on the vehicle's kinematics and the sensor inputs. This prediction is central to the Kalman Filter's operation, allowing it to anticipate the system's state and subsequently correct it using real-time measurements. The system model can be expressed as follows:  
\[\dot{x}(t)=f(x(t),u(t),\omega(t)) \tag{18}\]  
where \(f(. )\) represents the system's dynamic function, which defines how the state evolves over time, \(u(t)\) is the control input, such as the acceleration or steering angle, influencing the system's movement, and \(\omega(t)\) is the process noise, accounting for uncertainties or disturbances in the system model. For instance, in vehicular navigation, the position and velocity are updated based on the current speed and heading, while the orientation is adjusted according to the gyroscope readings from the INS. The bias terms \(b_{\text{GNSS}}\) and \(b_{\text{INS}}\) are modeled as random walk processes to capture their gradual drift. The discrete-time version of the system model used in the EKF can be written as follows:  
\[x_{k+1}=F_{k}x_{k}+B_{k}u_{k}+\omega_{k} \tag{19}\]  
where \(F_{k}\) is the state transition matrix, which is derived from the continuous-time dynamic function \(f(\cdot)\), \(B_{k}\) is the control input matrix, and \(\omega_{k}\) represents the process noise at time step \(k\). The state vector and system model are integral to the Kalman filter framework, which uses these elements to predict the system's state and then corrects it based on measurement updates. During the prediction step, the system model estimates the state vector's evolution as follows:  
\[\hat{x}_{k|k-1}=F_{k}\hat{x}_{k-1|k-1}+B_{k}u_{k} \tag{20}\]  
Here, \(\hat{x}_{k|k-1}\) is the predicted state estimate at time \(k\) given the state at time \(k-1\). This predicted state is then corrected using the measurement update, where real-time GNSS and INS measurements are incorporated to refine the state estimate, as follows:  
\[\hat{x}_{k|k}=\hat{x}_{k|k-1}+K_{k}\Big{(}y_{k}-H_{k}\hat{x}_{k|k-1}\Big{)} \tag{21}\]  
where \(K_{k}\) is the Kalman Gain, determining the weighting of the measurement update, \(y_{k}\) is the measurement vector at time \(k\), and \(H_{k}\) is the measurement matrix, linking the state vector to the actual measurements. This integration ensures that the system remains accurate and reliable, even in challenging environments, by effectively combining the strengths of both the GNSS and INS systems.