Academic Journal of Science and Technology ISSN: 2771-3032 | Vol. 8, No. 1, 2023 156 Research on Indoor Fusion Positioning Based on EKF for Uwb_Imu Lin Long1, Jiaye Wu2, * 1School of Automation and Information Engineering, Sichuan University of Science & Engineering, Yibin 644000, China 2School of Mechanical and Electrical Engineering, Southwest Petroleum University, Chengdu, 610000, China * Corresponding author Abstract: The study aims to improve the accuracy and stability of indoor positioning by integrating information from two types of sensors: UWB (Ultra-Wideband) and IMU (Inertial Measurement Unit) calibrated to eliminate system errors. The fusion algorithm utilizes Extended Kalman Filter (EKF) to combine UWB data and IMU measurements. First, the IMU undergoes self- calibration to correct system errors. Then, UWB ranging technology is used to estimate the target's position, and the information from the IMU's gyroscope and accelerometer is used to update the kinematic model. Finally, the EKF filters and predicts measurement errors and system noise to obtain accurate target position estimation. Experimental results demonstrate that this fusion method can enhance the precision and robustness of indoor static target positioning. The research findings are highly applicable in areas such as indoor positioning and intelligent surveillance. Keywords: Ultra-Wideband, Inertial Measurement Unit, Extended Kalman Filter, Information fusion, Indoor positioning. 1. Introduction With the increasing demand for indoor positioning, such as indoor navigation and smart surveillance, the requirements for the accuracy and stability of indoor positioning technology are also increasing. Single UWB (Ultra-Wideband) positioning methods often cannot meet these requirements, therefore, new positioning methods need to be found to solve the indoor positioning problem. Among them, the fusion of UWB and IMU (Inertial Measurement Unit) sensor information has received considerable attention[2-6]. UWB technology is a broadband signal transmission technology that obtains target position information by measuring the arrival time difference of signals. It has the characteristics of high accuracy and strong anti-interference ability, making it suitable for indoor positioning applications. However, using UWB technology alone may have issues with measurement errors and instability. On the other hand, IMU is a sensor that measures the orientation and acceleration of an object, usually consisting of a gyroscope and accelerometer. By measuring the rotation and acceleration information of an object, the displacement and velocity of the object can be estimated in real-time. IMU sensors have the characteristics of high frequency and strong real-time performance, but they may be affected by accumulated errors and drift issues during long-term use. Therefore, fusing the information from UWB and IMU sensors can make full use of their respective advantages and improve the accuracy and stability of indoor positioning. Some scholars have researched and explored fusion methods of UWB and IMU. Yao Lu[7] et al. proposed a UWB/IMU fusion method based on the Unscented Kalman Filter (UKF) algorithm, with experimental results showing fusion positioning error within 0.5 meter and stability almost up to 99%. Zhang Binfei[8] et al. proposed a tightly coupled algorithm in complex indoor environments, which improved the accuracy of UWB positioning by 88.6% compared to UWB alone. Wang Peng[9] et al. proposed an improved particle filter algorithm for UWB/IMU fusion, which increased the positioning accuracy by 65.6% and 56.0% compared to EKF and UKF, respectively, while reducing the running time by 42.3% compared to the standard particle filter algorithm. Yang Xiujian [10] etal. proposed a UWB/IMU/odometer fusion positioning method based on an improved UKF algorithm, showing an improvement of approximately 22.8% and 13.1% in positioning accuracy compared to EKF and UKF, respectively. This article aims to achieve accurate static positioning of indoor targets by fusing UWB initial positioning data and self-calibrated IMU data using the Extended Kalman Filter (EKF). The EKF, as a commonly used fusion algorithm, can filter and predict UWB data and IMU measurements to obtain an accurate estimate of the target's position. The fusion method is verified through an experimental environment and the data is analyzed using MATLAB software. 2. IMU and UWB Positioning Technology 2.1. IMU positioning technology IMU consists mainly of accelerometers and gyroscopes, which can measure the acceleration and angular velocity of the carrier in the vehicle coordinate system. Then, these measured values are converted to the navigation coordinate system, and the position, velocity, and attitude information are calculated through integration. In this paper, the North, East, Down (NED) coordinate system is chosen as the navigation coordinate system. The vector rotation from the vehicle coordinate system to the navigation coordinate system can be achieved through Euler angles, direction cosine matrix method, or quaternion method. Euler angles are simple and intuitive, but they may encounter gimbal lock problems. The direction cosine matrix method involves solving the differential equations of the attitude matrix, which requires a large computational burden. Therefore, this paper chooses the quaternion method, which has a smaller computational load and a simpler algorithm. The rotation matrix from the vehicle coordinate system (B-system) to the navigation coordinate 157 system (N-system) based on the attitude quaternion q is as follows: 𝑻 𝑩 𝑵 𝒒𝟎 𝟐 𝒒𝟏 𝟐 𝒒𝟐 𝟐 𝒒𝟑 𝟐 𝟐 𝒒𝟏 ∗ 𝒒𝟐 𝒒𝟎 ∗ 𝒒𝟑 𝟐 𝒒𝟏 ∗ 𝒒𝟑 𝒒𝟎 ∗ 𝒒𝟐 𝟐 𝒒𝟏 ∗ 𝒒𝟐 𝒒𝟎 ∗ 𝒒𝟑 𝒒𝟎 𝟐 𝒒𝟏 𝟐 𝒒𝟐 𝟐 𝒒𝟑 𝟐 𝟐 𝒒𝟐 ∗ 𝒒𝟑 𝒒𝟎 ∗ 𝒒𝟏 𝟐 𝒒𝟏 ∗ 𝒒𝟑 𝒒𝟎 ∗ 𝒒𝟐 𝟐 𝒒𝟐 ∗ 𝒒𝟑 𝒒𝟎 ∗ 𝒒𝟏 𝒒𝟎 𝟐 𝒒𝟏 𝟐 𝒒𝟐 𝟐 𝒒𝟑 𝟐 (1) In the equation, 𝑞 𝑞 𝑞 𝑞 represents a quaternion and satisfies: 𝑞 𝑞 𝑞 𝑞 1; 𝑎 𝑇 𝑎 0 0 𝑔 (2) In the equation, "a " represents the three-axis acceleration in the navigation coordinate system, "a " represents the three- axis acceleration in the vehicle coordinate system, and "g" represents the local gravitational acceleration. After the rotation transformation, the measured values from the accelerometer are integrated to obtain the velocity and position in the navigation coordinate system. 2.2. UWB Positioning Technology UWB positioning technology is a high-precision IoT positioning technology at the centimeter level. It utilizes UWB wireless signals for positioning and combines measurements of time difference of arrival (TDOA) and the coordinates of base stations to achieve high-precision location calculation for IoT devices. This article adopts the Two Way- Time of Flight (TW-TOF) method, where each module generates an independent timestamp from the start. Module A's transmitter sends a pulse signal with the nature of an emission request on its timestamp, and Module B responds by transmitting a signal at a specific moment, which is received by Module A on its own timestamp. This allows for the calculation of the flight time of the pulse signal between the two modules, thereby determining the flight distance, d. Figure 1 illustrates the three-plane positioning method. d C T T T T /2 (3) Where C is the speed of light. Figure 1. Three-plane positioning principle Based on Figure 1, we establish the UWB positioning equation system. X X Y Y d X X Y Y d X X Y Y d (4) Where: X 、 X 、 X 、 Y 、 Y 、 Y represent the coordinates of the base stations,d 、d 、d represent the distances from the three base stations to the target point measured by UWB. The positioning of the target point is usually solved using the least squares method. By transforming the above equation system into a matrix form and adopting regularized least squares method, the estimated value of the target point can be obtained as: L A A A Y (5) Where: A 2 Xb Xa 2 Xc Xb 2 Yb Ya 2 Yc Yb , Y 3. UWB_IMU Data Fusion 3.1. IMU Self-calibration 3.1.1. Using imu_tk package to determine system errors and compensate for them According to D. Tedaldi, A. Pretto[11-12] and others, the imu_tk package is first used to calibrate the IMU used, and the three elements of the system error of the IMU are measured, namely: misalignment matrix, scale matrix, and bias vector. The data obtained is then used to compensate the accelerometer and gyroscope of the IMU using the following formula: X M K X B (6) where M is the misalignment matrix, K is the scale factor matrix, and B is the bias matrix for the accelerometer. Figures 2 and 3 show the specific data matrices for the accelerometer and gyroscope used in this paper. Figure 2. Calibration Results of the Accelerometer Figure 3. Calibration Results of the Gyroscope 3.1.2. Allen analysis measures gyroscope noise. The IMU was left motionless for approximately five hours, and the data from the three-axis gyroscope was recorded. Then, using the Allen variance analysis package in MATLAB, 158 the obtained data was analyzed to identify the sources of noise. The results are shown in Figure 4-6. The following five parameters were obtained: quantization noise, random walk of angles, bias instability noise, rate random walk, and rate ramp. The random errors obtained in the three axes are used as the values of Q for the next step of EKF fusion. Figure 4. Allen analysis result for gyro_x axis. The meanings and values of the intersections from left to right in the figure are: Quantization:7.51e-03 [deg] RandomWalk:2.21e+00 [deg/sqrt{hr}] Bias Instability:5.54e+01 [deg/hr] RateRandomWalk:1.48e+02[deg/hr/sqrt{hr}] Rate Ramp:3.29e+02 [deg/hr/hr] Figure 5. Allen analysis result for gyro_y axis. Quantization:3.14e-03 [deg] Random Walk:9.08e-01 [deg/sqrt{hr}] Bias Instability:6.39e+00 [deg/hr] RateRandomWalk:6.81e-01[deg/hr/sqrt{hr}] Rate Ramp:0.00e+00 [deg/hr/hr] Figure 6. Allen analysis result for gyro_z axis. Quantization:3.68e-03 [deg] Random Walk:9.89e-01 [deg/sqrt{hr}] Bias Instability:1.05e+00 [deg/hr] RateRandomWalk:4.38e-01 [deg/hr/sqrt{hr}] Rate Ramp:1.22e-01 [deg/hr/hr] 3.2. EKF for UWB/IMU data fusion. The Kalman filter was initially used for linear systems. It provides optimal results when the system model is linear and the noise is Gaussian white noise. However, in real-life scenarios, there are many nonlinear problems. The Extended Kalman Filter (EKF) is a filter that linearizes the expected value and covariance through Taylor series expansion to address nonlinear problems. In indoor positioning, due to the presence of NLOS errors, measurement noise often does not follow a Gaussian distribution, and using the Kalman filter may not yield optimal estimates. In this paper, we employ the EKF to incorporate position, velocity, quaternion, accelerometer bias, and gyroscope bias into a single filter. The UWB measurements are used as the measurement values, and the position estimates obtained through IMU integration are used as the prediction values for the EKF, to update the position, velocity, and attitude information. The state and measurement equations for the Extended Kalman Filter are as follows: X F X G U W (7) Z H X V (8) In the equation: W and V represents process and measurement noise. Let F | | , , H | | be the Jacobian matrix of the state transition function, G | | , be the Jacobian matrix of the measurement function.The EKF fusion process is as follows: Prediction step: Predict (prior) state estimation. X | F X | (9) Predict (prior) estimated covariance. P | F P | F Q (10) Compute the residual between the estimated state and the measurement value Y = Z H X | ;Calculate the covariance of the residual S =H P | H R ; Update step: Calculate the optimal Kalman gain. K P | H S (11) Update (posterior) state estimation. X | X | K Y (12) Update (posterior) covariance. P | I K H P | (13) 159 In the equation, Q and R are the noise of U and Z covariance matrices for and , respectively. 4. Experimental Results and Analysis An experimental setup was constructed in the office area (as shown in Figure 7). The experimental modules utilized the Decawave DW1000 chip and SC-AHRS-100D2 inertial navigation system. Three UWB base stations were deployed within a 1.2m x 1.2m area, where base station 0 was connected to the PC via a USB cable. The experimental setup included base station 0 located at (0.0, 0.0), base station 1 at (1.2, 0.0), base station 2 at (0.0, 1.2), and a test vehicle integrated with a tag labeled Tag0. During testing, the base stations and the tag were positioned at the same height (0.3m) to minimize positioning errors. The initial configuration for the testing location is shown in Figure 8. Figure 7. Actual test environment. Figure 8. Diagram of vehicle positioning. To verify the positioning accuracy of UWB in a static environment, 9 different locations were selected for measurement in the aforementioned experimental area. These 9 locations were arranged in a zigzag pattern. The actual coordinates of the locations are as follows: Location 1 (0.9, 0.9), Location 2 (0.6, 0.9), Location 3 (0.3, 0.9), Location 4 (0.3, 0.6), Location 5 (0.6, 0.6), Location 6 (0.9, 0.6), Location 7 (0.9, 0.3), Location 8 (0.6, 0.3), and Location 9 (0.3, 0.3). The vehicle was controlled to pass through these locations sequentially with a 15-second pause at each location. The actual position data of the vehicle was recorded in the background and outputted. The recorded data was then compared and analyzed using MATLAB software. The results of the comparative experiment between the two data sets are shown in Figures 9 and 10. Figure 9. UWB positioning results only. Figure 10. Fused positioning results. From the above comparison of experimental results, it can be observed that the positioning accuracy and stability are not satisfactory when using UWB positioning alone. The positioning results, especially when approaching the experimental area, tend to deviate from the actual values. The average error is 14.82cm, with a maximum error of 26.40cm. However, after performing EKF fusion, the deviation between the fused positioning coordinates and the actual position of the vehicle is smaller. The positioning range is more concentrated, with an average positioning accuracy of 10.33cm and a maximum error of only 13.68cm. 5. Conclusion To improve the positioning accuracy of mobile robots indoors, this study proposes and verifies a UWB/IMU information fusion method based on the EKF algorithm after self-calibration of the IMU. Firstly, UWB is used to calculate the robot's position data, and then the IMU is analyzed and compensated for its self-errors. Next, the Extended Kalman Filter is employed to fuse the information obtained from UWB and the calibrated IMU. Through experimental verification, it is demonstrated that this method can achieve the desired positioning accuracy for indoor robots. References [1] Zhao H M, Zhao J L. A review of indoor positioning algorithms for ultra-wideband. Telecommunications Science, 2018, 34(09): 130-142. [2] Liu L, Xu X W, Zhou G Z, et al. Locating method of power inspection robot based on UWB and IMU. Automation Expo, 2022, 39(04): 46-51. 160 [3] Sun J, Gu R, Li S, et al. HUID: DBN-Based Fingerprint Localization and Tracking System with Hybrid UWB and IMU. China Communications, 2023, 20(02): 139-154. [4] Hu W L, Zhou Y F, Song Q J, et al. Research on indoor positioning algorithm based on UWB and IMU information fusion. Manufacturing Automation, 2023, 45(02): 193- 197+213. [5] Li X, Wang Y. Research on the UWB/IMU fusion positioning of mobile vehicle based on motion constraints. Acta Geod Geophys 55, 237–255 (2020). [6] Zou A, Hu W, Luo Y, Jiang P. An Improved UWB/IMU Tightly Coupled Positioning Algorithm Study. Sensors 2023, 23, 5918. [7] Yao L, Nie X G, Huang H Y, et al. Research on UWB/IMU combined positioning using Unscented Kalman Filter algorithm. Mechanical Science and Technology: 1-10. [8] Zhang B F, Jin W Y. Indoor positioning and navigation algorithm based on UWB and IMU tight combination. Electronic Measurement Technology, 2022, 45(10): 67-73. [9] Wang P, Hou Z S. Indoor dynamic positioning algorithm based on UWB and IMU fusion. Electronic Measurement Technology, 2023, 46(10): 76-83. [10] Yang X J, Huang F, Shang K, Yan S H. Fusion positioning method of UWB/IMU/odometer based on improved UKF. Journal of Chinese Inertial Technology, 2023, 31(05): 462-471. [11] ]D. Tedaldi, A. Pretto and E. Menegatti, "A robust and easy to implement method for IMU calibration without external equipments," 2014 IEEE International Conference on Robotics and Automation (ICRA), Hong Kong, China, 2014, pp. 3042- 3049. [12] A. Pretto and G. Grisetti, "Calibration and performance evaluation of low-cost IMUs". In Proceedings of the 20th IMEKO TC4 International Symposium, Sep. 15 - 17, 2014 Benevento, Italy, pages: 429 - 434.