Mobile phone positioning indoor and outdoor seamless switching multi-source interactive navigation method
By integrating multi-source observation data and multiple positioning mechanisms, a seamless positioning software framework is built, which solves the problem of seamless switching between mobile phone positioning indoor and outdoor, improves positioning accuracy and user experience, and reduces performance occupancy.
Patent Information
- Application Number
- CN202510103550.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-22
- Publication Date
- 2025-06-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art is difficult to achieve seamless switching between mobile phone positioning indoor and outdoor, especially in outdoor shading areas and indoor and outdoor transition areas. A single GNSS or indoor positioning means cannot achieve continuous and stable positioning, and the accuracy and reliability of scene judgment are low, resulting in poor positioning effect, high performance occupancy and poor user experience.
By integrating multi-source observation data (GNSS/base station/light/geomagnetic/air pressure), and combining three positioning mechanisms: GNSS positioning, WIFI/geomagnetic position fingerprint matching, and PDR positioning, a multi-source interactive seamless positioning software framework is built to achieve seamless flat and stable indoor and outdoor positions.
It improves the accuracy and reliability of scene judgment, realizes seamless flat and stable indoor and outdoor positions, reduces mobile phone power and energy consumption, avoids repeated switching of scene transition areas, improves user experience, and optimizes software performance.
Smart Images

Figure CN120214688A_ABST
Abstract
Description
Technical Field
[0001] This application relates to a method for seamless switching between indoor and outdoor mobile phone positioning, and particularly to a multi-source interactive navigation method for seamless switching between indoor and outdoor mobile phone positioning, belonging to the technical field of mobile phone positioning and navigation. Background Art
[0002] The rapid development of mobile Internet and navigation positioning technologies has promoted location-based services (LBS) to become a basic service content close to people's lives. As the most important platform for LBS, smartphones, with their portability, complete functions, and continuous growth in the number of users globally, bring unlimited opportunities and possibilities for the application of LBS. Under this development trend, higher requirements are also put forward for location services. In addition to having the ability to respond to location requests with high real-time accuracy, it is also necessary to eliminate physical boundaries to achieve seamless full coverage in various scenarios, including outdoor occlusion areas and indoor-outdoor transition areas, and complete the extension from isolated areas to seamless global areas. Conducting seamless positioning research based on the mobile phone side will play an important role in promoting the wide application of LBS in various fields.
[0003] Typical scenario classifications divide living scenarios into outdoor areas and indoor areas. In outdoor areas, global satellite navigation systems (GNSS) represented by GPS and BDS have the characteristics of high precision, all-weather, and convenient operation, and have developed rapidly and are widely used. The positioning chips based on them have also become necessary configurations for smartphones. However, the implementation of GNSS positioning technology requires good line-of-sight conditions to the sky and the ability to observe at least four effective satellites. Therefore, it cannot meet the positioning needs of all outdoor areas, such as urban canyons and severely occluded corridor areas. In indoor areas, with the rapid development of corresponding positioning technologies and methods, users can achieve different levels of positioning based on multiple information sources such as Bluetooth, WiFi, geomagnetism, sound waves, UWB, and base stations. Among them, the location fingerprint method has unique advantages because it does not require excessive additional equipment layout and the implementation process is simple and easy.
[0004] Although GNSS positioning and location fingerprint matching positioning can respectively achieve outdoor and indoor positioning, they belong to different positioning mechanisms, with large differences in positioning accuracy and positioning areas, and cannot be directly and smoothly seamlessly docked. Moreover, GNSS positioning also has many location blind spots. Therefore, the connection of different positioning mechanisms has become the key to achieving seamless positioning. Most current mobile phones are equipped with MEMS and magnetometer sensor modules, which can support pedestrian dead reckoning (PDR) to achieve passive autonomous positioning within a short time, fill the positioning blind spots, and assist in positioning switching.
[0005] The problems that need to be solved in the seamless switching between indoor and outdoor mobile phone positioning in the prior art and the key technical difficulties of this application include:
[0006] (1) The matching of GNSS in the current outdoor area and the location fingerprint in the indoor area can already achieve good positioning effects in outdoor and indoor scenarios. However, in the indoor-outdoor connection area and severely blocked outdoor areas, it is impossible to achieve continuous and stable positioning using a single GNSS or indoor positioning method. The key problem to be solved in this application is how to fuse multi-source observation data for scene judgment, and use multi-mechanism interactive positioning to achieve seamless and stable positioning. On this basis, a seamless positioning software framework for multi-source interaction is constructed. In terms of positioning effect, the prior art cannot guarantee a scene judgment accuracy rate of more than 90%, and it cannot continuously position outdoors (including fully blocked areas), and cannot ensure seamless and smooth transition during indoor-outdoor scene switching. In terms of performance, the prior art has poor compatibility and unstable operation among different models of mobile phones, a large mean error in the data synchronization acquisition time, a long positioning solution calculation time for a single epoch, and high levels in terms of CPU occupancy rate, memory occupancy rate, traffic consumption, and power consumption. It cannot meet the needs of the general public for seamless indoor-outdoor switching and multi-source interactive positioning.
[0007] (2) In addition to having the ability to respond to location requests with high real-time accuracy, indoor-outdoor positioning of mobile phones also needs to eliminate physical boundaries to achieve seamless full coverage in various scenarios, including outdoor blocked areas and indoor-outdoor transition areas, and complete the extension from isolated areas to seamless global areas. The prior art cannot meet the above requirements and lacks seamless positioning research based on the mobile phone side. Although GNSS positioning and location fingerprint matching positioning can achieve outdoor and indoor positioning respectively, they belong to different positioning mechanisms and have large differences in positioning accuracy and positioning area, and cannot be directly and smoothly connected seamlessly. Moreover, GNSS positioning also has many location blind spots. The connection of different positioning mechanisms becomes the key to achieving seamless positioning. The accuracy and reliability of scene judgment in the prior art are low; the scene judgment results cannot assist seamless positioning switching, and the positioning trigger problem and switching decision problem are prominent. The mobile phone has high power consumption and energy consumption, and repeatedly switches in the scene transition area; it is impossible to ensure more accurate and stable switching while achieving smooth switching; the mobile phone performance occupancy is large, and the user experience is poor.
[0008] (3) The prior art lacks the ability to fuse multi-source observation data for scene judgment, cannot achieve seamless and stable positioning through multi-mechanism interactive positioning, lacks a seamless positioning software framework for multi-source interaction, and does not adopt a seamless positioning method that integrates three positioning mechanisms: GNSS positioning, WIFI / geomagnetic position fingerprint matching, and PDR positioning; it cannot obtain multi-source sensor observation data such as GNSS / base station / light / geomagnetism / barometric pressure provided by smartphones, has not established an indoor and outdoor scene judgment method based on multi-source fusion, and has not constructed a seamless positioning switching method by combining the characteristics of different positioning methods according to the scene judgment results, so it cannot achieve seamless and stable positioning in different indoor and outdoor scenes; it has not solved the problems of multi-source data acquisition and time synchronization of GNSS / differential augmentation information / MEMS / magnetometer / base station / barometer, efficient hybrid programming of C / C++ and Java under the JNI mechanism, and secondary development of the Amap SDK, cannot meet the positioning needs of the general public pedestrians, cannot achieve full coverage of various pedestrian scenarios indoors, outdoors, and corridors, and the positioning scheme has high costs, is not easy to carry, has low accuracy, cannot achieve full coverage and seamless continuity. Summary of the Invention
[0009] This application realizes scene judgment based on multi-source data (GNSS / base station / light / geomagnetism / barometric pressure), improving the accuracy and reliability of scene judgment; the scene judgment results assist seamless positioning switching, solving the positioning trigger problem and switching decision problem, reducing the power consumption of the mobile phone while avoiding repeated switching in the scene transition area; indoor and outdoor fusion switching effectively utilizes data information, achieving smooth switching while ensuring more accurate and stable switching; using a thread pool to control data acquisition and processing can not only achieve real-time synchronization but also reasonably occupy the mobile phone CPU; adopting hybrid programming of C / C++ and Java under the JNI mechanism improves the GNSS / PDR positioning solution efficiency and breaks through the limitations of the mobile phone's own processing ability; using the Amap and indoor positioning results saves the mobile phone performance occupancy, reduces the difficulty of software positioning development, and improves the user experience.
[0010] To achieve the above technical effects, the technical solutions adopted in this application are as follows:
[0011] A multi-source interactive navigation method for seamless indoor and outdoor switching of mobile phone positioning, which fuses multi-source observation data for scene judgment, realizes seamless and stable positioning through multi-mechanism interactive positioning, and constructs a seamless positioning software framework for multi-source interaction on this basis:
[0012] One is a seamless positioning method that integrates three positioning mechanisms: GNSS positioning, WIFI / geomagnetic position fingerprint matching, and PDR positioning; the second is to obtain GNSS / base station / light / geomagnetism / barometric pressure multi-source sensor observation data provided by smartphones, establish an indoor and outdoor scene judgment method based on multi-source fusion, and based on the scene judgment results, combine the characteristics of different positioning methods to construct a seamless positioning switching method to achieve seamless and stable positioning in different indoor and outdoor scenarios; the third is to solve the problems of multi-source data acquisition and time synchronization of GNSS / differential enhancement information / MEMS / magnetometer / base station / barometer based on the software and hardware of mobile intelligent terminals, efficient hybrid programming of C / C++ and Java under the JNI mechanism, and secondary development of the Amap SDK, and build a software framework for multi-source fusion seamless positioning.
[0013] 1) Adopt a seamless positioning technical solution that combines GNSS positioning, multi-source fusion position fingerprint matching, and PDR positioning, based on two fusion positioning methods: weighted average and estimated optimal filtering;
[0014] 2) Based on the characteristics and variation laws of GNSS satellite numbers, base station signal strengths, light intensities, magnetic intensities, and barometric pressure data in different indoor and outdoor scenarios, establish a multi-mode fusion scene judgment method with low energy consumption, fast response, and high accuracy. Then, based on the real-time scene judgment results, solve the positioning trigger problem and switching decision problem respectively, construct a scene-based seamless positioning switching method, realize outdoor GNSS / PDR combined positioning based on EKF, and adopt a fusion switching method to realize seamless positioning switching between indoor and outdoor;
[0015] 3) Multi-source interactive seamless positioning software architecture based on mobile phones: Divided into 6 modules: data storage, data acquisition, positioning solution, scene judgment, positioning switching, and result display. Combine the software and hardware of mobile terminals to establish a multi-source interactive seamless positioning work process, and design three key technologies for the problems of difficult data synchronization, low positioning solution efficiency, and complex indoor positioning implementation: data acquisition and time synchronization based on thread pools, GNSS / PDR positioning solution with C / C++ and Java hybrid programming under the JNI mechanism, and indoor positioning based on secondary development of the Amap positioning SDK to optimize software performance and positioning effects.
[0016] Preferably, for multi-mode fusion scene judgment: First, according to the real-time data of various sensors of the mobile terminal, judge the scene module by module and give the indoor confidence level P m and outdoor confidence level P n , and then sum the indoor confidence levels P m of each module to obtain the total indoor confidence level P i , and sum the outdoor confidence levels P n of each module to obtain the total indoor confidence level P o, finally compare P i and P o . When P i is greater than P o , it is determined that the user is in an indoor scene. When P o is greater than P i , it is determined that the user is in an outdoor scene;
[0017] Scene judgment for multi - mode fusion includes: 1) Adopt the dynamic weight method instead of assigning fixed weights to each scene judgment module. Increase the weight of the light module on sunny days and decrease its weight on rainy days; 2) The air pressure module does not respond promptly to scene switching. Especially for floor switching, it is not directly applied to the multi - mode fusion method; 3) In the indoor - outdoor transition area, there is no obvious boundary in the real physical visible scene, and it is more difficult to set the judgment threshold between the outdoor, indoor, and transition areas in the corresponding scene judgment. It only shows a changing trend in judgment data, and seamless positioning switching is performed based on this changing trend;
[0018] The scene judgment of seamless positioning switching realizes positioning triggering and assists in adjusting the weights of different positioning methods during the fusion - type switching process.
[0019] Preferably, the seamless switching method based on the scene: Summarize the problems faced in positioning switching into positioning triggering problems and switching decision problems. Among them, the triggering problem solves the problem of under what conditions the user activates the corresponding positioning method, and the switching decision problem is aimed at which positioning method the user should adopt and how to carry out the fusion of multiple positioning results;
[0020] Solve the switching decision problem: Rely on the positioning results of various positioning methods obtained by the user. When the user obtains two or more positioning results, get the positioning results of GNSS and PDR outdoors, and get the positioning results of GNSS, PDR, and indoor positioning in the indoor - outdoor transition area. The program performs autonomous switching and fusion, performs data fusion on multiple positioning results, realizes the soft switching of the mutual fusion of different positioning mechanisms. In addition, take the fusion result of GNSS and PDR as the only result of the outdoor positioning method output to reduce the complexity of data fusion, and take the indoor positioning result provided by the positioning SDK as the only result of indoor positioning output. Only fuse the above two result data during the seamless switching between indoor and outdoor.
[0021] Preferably, the combined positioning of GNSS and PDR: Based on the extended estimation optimal filter, correct the GNSS positioning result based on PDR to achieve continuous seamless positioning in the outdoor area;
[0022] At the beginning of positioning, the initial position value is determined according to the GNSS positioning result. During the subsequent positioning process, PDR is used for calculation, and EKF is adopted to fuse PDR and GNSS. The error calculated by PDR constitutes the system state vector, as shown in Equation 1:
[0023] X = [dN, dE, ds, dα] Equation 1
[0024] Among them, [dN, dE] is the position error, ds is the moving distance error, and dα is the heading angle error. At the same time, when the GNSS positioning result is updated, the difference between it and the PDR calculation result is used as the observation vector, as shown in Equation 2:
[0025]
[0026] In the formula, is the solution result of GNSS positioning at time k, is the calculation result of PDR positioning at time k. Then, the state equation of EKF is constructed, as shown in Equation 3:
[0027]
[0028] According to the above formulas, the state transition matrix and the observation matrix are determined. After determining the noise sequence by empirical values, the optimal estimated value of the optimal filter after fusing GNSS and PDR is obtained;
[0029] When GNSS cannot perform positioning, the system fusion prediction value of the previous epoch is used to replace the GNSS positioning result, and the difference between it and the PDR calculation result is used as the observation vector to continue the EFK estimation process to achieve continuous positioning under full occlusion conditions.
[0030] Preferably, for indoor-outdoor fusion switching: outdoors, a combined positioning method of GNSS and PDR is adopted, and indoors, the positioning result provided by Amap SDK based on location fingerprint matching is used. There is a natural gap between the two. This application adopts a weighted fusion filtering method with dynamically adjusted weights, and at the same time uses distance constraints to control errors to achieve the fusion of the two result data;
[0031] When the user transitions from outdoors to indoors, the scene judgment module gives an indoor judgment result, and indoor positioning is enabled. At this time, there is not only the indoor positioning result, but also the positioning result of outdoor GNSS fused with PDR. And it is considered that the latter result is reliable in a short time. A distance critical value δS is given. When the absolute value |ΔS| of the distance between the above two results is less than δS, first, weighted average fusion is performed with the outdoor positioning as the heavy-weight party, as shown in Equation 4, is the outdoor positioning result at time k, The indoor positioning result at time k, where w1 and w2 are the weights of the two respectively. When the weighted average fusion condition is first met, w1 is given as 9 and w2 as 1. In each subsequent epoch, w1 decreases by 1 and w2 increases by 1 until w1 = 0, at which point it fully switches to indoor positioning;
[0032]
[0033] When the user transitions from indoor to outdoor, the scene judgment module gives an outdoor judgment result, and outdoor positioning is enabled. Indoors, PDR is not fused, and only the switching between indoor Amap positioning results and GNSS positioning is considered. Different from the transition from outdoor to indoor, once GNSS positioning is successful, it will quickly converge, and the positioning accuracy is significantly better than the indoor positioning results in this transition area. Only using the distance constraint as the judgment criterion, weighted average fusion is no longer performed. At this time, the meaning of ΔS is the difference in GNSS positioning results between two consecutive epochs, and the judgment threshold is δS G , that is, when the GNSS positioning result converges to |ΔS| < δS G , independent positioning is recognized, and the indoor positioning function is turned off;
[0034] In addition, during the indoor-outdoor handover process, when PDR identifies that the user is in a stationary state, the handover logic will pause execution and resume when the user starts moving, to avoid positioning errors caused by premature handover when the user hesitates in the transition area.
[0035] Preferably, the overall architecture of the seamless positioning software: Based on the mobile phone platform and some external devices, and using the Amap SDK, a mass pedestrian positioning software that integrates GNSS positioning, pedestrian dead reckoning, and indoor positioning is established. At the same time, using scene judgment information, a fusion switching method is adopted to solve the smooth connection problem between different positioning mechanisms, and finally, seamless docking of indoor and outdoor positioning and visual presentation of positioning results are achieved;
[0036] After obtaining multi-source observation information through various channels, the data is encoded, synchronized, and transmitted for unified processing. And through the JNI mechanism, differential GNSS and PDR calculations and their fusion based on EKF are realized. The indoor positioning result is obtained using the Amap positioning SDK. At the same time, scene judgment is realized according to multi-source data such as the number of satellites, base station signal strength, light intensity, magnetic intensity, and air pressure, and multi-mechanism collaborative seamless processing in different indoor and outdoor scenarios is realized based on the results of scene judgment. Finally, the positioning result is output and displayed on the Amap.
[0037] Preferably, the module settings of the seamless positioning system: Use a smart phone as the client, and modularize the software according to specific logic, which is divided into 6 modules: data storage, data acquisition, positioning calculation, scene judgment, positioning handover, and result display;
[0038] Data storage module: Save user parameters, read configuration files, and record multi-source data. User parameters refer to the set values when users use the software, including the positioning mode; the configuration file gives the state variables and data feature descriptions required for positioning calculation; save the multi-source data to the mobile phone SD card file for subsequent processing and analysis improvement by the PC side;
[0039] Data acquisition module: Real-time acquisition of various data information including GNSS raw observation data, differential enhancement information, Amap positioning data, accelerometer / magnetometer / gyroscope / barometer data, WiFi / Bluetooth signals, and base station signals, complete the encoding, synchronization, and transmission of the above data, and achieve time synchronization of multi-source data;
[0040] Positioning calculation module: Include GNSS positioning calculation, PDR calculation, and their fusion positioning based on EKF, and use JNI for efficient positioning calculation;
[0041] Scene judgment module: According to the GNSS data, base station signals, ambient light intensity, magnetic field characteristics, and air pressure changes provided by the data acquisition module, use the multi-mode fusion scene judgment method to achieve indoor and outdoor scene judgment. The scene judgment results given by this module will be applied to the positioning switching module to cooperate with the positioning trigger and fusion weight determination in different indoor and outdoor scenes;
[0042] Positioning switching module: Use the fusion switching method to achieve positioning switching between indoor and outdoor feature scenes;
[0043] Result display module: Include the presentation of indoor and outdoor maps, and the display of positioning results and status parameters.
[0044] Preferably, multi-source data acquisition and time synchronization: The data used includes: GNSS observation data from the Bluetooth module, GNSS differential enhancement information from the network, indoor positioning data from the Amap positioning SDK, MEMS / air pressure / light intensity / magnetic intensity from the mobile phone sensor, and base station data. They not only have different sources but also have their own independent acquisition frequencies and encoding methods. In different threads, collect and encode data according to the corresponding frequencies respectively, and perform time synchronization processing on these data according to the requirements of positioning calculation;
[0045] Create a ScheduledThreadPool through newcheduledThreadPool(), and use the method modified by the synchronized keyword to synchronize the threads to ensure the uniqueness and accuracy of variables;
[0046] The thread pool design for data acquisition and time synchronization has a total of seven sub-threads, including six data acquisition threads: GnssTask, RTCMTask, SensorTask, BaiDuTask, GSMTask, and ReplayTask, and one positioning calculation thread: PositionTask. GnssTask controls reading GNSS data from an external Bluetooth device once per second. RTCMTask controls grabbing differential enhancement information from a network port once per second. SensorTask controls reading MEMS / magnetometer / barometric pressure / light intensity sensor data every 10 ms. BaiDuTask controls obtaining the Amap indoor positioning result once per second. GSMTask controls obtaining base station data once per second. ReplayTask controls reading a data file and performing post-event calculations. PositionTask aggregates all valid data within one second and completes scene judgment and positioning calculation based on this data;
[0047] Use scheduleAtFixedRate(Runnable task, long initialDelay, long period, TimeUnit unit) to execute a certain Task task at a fixed frequency (1000 / period Hz) after a delay of initialDelay. By setting initialDelay and period, synchronization of multi-source data is achieved, avoiding fusion positioning errors caused by time deviation during positioning data fusion.
[0048] Preferably, the programming steps for implementing positioning calculation using JNI are as follows:
[0049] The first step: Define a native method in Java. The native method uses a method in an interface and only has a method declaration, which is directly called by Java and is specifically implemented by C / C++.
[0050] The second step: Use the javah command in the command console to generate a.h header file. Create a jni folder in the project root directory and copy the header file into it. The javah command statement first locates to the src directory of the project, then enters "javah +'space'+ package name.class name", and finally generates the header file;
[0051] The third step: Write the required.c file in the jni folder to implement the native method. Introduce the generated.h file in the.c file. The.h file automatically generates a method declaration that conforms to the JNI specification. Just copy the method declaration into the.c file and call the C / C++ function in this method declaration to implement the corresponding function;
[0052] Step 4: Create a mobile.mk file in the jni folder, define the name of the dynamic library, load the C / C++ code files and the corresponding.h file names. When using JNI and the Amap SDK at the same time, create a prebuilt file in the jni directory, copy the SDK into it, and make corresponding explanations in the mobile.mk file;
[0053] Step 5: Create an Application.mk file and declare the supported platforms;
[0054] Step 6: Compile to generate the so dynamic link library file;
[0055] Step 7: Load the.so class library in the Java code. When using it, directly call the local native method.
[0056] Preferably, indoor positioning is implemented based on the Amap Location SDK. The specific steps are as follows:
[0057] Step 1: Register and obtain the secret key: First, log in (need to register) to the Amap Map Open Platform, enter the API console, create an application and enter the AK application window. After filling in the application name, selecting the application type, and configuring the SHA1 and package name, click Submit to generate the AK. When using the mobile location SDK and the mobile map SDK in the same project, use the same AK, and view, modify, and delete the created AK in the API console;
[0058] Step 2: Add the SDK (jar and so) to the mobile project: Developers can enter the Amap mobile SDK download platform, combine their own needs, customize and select services, and package and download the selected function development package. After downloading, place the jar and so in the libs into the corresponding positions in the project. The so files include multiple CPU architectures, and developers can choose according to their needs;
[0059] Step 3: Add the AK applied in Step 1 and declare the service component in the Application tag of the mobile Manifest.xml file, and add relevant permissions in this file at the same time;
[0060] Step 4: Initialize the LocationClient and configure the SDK parameters: Declare a LocationClient class object in the main thread and pass in a Context type parameter. Use the getApplicationConext() method to obtain a Context that is valid for the entire process. Subsequently, through the SDK positioning parameter configuration, set the positioning mode, return the longitude and latitude coordinate type, and the positioning request interval;
[0061] Step 5: Implement the BDAbstractLocationListener interface to obtain the longitude and latitude: Use the Abstract type listening interface BDAbstractLocationListener to implement location monitoring. This interface asynchronously obtains the location result. Subsequently, the developer initiates location through mLocationClient.start() and obtains the location result information from the BDAbstractLocationListener listening interface.
[0062] Compared with the prior art, the innovation points and advantages of this application are as follows:
[0063] (1) This application integrates multi-source observation data for scenario judgment, and realizes seamless and stable positioning through multi-mechanism interactive positioning. On this basis, a seamless positioning software framework for multi-source interaction is constructed. First, a seamless positioning method that integrates three positioning mechanisms: GNSS positioning, WIFI / geomagnetic position fingerprint matching, and PDR positioning, is adopted. Second, obtain the multi-source sensor observation data of GNSS / base station / light / geomagnetism / barometer provided by the smart phone, establish an indoor and outdoor scenario judgment method based on multi-source fusion, and based on the scenario judgment result, combine the characteristics of different positioning methods to construct a seamless switching method for positioning, so as to achieve seamless and stable positioning in different indoor and outdoor scenarios. Third, solve the problems of multi-source data acquisition and time synchronization of GNSS / differential augmentation information / MEMS / magnetometer / base station / barometer, efficient hybrid programming of C / C++ and Java under the JNI mechanism, and secondary development of the Amap SDK based on the software and hardware of the mobile phone intelligent terminal, and build a software framework for seamless positioning with multi-source fusion. In terms of positioning effect, the software can ensure a scenario judgment accuracy rate of more than 90%, and can continuously locate outdoors (including fully blocked areas), and can ensure seamless and smooth transition when switching between indoor and outdoor scenarios. In terms of performance, the software has good compatibility and normal functions among different models of mobile phones, runs stably, the average time error of data synchronization acquisition is 0ms, the positioning calculation time for a single epoch is within 25ms, and the CPU occupancy rate, memory occupancy rate, traffic consumption, and power consumption are all maintained at a low level. Seamless switching between indoor and outdoor for the general public pedestrians is realized based on the mobile phone terminal.
[0064] (2) This application realizes scene judgment based on multi-source data (GNSS / base station / optical fiber / geomagnetism / barometric pressure), improving the accuracy and reliability of scene judgment; the scene judgment results assist seamless positioning switching, solving the positioning trigger problem and handover decision problem, reducing the power consumption of the mobile phone while avoiding repeated switching in the scene transition area; indoor-outdoor fusion switching effectively utilizes data information to achieve smooth switching while ensuring more accurate and stable switching; using a thread pool to control data acquisition and processing can achieve real-time synchronization while reasonably occupying the mobile phone's CPU; adopting a hybrid programming of C / C++ and Java under the JNI mechanism improves the GNSS / PDR positioning and calculation efficiency, breaking through the limitations of the mobile phone's own processing ability; using Amap and indoor positioning results saves the mobile phone performance occupancy, reduces the difficulty of software positioning development, and improves the user experience.
[0065] (3) This application realizes seamless full coverage of pedestrian positioning. Using GNSS satellite positioning technology, location fingerprint positioning technology, and PDR as means, it realizes positioning in different scenarios; effectively utilizes multi-source observation data and judgment information to achieve smooth transition and seamless connection between different positioning mechanisms and different positioning scenarios; based on the mobile phone terminal and combined with the Amap SDK, it realizes the overall design and development of seamless positioning software. For the positioning needs of the general public, a multi-source interactive seamless positioning software is designed based on the mobile phone terminal, integrating GNSS and PDR positioning technologies outdoors; using the location fingerprint matching positioning results provided by the Amap positioning SDK indoors; comprehensively using multi-source observation information for scene judgment in the indoor-outdoor transition area, and accordingly performing centralized filtering on various positioning results to achieve seamless switching. The technical solution of this application has the characteristics of low cost, easy to carry, high precision, full coverage, and seamless continuity. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Figure 1 It is a flowchart of the indoor-outdoor scene judgment method for multi-mode fusion.
[0067] Figure 2 It is a schematic diagram of the indoor-outdoor scene area division.
[0068] Figure 3 It is a schematic diagram of the seamless switching strategy based on the scene.
[0069] Figure 4 It is an architecture diagram of the indoor-outdoor seamless positioning software.
[0070] Figure 5 It is a schematic diagram of the thread pool design for data acquisition and time synchronization.
[0071] Figure 6 It is a schematic diagram of the multi-thread task loading code in the thread pool.
[0072] Figure 7It is a schematic diagram of part of the code in the.h header file.
[0073] Figure 8 It is a schematic diagram of the code for adding AK, service, and positioning permissions.
[0074] Figure 9 It is a code example diagram for SDK positioning parameter configuration.
[0075] Figure 10 It is a diagram of the Bluetooth list and file list interfaces in the map interface of the software.
[0076] Figure 11 It is a diagram of the analysis results of data acquisition delay and time synchronization effect.
[0077] Figure 12 It is a schematic diagram of the comprehensive test results of mobile phone power consumption. Specific implementation manners
[0078] Next, in combination with the accompanying drawings, the technical solutions of the indoor and outdoor seamless switching multi-source interactive navigation method for mobile phone positioning provided by this application will be further described, so that those skilled in the art can better understand this application and be able to implement it.
[0079] With the popularization of smart phones, the rapid development of mobile Internet, and the continuous maturity of navigation technology means, location-based service (LBS) has become a basic need in people's production and life. Indoor and outdoor seamless positioning can provide continuous location services for users and has gradually become a research hotspot in current navigation and positioning technologies. At present, the matching of GNSS in outdoor areas and location fingerprints in indoor areas can already obtain good positioning effects in outdoor and indoor scenarios. However, in the indoor-outdoor connection area and severely blocked outdoor areas, using a single GNSS or indoor positioning method cannot achieve continuous and stable positioning.
[0080] Currently, smart terminals are equipped with a variety of sensors, have powerful computing performance, and the emergence of various open resources such as Amap provides software and hardware support for the research of seamless positioning and continuous LBS. Therefore, how to fuse multi-source observation data for scene judgment, and use multi-mechanism interactive positioning to achieve seamless and stable positioning. On this basis, a seamless positioning software framework for multi-source interaction is constructed, and the specific content includes the following points:
[0081] 1) One is to adopt a seamless positioning method that integrates three positioning mechanisms: GNSS positioning, WIFI / geomagnetic location fingerprint matching, and PDR positioning;
[0082] 2) Obtain the GNSS / base station / light / magnetic field / barometric multi-source sensor observation data provided by the smart phone, establish an indoor and outdoor scene judgment method based on multi-source fusion, and according to the scene judgment result, combine the characteristics of different positioning methods to construct a positioning seamless switching method to achieve seamless and stable positioning in different indoor and outdoor scenes;
[0083] 3) Based on the software and hardware of the mobile phone intelligent terminal, solve the problems of multi-source data acquisition and time synchronization of GNSS / differential enhancement information / MEMS / magnetometer / base station / barometer, efficient hybrid programming of C / C++ and Java under the JNI mechanism, and secondary development of the Amap SDK, and build a software framework for multi-source fusion seamless positioning.
[0084] Through the indoor and outdoor seamless positioning test, in terms of positioning effect, the software can ensure a scene judgment accuracy rate of more than 90%, and can continuously locate outdoors (including fully occluded areas) and ensure seamless and smooth transition during indoor and outdoor scene switching. In terms of performance, the software has good compatibility and normal functions among different models of mobile phones, runs stably, the average time error of data synchronization acquisition is 0ms, the positioning solution time for a single epoch is within 25ms, and the CPU occupancy rate, memory occupancy rate, traffic consumption and power consumption are all maintained at a low level. Generally, the goal of the indoor and outdoor seamless switching and multi-source interactive positioning software design based on the mobile phone terminal is achieved.
[0085] I. Positioning Scene Judgment and Seamless Switching Method
[0086] (1) Scene Judgment of Multi-Mode Fusion
[0087] Through the analysis of the data characteristics of different sensors, due to being seriously affected by environmental factors, it is difficult to use a single sensor to give an accurate indoor and outdoor scene judgment result. This application fuses and utilizes the multi-sensor data including GNSS, base station, light sensor, and magnetometer in the mobile phone, and modularizes the indoor and outdoor scene judgment method. Finally, according to the confidence levels of the indoor and outdoor judgment results obtained by each module, an indoor and outdoor scene judgment method with low energy consumption, fast response, and high accuracy is realized. The process of the indoor and outdoor scene judgment method of multi-mode fusion is as Figure 1 shown.
[0088] First, according to the real-time data of various sensors of the mobile phone terminal, the scene is judged module by module, and the indoor confidence level P m and the outdoor confidence level P n of each judgment result are given. Then, the indoor confidence levels P m of each module are summed to obtain the total indoor confidence level P i , and the outdoor confidence levels P n of each module are summed to obtain the total indoor confidence level P o, finally compare P i and P o . When P i is greater than P o , it is determined that the user is in an indoor scene. When P o is greater than P i , it is determined that the user is in an outdoor scene;
[0089] Scene judgment for multi - mode fusion includes: 1) Using a dynamic weight method instead of assigning fixed weights to each scene judgment module. Increase the weight of the light module during sunny days and decrease its weight during rainy days; 2) The barometric pressure module does not respond promptly to scene switching. Most importantly, for floor switching, it is not directly applied to the multi - mode fusion method, but the role of the barometer in scene switching judgment in some special cases is not excluded, such as when entering a building by taking an observation elevator; 3) In the indoor - outdoor transition area, there is no obvious boundary in the real physical visible scene, and it is more difficult to set the judgment threshold between the outdoor, indoor, and transition areas in the corresponding scene judgment. It only shows a changing trend in judgment data, and seamless positioning switching is performed based on this changing trend.
[0090] The scene judgment of seamless positioning switching realizes positioning triggering, such as triggering indoor positioning; during the fusion - type switching process, assist in adjusting the weights of different positioning methods.
[0091] (2) Seamless switching of scene judgment and positioning fusion
[0092] 1. Differences in positioning scenes and positioning mechanisms
[0093] For example Figure 2 shows typical scene classifications in navigation applications, including outdoor scenes, indoor scenes, and indoor - outdoor transition areas. The signal differences in each positioning scene determine their respective corresponding positioning mechanisms. GNSS positioning is mainly used outdoors, indoor positioning can be achieved by using location fingerprint matching, and positioning in the transition area can be assisted by PDR. However, GNSS, indoor positioning, and PDR are applicable to different scenes, and no single positioning method can meet the requirements of global and seamless positioning. Therefore, it is necessary to fuse multi - source observation data on the mobile phone side and coordinate multi - mechanism positioning technologies, that is, mainly use GNSS positioning for outdoor positioning, mainly use location fingerprint matching for indoor positioning, use PDR to assist outdoor positioning and assist in realizing indoor - outdoor switching.
[0094] Combined with the differences in positioning scenarios and positioning mechanisms, the seamless positioning method of this application is as follows: outdoors, GNSS is mainly used and PDR is supplemented for integrated positioning. In open areas, GNSS is used to train PDR, and in occluded areas, PDR is used to achieve continuous positioning; indoors, the indoor positioning results provided by the positioning SDK are directly used, and these results are fused with the data of WiFi, Bluetooth, geomagnetism, MEMS, and barometer sensors and obtained based on the location fingerprint matching technology, with relatively high accuracy and reliability; in the indoor-outdoor transition area, centralized filtering is performed on GNSS, PDR, and location fingerprint matching to give full play to the advantages of PDR and assist in achieving a smooth transition between outdoor positioning and indoor positioning.
[0095] 2. Seamless Switching Method Based on Scenario
[0096] Traditional positioning switching usually does not consider real-world scenario problems. Instead, it comprehensively obtains positioning source data and performs positioning calculations, and finally makes a hard switch based on the result data that can be obtained. This tentative positioning switching method means that while performing positioning in mode A, it attempts to perform positioning in mode B. If the positioning in mode B fails, it continues to use the single mode A for positioning. If the positioning in mode B is successful, it decides whether to switch to mode B based on the positioning situation. In this way, not only will it cause waste of mobile phone resources due to continuous tentative positioning, but there is also a problem of fuzzy switching areas. For example, in the front square area, there may be both normal outdoor positioning results and indoor positioning results. At this time, if there is no good positioning accuracy evaluation measure, blind switching is likely to cause a large positioning error.
[0097] Based on the scenario judgment results, this application establishes a new seamless positioning switching method to solve the problems existing in the traditional positioning switching process. The problems faced in positioning switching are summarized as positioning trigger problems and switching decision problems. Among them, the trigger problem solves the problem of under what conditions the user enables the corresponding positioning method, and the switching decision problem is aimed at which positioning method the user should adopt and how to carry out the fusion of multiple positioning results. As Figure 3 , the schematic diagram of the seamless switching strategy based on the scenario is given;
[0098] The positioning trigger depends on the scenario judgment results, which is also the purpose of scenario judgment. PDR always runs with the software enabled, and GNSS positioning and indoor positioning are selectively enabled according to scenario differences. Such a design can not only save energy consumption and reduce the load on the mobile phone (the scanning of Bluetooth and WiFi is a high-energy-consuming process), but also avoid the instability of positioning results caused by frequent switching of positioning methods in the scenario transition area, and at the same time reduce the positioning deviation in the area near indoor windows;
[0099] Solving the handover decision problem: Depending on the positioning results obtained by various positioning methods by the user, when the user obtains two or more positioning results, GNSS and PDR positioning results are obtained outdoors, and GNSS, PDR, and indoor positioning results are obtained in the indoor-outdoor transition area. The program needs to perform autonomous handover and fusion, perform data fusion on multiple positioning results, effectively utilize resources, improve the reliability of the positioning results, and achieve soft handover of mutual fusion of different positioning mechanisms. In addition, the fusion result of GNSS and PDR is output as the only result of the outdoor positioning method to reduce the complexity of data fusion, and the indoor positioning result provided by the positioning SDK is output as the only result of indoor positioning. Only the above two result data are fused during the seamless handover between indoors and outdoors.
[0100] 3. GNSS and PDR Combined Positioning
[0101] According to the extended estimation optimal filter, correct the GNSS positioning result based on PDR to achieve continuous seamless positioning in the outdoor area;
[0102] At the start of positioning, determine the initial position value according to the GNSS positioning result. During the subsequent positioning process, perform PDR calculation, and use EKF to fuse PDR and GNSS. The error calculated by PDR constitutes the system state vector, as shown in Equation 1:
[0103] X = [dN, dE, ds, dα] Equation 1
[0104] Where, [dN, dE] is the position error, ds is the moving distance error, dα is the heading angle error. At the same time, when the GNSS positioning result is updated, use the difference between it and the PDR calculation result as the observation vector, as shown in Equation 2:
[0105]
[0106] In the formula, is the solution result of GNSS positioning at time k, is the calculation result of PDR positioning at time k. Then, construct the state equation of EKF, as shown in Equation 3:
[0107]
[0108] According to the above equations, determine the state transition matrix and the observation matrix. After determining the noise sequence by empirical values, obtain the optimal estimated value of the optimal filter after the fusion of GNSS and PDR;
[0109] When GNSS cannot be positioned, use the system fusion prediction value of the previous epoch to replace the GNSS positioning result, calculate the difference between it and the PDR calculation result as the observation vector, and continue the EFK estimation process to achieve continuous positioning under full occlusion conditions.
[0110] 4. Indoor-outdoor integrated switching
[0111] Outdoors, a combined positioning method of GNSS and PDR is adopted. Indoors, the positioning result provided by Amap SDK based on location fingerprint matching is used. There is a natural gap between the two. This application adopts a weighted fusion filtering method with dynamically adjusted weights, and at the same time uses distance constraints to control errors to achieve the fusion of the two result data;
[0112] When the user transitions from outdoors to indoors, the scene judgment module gives an indoor judgment result, and indoor positioning is enabled. At this time, there is not only the indoor positioning result, but also the positioning result of outdoor GNSS fused with PDR (which may only be the PDR inference). It is considered that the latter result is reliable within a short period of time. A distance threshold δS is given. When the absolute value of the distance |ΔS| between the above two results is less than δS, first, weighted average fusion is performed with the outdoor positioning as the weighted party, as shown in Equation 4, is the outdoor positioning result at time k, is the indoor positioning result at time k. w1 and w2 are the weights of the two respectively. When the weighted average fusion condition is first met, w1 = 9 and w2 = 1 are given. At each subsequent epoch, w1 decreases by 1 and w2 increases by 1 until w1 = 0, at which point it completely switches to indoor positioning;
[0113]
[0114] When the user transitions from indoors to outdoors, the scene judgment module gives an outdoor judgment result, and outdoor positioning is enabled. There is no fused PDR indoors. Only the switching between indoor Amap positioning results and GNSS positioning is considered. Different from the transition from outdoors to indoors, once GNSS positioning is successful, it will quickly converge, and the positioning accuracy is significantly better than the indoor positioning results in this transition area. Only the distance constraint is used as the judgment criterion, and weighted average fusion is no longer performed. At this time, the meaning of ΔS is the difference in GNSS positioning results between two consecutive epochs, and the judgment threshold is δS G , that is, the GNSS positioning result converges to |ΔS| < δS G When this occurs, independent positioning is recognized and the indoor positioning function is turned off;
[0115] In addition, during the indoor-outdoor switching process, when PDR identifies that the user is in a stationary state, the switching logic will pause execution and continue when the user starts moving, so as to avoid positioning errors caused by premature switching when the user hesitates in the transition area.
[0116] II. Multi-source interactive seamless positioning method based on mobile phone
[0117] (1) Overall architecture of seamless positioning software
[0118] Based on the mobile phone platform and some external devices, and using the Amap SDK, a mass pedestrian positioning software that integrates GNSS positioning, pedestrian dead reckoning, and indoor positioning is established. At the same time, using scene judgment information, a fusion switching method is adopted to solve the smooth connection problem between different positioning mechanisms, and finally seamless docking of indoor and outdoor positioning and visualization of positioning results are achieved. As Figure 4 , it is the software architecture design diagram.
[0119] After obtaining multi-source observation information through various channels, the data is uniformly processed for encoding, synchronization, and transmission. And through the JNI mechanism, differential GNSS and PDR solutions are implemented, as well as the fusion of the two based on EKF. The indoor positioning result is obtained using the Amap positioning SDK. At the same time, scene judgment is realized according to multi-source data such as the number of satellites, base station signal strength, light intensity, magnetic intensity, and air pressure. And combined with the results of scene judgment, multi-mechanism collaborative seamless processing in different indoor and outdoor scenarios is realized. Finally, the positioning result is output and displayed on the Amap.
[0120] The software not only conducts GNSS / PDR fusion positioning solution based on the mobile phone platform to obtain the indoor positioning result and sets a reasonable indoor and outdoor positioning switching method, but also specifically solves the following problems: improving the software architecture design to achieve stability; realizing synchronization based on multi-threaded data acquisition; and achieving high efficiency through mixed programming of C / C++ and Java under the JNI mechanism.
[0121] (2) Seamless positioning system module settings
[0122] A smart phone is used as the client, and the software is modularly designed according to specific logic, which is divided into 6 modules: data storage, data acquisition, positioning solution, scene judgment, positioning switching, and result display.
[0123] Data storage module: Save user parameters, read configuration files, and record multi-source data. User parameters refer to the set values when the user uses the software, including the positioning mode; the configuration file gives the state quantities required for positioning solution (such as the satellite cutoff elevation angle) and data feature descriptions (such as identifiers used to distinguish different data); save the multi-source data to the mobile phone SD card file for convenient post-processing and analysis improvement by the PC side;
[0124] Data acquisition module: Real-time collect various data information including GNSS raw observation data, differential enhancement information, Amap positioning data, accelerometer / magnetometer / gyroscope / barometer data, WiFi / Bluetooth signals, and base station signals, complete the encoding, synchronization, and transmission of the above data, and realize the time synchronization of multi-source data;
[0125] Positioning solution module: Include GNSS positioning solution, PDR calculation, and fusion positioning of the two based on EKF, and use JNI for efficient positioning solution;
[0126] Scene judgment module: According to the GNSS data, base station signals, ambient light intensity, magnetic field characteristics, and air pressure changes provided by the data acquisition module, using a multi-modal fusion scene judgment method to achieve indoor and outdoor scene judgment. The scene judgment results given by this module will be applied to the positioning switching module to cooperate in completing positioning triggering and fusion weight determination under different indoor and outdoor scenarios.
[0127] Positioning switching module: Adopts a fusion switching method to achieve positioning switching for indoor and outdoor feature scenes.
[0128] Result display module: Includes the presentation of indoor and outdoor maps, the display of positioning results and status parameters.
[0129] (3) Key technologies for multi-source interactive seamless positioning
[0130] 1. Multi-source data acquisition and time synchronization
[0131] In the process of multi-source data fusion processing, data synchronization must be achieved. Otherwise, directly fusing positioning data at two different times will bring unpredictable positioning deviations.
[0132] The data applied in this application includes: GNSS observation data from the Bluetooth module, GNSS differential enhancement information from the network, indoor positioning data from the Amap positioning SDK, MEMS / air pressure / light intensity / magnetic intensity from the mobile phone sensor, and base station data. They not only have different sources but also have their own independent acquisition frequencies and encoding methods. In different threads, data is collected and encoded at the corresponding frequencies respectively, and time synchronization processing is performed on these data according to the positioning calculation requirements;
[0133] The execution of multiple tasks uses multiple threads. By creating a memory space to solve the problem of multiple-thread execution, multiple threads are stored in this memory space. When a task arrives, a thread is selected from the pool to execute, and after the execution is completed, the thread object is returned to the pool. The entire process is uniformly scheduled and processed by the pool manager;
[0134] Create a ScheduledThreadPool through newcheduledThreadPool(), and use a method modified by the synchronized keyword to synchronize the threads to ensure the uniqueness and accuracy of variables;
[0135] Such as Figure 5ThreadPool design for data acquisition and time synchronization. There are seven sub-threads in the pool, including six data acquisition threads: GnssTask, RTCMTask, SensorTask, BaiDuTask, GSMTask, ReplayTask, and one positioning calculation thread: PositionTask. GnssTask controls reading GNSS data from an external Bluetooth device once per second. RTCMTask controls grabbing differential enhancement information from a network port once per second. SensorTask controls reading MEMS / magnetometer / barometric pressure / light intensity sensor data every 10 ms. BaiDuTask controls obtaining Amap indoor positioning results once per second. GSMTask controls obtaining base station data once per second. ReplayTask controls reading data files and performing post-event calculations. PositionTask aggregates all valid data within one second and completes scene judgment and positioning calculation based on this data.
[0136] Figure 6 The loading code for each thread task in the thread pool is given. Using scheduleAtFixedRate(Runnable task, long initialDelay, long period, TimeUnit unit), a certain Task task is executed at a fixed frequency (1000 / period Hz) after a delay of initialDelay. By setting initialDelay and period, the synchronization of multi-source data is achieved, avoiding the fusion positioning error caused by time deviation during positioning data fusion.
[0137] 2. Implement positioning calculation using JNI
[0138] To achieve the seamless positioning function of multi-source interaction, not only a large amount of data needs to be obtained and preprocessed in real time, but also the positioning result needs to be calculated quickly and effectively (the time consumption should be much less than 1 s), and at the same time, the CPU occupancy rate needs to be reduced. Therefore, the running efficiency of the program must be maximized. Using the mixed programming of C / C++ and Java under the JNI mechanism can improve the software running efficiency, utilize existing resources, and achieve good scalability.
[0139] The programming steps for implementing positioning calculation using JNI are as follows:
[0140] The first step: Define a native method in Java. The native method adopts a method in an interface. There is only a method declaration, which is directly called by Java and specifically implemented by C / C++.
[0141] Step 2: Create a jni folder under the project root directory and copy the.h header file generated by the javah command in the command console. The javah command statement first locates to the src directory of the project, and then enters "javah + 'a space' + package name.class name". The finally generated header file is as Figure 7 shown;
[0142] Step 3: Write the required.c file under the jni folder to implement the native method. Introduce the generated.h file in the.c file. The.h file automatically generates method declarations that conform to the JNI specification. Just copy the method declarations to the.c file and call C / C++ functions in the method declarations to implement the corresponding functions;
[0143] Step 4: Create a Android.mk file in the jni folder and define the name of the dynamic library, load the C / C++ code files and the corresponding.h file names. When using JNI and Amap SDK at the same time, create a prebuilt file in the jni directory, copy the SDK into it, and make corresponding descriptions in the Android.mk file.
[0144] Step 5: Create an Application.mk file to declare the supported platforms;
[0145] Step 6: Compile to generate the so dynamic link library file;
[0146] Step 7: Load the.so class library in the Java code. When using it, directly call the native method;
[0147] During the positioning process, the encoded multi-source data is used as a parameter and transmitted to the interface function in C / C++ by calling the native method. After being converted into a data type that C / C++ can recognize, decoding and subsequent positioning calculations are carried out. At the same time, the positioning results and status parameters are returned through the native method in a data type that Java can recognize. The so dynamic library generated during this process is copied to other programs, and Steps 1 and 7 can be executed to be called in the mobile phone program, with good portability.
[0148] 3. Amap Location SDK and Indoor Location
[0149] The Amap Mobile Location SDK is a set of simple and easy-to-use location service interfaces provided for mobile applications on mobile phones. It can provide multiple location methods such as GPS, base station, WiFi, geomagnetism, Bluetooth, and sensors, and is applicable to various indoor and outdoor location scenarios, with excellent location performance: high positioning accuracy, wide coverage, small network location request traffic, and fast positioning speed. By using the Amap Location SDK, developers can easily perform secondary development and add intelligent, accurate, and efficient location functions to the application.
[0150] Adopt the resources of Amap and Amap Location Open SDK to achieve indoor positioning and solve the problem of map rendering of positioning results. The Amap Location SDK integrates multiple sensors such as WiFi, Bluetooth, geomagnetism, and MEMS in the intelligent terminal in the indoor scenario, uses location fingerprint matching as a means, and combines machine learning to achieve accurate and continuous positioning.
[0151] Based on the Amap Location SDK to achieve indoor positioning, following the standard development process of SDK application, the specific steps are as follows:
[0152] Step 1: Register and obtain the secret key: First, log in (need to register) the Amap Open Platform, enter the API console, create an application and enter the AK application window. After filling in the application name, selecting the application type, and configuring the SHA1 and package name, click Submit to generate the AK. When using the mobile location SDK and the mobile map SDK in the same project, use the same AK, and view, modify, and delete the created AK in the API console;
[0153] Step 2: Add the SDK (jar and so) to the mobile project: Developers can enter the Amap mobile SDK download platform, combine their own needs, customize and select services, and package and download the selected function development package. After downloading, place the jar and so in the libs into the corresponding positions in the project, which contains so files of multiple CPU architectures, and developers can select according to their needs;
[0154] Step 3: Add the AK applied in Step 1 and declare the service component in the Application tag of the mobile Manifest.xml file, and at the same time add relevant permissions in this file, such as Figure 8 as shown;
[0155] Step 4: Initialize LocationClient and configure the SDK parameters: Declare an object of the LocationClient class in the main thread and pass in a Context type parameter (use the getApplicationConext() method to obtain a Context that is valid for the entire process). Example of the core code segment, and then configure the SDK positioning parameters to set the positioning mode, return the longitude and latitude coordinate type, and the positioning request interval. Example of the parameter configuration code is as Figure 9 ;
[0156] Step 5: Implement the BDAbstractLocationListener interface to obtain longitude and latitude: Use the abstract listener interface BDAbstractLocationListener to implement location monitoring. This interface asynchronously obtains location results. Subsequently, the developer initiates location through mLocationClient.start() and obtains location result information from the BDAbstractLocationListener monitoring interface.
[0157] III. Software Testing and Result Analysis
[0158] It is implemented based on the mixed programming of C / C++ and Java under the JNI mechanism on the mobile phone platform. The realization of seamless positioning depends on certain hardware support, and at the same time, corresponding permission requirements and running conditions must be met;
[0159] During the development process, the packages and classes in the project are divided, and the definitions of each package are as follows:
[0160] 1) The com.whu.pednv class package contains the project's Activities, including the installation guide interface, Splash interface, map interface, and settings interface, which are responsible for human-computer interaction. At the same time, a class with the function of an execution thread pool is set up to coordinate the operation of each thread and manage all data, and is responsible for the call of data reading functions, scene judgment functions, and positioning calculation functions;
[0161] 2) The com.whu.pednv.file class package is an operation class for data files, including data writing to files and reading file lists;
[0162] 3) The com.whu.pednv.gnss class package is used to obtain GNSS data, including obtaining the data stream of an external receiver through Bluetooth and obtaining the differential enhancement information data stream of the cloud platform through the network;
[0163] 4) The com.whu.pednv.indoorview class package is related to indoor maps based on the Amap Demo;
[0164] 5) The com.whu.pednv.location class package contains location-related classes, obtains the location results of Amap, the location results of the mobile phone system, and calls the dynamic link library to implement GNSS / PDR calculation;
[0165] 6) The com.whu.pednv.sensor class package contains function classes for reading various sensor data, including accelerometers, gyroscopes, magnetometers, barometers, light sensors, and base station signals;
[0166] 7) The com.whu.pednv.utils class package, including utility class files such as constant settings and data type conversions;
[0167] such as Figure 10 They are the Bluetooth list and file list interfaces of the software's map interface in sequence.
[0168] (1) Positioning effect test
[0169] Providing users with good positioning effect is the ultimate goal of this software. The seamless positioning effect of the software has been tested in multiple dimensions. For each test item, the specific implementation and test results are as follows:
[0170] Example 1: Outdoor test, the area of the entrance of Building 1
[0171] After turning on the software, connecting the Bluetooth, and outputting the positioning result, walk normally in the outdoor area of the campus to complete the test, including areas with dense trees and the entrance of Building 1. To improve the positioning effect, appropriate convergence and PDR training should be carried out in relatively open areas in the early stage. At the same time, for comparative analysis, the software also records the positioning results output by the mobile phone's own GNSS chip. The final test trajectory starts from the upper right corner, walks counterclockwise along the rectangular trajectory at a constant speed to the upper right corner to end, passing through the entrance of Building 1 of the Information School of a certain university with a width of about 18 meters twice. The hollow points are the positioning results of this software, and the solid points are the positioning results of the mobile phone chip. It can be seen that the outdoor positioning effect of this software is good, has obvious advantages over the positioning results of the mobile phone itself, and has strong environmental adaptability, and can achieve seamless positioning in outdoor areas.
[0172] Example 2: Indoor test, inside the library of the Information School
[0173] Turn on the software indoors to test whether an effective indoor positioning result can be obtained. If it can be obtained, walk along the pre-designed route to verify the indoor positioning effect, reliability, and stability. The route is the reference trajectory. During the test, walk twice at a constant speed on the reference trajectory in the order of 4-6-4-1-4. From the test results, it can be seen that the indoor positioning result is obtained normally and the indoor positioning effect is good.
[0174] (2) Software performance test
[0175] Performance stability is the premise for function implementation. Considering the characteristics of the software and the limitations of intelligent terminals themselves, a large number of designs and optimizations have been carried out to achieve data synchronization acquisition and fast positioning calculation. Now, for each test item of the software, the specific implementation and test results are as follows:
[0176] Example 3: Mobile phone compatibility, running stability;
[0177] Install the APP on mobile phones of different models, start the program, perform positioning calculations, and keep the mobile phones in the wake state. Continuously test for 5 hours, 2 hours, and 2 hours respectively under the conditions of outdoor stillness, indoor stillness / movement, and outdoor movement, and repeatedly test the indoor-outdoor switching for about 30 minutes (10 times for outdoor-indoor and indoor-outdoor switching each), and observe whether the software operates normally and maintains good positioning functions under various conditions during the test time. Among them, some mobile phones are tested simultaneously under the outdoor static condition, and the tests under the dynamic and switching conditions are carried out simultaneously with the positioning effect test. The conclusion is: The software has good compatibility and stable operation on the tested models.
[0178] Example 4: Analysis of data acquisition delay and time synchronization effect;
[0179] There is a delay in the Bluetooth transmission of GNSS data and the network transmission of differential enhancement information. This application does not verify and improve this, but only considers the effect of multi-source data acquisition and time synchronization based on multi-threading to verify the controllability of data acquisition and the time matching of multi-source data. The test basis is: Each sub-thread marks the mobile phone system time every time it attempts to acquire the corresponding data, and analyzes whether the time interval between the two marked times before and after is consistent with the set execution time interval of the sub-thread through a large amount of data analysis. As Figure 11 shown, it is the statistical situation of one group of test results, and several other groups present similar results. It can be seen that except for the differential data, the marked time intervals of other data are basically consistent with the set execution intervals, with occasional fluctuations of 1-2 ms (sensor data fluctuates by 1-3 ms), but they show positive and negative offsets, and the mean value is still within the execution interval, with an error mean of 0. The delay of differential enhancement information caused by network delay will not have too much impact on the solution results. This shows that the thread pool has unique advantages in multi-source data acquisition and time synchronization, and can maintain a fixed acquisition frequency to achieve time synchronization of data.
[0180] Example 5: GNSS / PDR (JNI) solution efficiency;
[0181] Obtain the mobile phone system time before and after calling the native method to implement GNSS / PDR solution respectively, and output the difference between the two as the positioning solution time-consuming of JNI. Conduct multiple tests on different mobile phones in the outdoor scenario. It can be seen that the efficiency of using JNI to implement real-time GNSS / PDR positioning solution is relatively high. Although there will be differences between different mobile phones, basically the solution time-consuming for each epoch can be maintained within 25 ms, which fully shows that using JNI to implement the positioning solution of intelligent terminals has good feasibility.
[0182] Example 6: Mobile phone power consumption (CPU, memory, traffic, battery);
[0183] The APP was comprehensively tested using the WeTest assistant and CubePC assistant on Tencent Quality Open Platform. The test results are as Figure 12 shown (the power consumption is calculated from the power consumption details in the phone settings). It can be seen that the software maintains a low level in terms of CPU occupancy rate, memory occupancy rate, traffic consumption, and power consumption, meeting the software design concept.
[0184] After testing and verification, in terms of the positioning effect of this application, good indoor and outdoor positioning effects can be obtained. Moreover, continuous positioning can be achieved outdoors (including fully blocked areas), and seamless and smooth transition can be ensured during the switching between indoor and outdoor scenarios; in terms of software performance, the software has good compatibility among different models of mobile phones, normal functions, and stable operation. The average error of the data synchronization acquisition time is 0 ms, the positioning calculation time for a single epoch is within 25 ms, and the CPU occupancy rate, memory occupancy rate, traffic consumption, and power consumption all maintain at a low level.
Claims
1. A multi-source interactive navigation method for seamless indoor and outdoor mobile phone positioning, characterized in that: Integrate multi-source observation data for scene judgment, and realize seamless and stable positioning through multi-mechanism interactive positioning. On this basis, build a multi-source interactive seamless positioning software framework: First, adopt a seamless positioning method that integrates three positioning mechanisms: GNSS positioning, WIFI / geomagnetic position fingerprint matching, and PDR positioning; second, obtain GNSS / base station / light / geomagnetic / air pressure multi-source sensor observation data provided by smartphones, establish an indoor and outdoor scene judgment method based on multi-source fusion, and build a positioning seamless switching method based on the scene judgment results and the characteristics of different positioning methods to achieve seamless and stable positioning in different indoor and outdoor scenes; third, solve the GNSS / differential enhancement information / MEMS / magnetometer / base station / barometer multi-source data acquisition and time synchronization, C / C++ and Java efficient processing of mixed programming under the JNI mechanism, and Amap SDK secondary development problems based on mobile phone smart terminal hardware and software, and build a multi-source fusion seamless positioning software framework; 1) A seamless positioning technology solution combining GNSS positioning, multi-source fusion location fingerprint matching, and PDR positioning is adopted, based on two fusion positioning methods: weighted average and estimated optimal filtering; 2) Based on the characteristics and changing rules of the number of GNSS satellites, base station signal strength, light intensity, magnetic intensity, and air pressure data in different indoor and outdoor scenes, a multi-mode fusion scene judgment method with low energy consumption, fast response, and high accuracy is established. Then, based on the real-time scene judgment results, the positioning trigger problem and the switching judgment problem are solved respectively, and a scene-based seamless positioning switching method is constructed. Based on EKF, outdoor GNSS / PDR combined positioning is realized, and a fusion switching method is used to realize seamless positioning switching between indoor and outdoor. 3) Mobile phone-based multi-source interactive seamless positioning software architecture: It is divided into six modules: data storage, data collection, positioning solution, scene judgment, positioning switching and result display. It combines the software and hardware of mobile terminals to establish a multi-source interactive seamless positioning workflow. In order to solve the problems of difficult data synchronization, low positioning solution efficiency and complex indoor positioning, three key technologies are designed: data acquisition and time synchronization based on thread pool, GNSS / PDR positioning solution based on C / C++ and Java mixed programming under the JNI mechanism, and indoor positioning based on secondary development of AutoNavi Positioning SDK, so as to optimize software performance and positioning effect.
2. According to claim 1, the method for seamlessly switching between indoor and outdoor multi-source interactive navigation using mobile phone positioning is characterized in that: Multi-mode fusion scene judgment: First, based on the real-time data of various sensors of the mobile terminal, the scene is judged by module and the indoor confidence level P of each judgment result is given. m and outdoor confidence P n , and then the indoor confidence P of each module m The sum is the total indoor confidence P i , the outdoor confidence P of each module n The sum is the total indoor confidence P o , and finally compare P i and P o The size of P i Greater than P o When P o Greater than P i When , the user is considered to be in an outdoor scene; The scene judgment of multi-mode fusion includes: 1) using a dynamic weight method instead of assigning fixed weights to each scene judgment module. In sunny days, the weight of the light module is increased, and in rainy weather, its weight is reduced; 2) the air pressure module does not respond to scene switching in a timely manner, especially floor switching, and is not directly applied to the multi-mode fusion method; 3) the indoor and outdoor transition areas have no obvious boundaries in real physical visual scenes, and it is more difficult to set the judgment threshold between outdoor, indoor and transition areas in the corresponding scene judgment. It only shows a change trend in the judgment data, and seamless positioning switching is performed based on this change trend; The scene judgment of seamless positioning switching realizes positioning triggering, and assists in adjusting the weights of different positioning methods during the fusion switching process.
3. According to claim 1, the method for seamlessly switching between indoor and outdoor multi-source interactive navigation using mobile phone positioning is characterized in that: Scenario-based seamless switching method: The problems faced in positioning switching are summarized as positioning triggering problem and switching decision problem. The triggering problem solves the problem of under what conditions the user activates the corresponding positioning method, and the switching decision problem focuses on which positioning method the user should use and how to integrate multiple positioning results. Solve the switching decision problem: rely on the positioning results of various positioning methods obtained by the user. When the user obtains two or more positioning results, the positioning results of GNSS and PDR are obtained outdoors, and the GNSS, PDR and indoor positioning results are obtained in the transition area between indoors and outdoors. The program performs autonomous switching and fusion, and performs data fusion on multiple positioning results to achieve soft switching of different positioning mechanisms. In addition, the fusion results of GNSS and PDR are output as the only result of the outdoor positioning method to reduce the complexity of data fusion. The indoor positioning result provided by the positioning SDK is output as the only result of indoor positioning. In the process of seamless switching between indoors and outdoors, only the above two result data are fused.
4. According to claim 1, the method for seamlessly switching between indoor and outdoor multi-source interactive navigation using mobile phone positioning is characterized in that: GNSS and PDR combined positioning: Based on the extended estimation optimal filtering, the GNSS positioning results are corrected based on PDR to achieve continuous and seamless positioning in outdoor areas; At the beginning of positioning, the initial position value is determined according to the GNSS positioning result. In the subsequent positioning process, PDR is calculated, and EKF is used to fuse PDR and GNSS. The system state vector is formed by the PDR calculation error, as shown in Formula 1: X=[dN,dE,ds,dα] Formula 1 Among them, [dN, dE] is the position error, ds is the moving distance error, and dα is the heading angle error. At the same time, when the GNSS positioning result is updated, the difference between it and the PDR calculation result is used as the observation vector, as shown in Formula 2: In the formula, is the solution result of GNSS positioning at time k, is the estimated result of PDR positioning at time k, and then the state equation of EKF is constructed, as shown in Equation 3: According to the above formulas, the state transfer matrix and the observation matrix are determined, and then the noise sequence is determined by the empirical value to obtain the optimal estimated value of the optimal filter after the fusion of GNSS and PDR; When GNSS positioning is impossible, the system fusion prediction value of the previous epoch is used to replace the GNSS positioning result, and the difference between it and the PDR calculation result is taken as the observation vector to continue the EFK estimation process to achieve continuous positioning under full occlusion conditions.
5. According to claim 1, the method for seamlessly switching between indoor and outdoor multi-source interactive navigation using mobile phone positioning is characterized in that: Indoor and outdoor fusion switching: GNSS and PDR combined positioning is used outdoors, and the positioning results provided by Amap SDK based on location fingerprint matching are used indoors. There is a natural gap between the two. This application adopts a weighted fusion filtering method with dynamic weight adjustment, and uses distance constraints to control errors to achieve the fusion of the two result data; When the user transitions from outdoor to indoor, the scene judgment module gives an indoor judgment result, and indoor positioning is turned on. At this time, there are not only indoor positioning results, but also outdoor GNSS fusion PDR positioning results, and the latter result is considered reliable in a short time. Given a distance threshold δS, when the absolute value of the distance between the above two results |ΔS| is less than δS, firstly, outdoor positioning is used as the weighted party for weighted average fusion, as shown in Formula 4, is the outdoor positioning result at time k, is the indoor positioning result at time k, w1 and w2 are the weights of the two respectively. When the weighted average fusion condition is met for the first time, w1=9 and w2=1 are given. In each subsequent epoch, w1 decreases by 1 and w2 increases by 1 until w1=0, at which time it is completely switched to indoor positioning. When the user transitions from indoors to outdoors, the scene judgment module gives an outdoor judgment result, and outdoor positioning is turned on. PDR is not integrated indoors, and only the switching between indoor Amap positioning results and GNSS positioning is considered. Unlike the transition from outdoor to indoor, once GNSS positioning is successful, it will converge quickly, and the positioning accuracy is significantly better than the indoor positioning result in the transition area. Only the distance constraint is used as the judgment criterion, and no weighted average fusion is performed. At this time, ΔS means the difference between the GNSS positioning results between the previous and next epochs, and the judgment critical value is δS G , that is, the GNSS positioning result converges to |ΔS|<δS G When the device is in standalone positioning mode, it will be identified as independent positioning and the indoor positioning function will be turned off; In addition, during the indoor-outdoor switching process, when the PDR recognizes that the user is stationary, the switching logic will be suspended and continued when the user moves, so as to avoid positioning errors caused by premature switching when the user is hesitant in the transition area.
6. According to claim 1, the method for seamlessly switching between indoor and outdoor multi-source interactive navigation using mobile phone positioning is characterized in that: Overall architecture of seamless positioning software: Based on the mobile phone platform and some external devices, and using the AutoNavi Map SDK, a public pedestrian positioning software integrating GNSS positioning, pedestrian dead reckoning and indoor positioning is established. At the same time, scene judgment information is used and a fusion switching method is adopted to solve the problem of smooth connection between different positioning mechanisms, ultimately achieving seamless connection between indoor and outdoor positioning and visual presentation of positioning results; After obtaining multi-source observation information through various channels, the data is encoded, synchronized, and transmitted in a unified manner. The differential GNSS and PDR solutions and the EKF-based fusion of the two are realized through the JNI mechanism. The indoor positioning results are obtained using the AutoNavi Positioning SDK. At the same time, scene judgment is realized based on multi-source data such as the number of satellites, base station signal strength, light intensity, magnetic intensity, and air pressure. The results of scene judgment are combined to realize multi-mechanism collaborative and seamless processing in different indoor and outdoor scenarios. The positioning results are finally output and displayed on the AutoNavi map.
7. According to claim 1, the method for seamlessly switching between indoor and outdoor multi-source interactive navigation using mobile phone positioning is characterized in that: Seamless positioning system module setting: Using smartphones as the client, the software is modularly designed according to specific logic, and is divided into 6 modules: data storage, data collection, positioning solution, scene judgment, positioning switching and result display; Data storage module: save user parameters, read configuration files, and record multi-source data. User parameters refer to the set values when the user uses the software, including the positioning mode; the configuration file gives the state quantity and data feature description required for positioning solution; save multi-source data to the mobile phone SD card file to facilitate post-processing and analysis and improvement on the PC side; Data acquisition module: real-time acquisition of various data information including GNSS raw observation data, differential enhancement information, Amap positioning data, accelerometer / magnetometer / gyroscope / barometer data, WiFi / Bluetooth signals, and base station signals, completes the encoding, synchronization, and transmission of the above data, and realizes time synchronization of multi-source data; Positioning solution module: including GNSS positioning solution, PDR calculation and the fusion positioning of the two based on EKF, using JNI for efficient positioning solution; Scene judgment module: Based on the GNSS data, base station signals, ambient light intensity, magnetic field characteristics and air pressure changes provided by the data acquisition module, the multi-mode fusion scene judgment method is used to realize indoor and outdoor scene judgment. The scene judgment results given by this module will be applied to the positioning switching module to complete the positioning triggering and fusion weighting in different indoor and outdoor scenes; Positioning switching module: adopts a fusion switching method to achieve positioning switching of indoor and outdoor feature scenes; Result display module: includes the presentation of indoor and outdoor maps, positioning results and status parameters.
8. According to claim 1, the method for seamlessly switching between indoor and outdoor multi-source interactive navigation using mobile phone positioning is characterized in that: Multi-source data acquisition and time synchronization: The application data includes: GNSS observation data from the Bluetooth module, GNSS differential enhancement information from the Bai network, indoor positioning data from AutoNavi Positioning SDK, MEMS / air pressure / light intensity / magnetic intensity and base station data from mobile phone sensors. They not only come from different sources, but also have their own independent collection frequency and encoding method. In different threads, data is collected and encoded according to the corresponding frequency, and these data are time-synchronized according to the positioning solution requirements; Create ScheduledThreadPool through newcheduledThreadPool(), and synchronize threads using the synchronized keyword to ensure the uniqueness and accuracy of variables; The thread pool design for data acquisition and time synchronization has a total of seven sub-threads, including six data acquisition threads, namely GnssTask, RTCMTask, SensorTask, BaiDuTask, GSMTask, and ReplayTask, and one positioning solution thread, namely PositionTask. GnssTask controls the reading of GNSS data from the external Bluetooth once per second, RTCMTask controls the capture of differential enhancement information from the network port once per second, SensorTask controls the reading of MEMS / magnetometer / air pressure / light intensity sensor data once every 10ms, BaiDuTask controls the acquisition of Amap indoor positioning results once per second, GSMTask controls the acquisition of base station data once per second, ReplayTask controls the reading of data files and subsequent solution, and PositionTask summarizes all valid data per second and completes scene judgment and positioning solution work accordingly; ScheduleAtFixedRate(Runnable task, long initialDelay, long period, TimeUnit unit) is used to execute a certain Task at a fixed frequency (1000 / periodHz) after a delay of initialDelay. The synchronization of multi-source data is achieved by setting initialDelay and period to avoid the fusion positioning error caused by the time deviation during positioning data fusion.
9. The method for seamlessly switching between indoor and outdoor multi-source interactive navigation using mobile phone positioning according to claim 1, characterized in that: The programming steps for implementing positioning solution using JNI are as follows: Step 1: Define a native method in Java. The native method uses a method in an interface. It only has a method declaration and is called directly by Java. It is implemented in C / C++. Step 2: Use the javah command in the command console to generate the .h header file, create a jni folder in the project root directory and copy the header file into it. The javah command statement first locates the src directory of the project, and then enters "javah+'space'+package name.class name" to finally generate the header file; Step 3: Write the required .c file in the jni folder to implement the local method, introduce the generated .h file in the .c file, and the .h file automatically generates a method declaration that complies with the JNI specification. You only need to copy the method declaration to the .c file and call the C / C++ function in the method declaration to implement the corresponding function; Step 4: Create a mobile phone .mk file in the jni folder, define the name of the dynamic library, load the C / C++ code file and the corresponding .h file name. When using JNI and Amap SDK at the same time, create a prebuilt file in the jni directory, copy the SDK to it, and make corresponding instructions in the mobile phone .mk file; Step 5: Create the Application.mk file and declare the supported platforms; Step 6: Compile and generate so dynamic link library file; Step 7: Load the .so class library in the Java code and directly call the native method when using it.
10. The method for seamlessly switching indoor and outdoor multi-source interactive navigation based on mobile phone positioning according to claim 1, characterized in that: To implement indoor positioning based on Amap positioning SDK, the specific steps are as follows: Step 1: Register and obtain the secret key: First log in (registration is required) to the AutoNavi Map Open Platform, enter the API console, create an application and enter the AK application window. Fill in the application name, select the application type, configure SHA1 and package name, and click Submit to generate the AK. When using the mobile positioning SDK and mobile map SDK in the same project, use the same AK and view, modify, and delete the created AK in the API console. Step 2: Add SDK (jar and so) to the mobile phone project: Developers can enter the AutoNavi mobile SDK download platform, combine their own needs, customize the selected business, package and download the selected function development kit, and place the jar and so in libs to the corresponding location in the project after downloading. It contains so files of various CPU architectures, and developers can choose according to their needs; Step 3: Add the AK applied in step 1 to the Application tag of the mobile phone's Manifest.xml file and declare the service component, and add relevant permissions to the file; Step 4: Initialize LocationClient and configure SDK parameters: declare the LocationClient class object in the main thread, pass in the Context type parameter, use the getApplicationConext() method to obtain the Context that is valid for the entire process, and then configure the SDK positioning parameters to set the positioning mode, return latitude and longitude coordinate type, and positioning request interval; Step 5: Implement the BDAbstractLocationListener interface to obtain longitude and latitude: Use the Abstract type listening interface BDAbstractLocationListener to implement positioning listening. This interface obtains positioning results asynchronously. Then, the developer initiates positioning through mLocationClient.start() and obtains positioning result information from the BDAbstractLocationListener listening interface.