Floor positioning method, electronic equipment and readable storage medium
By combining air pressure values and WiFi fingerprint data, the WiFi fingerprint database of buildings is constructed, which solves the problem that air pressure values are susceptible to noise in the existing technology, and improves the accuracy and robustness of floor positioning.
Patent Information
- Application Number
- CN202311284349.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-28
- Publication Date
- 2025-03-28
AI Technical Summary
The existing floor positioning technology relies on air pressure value and is susceptible to noise, with low accuracy and poor robustness.
Combining the air pressure value and WiFi fingerprint data, the floor is determined by constructing the WiFi fingerprint database of the building, and the matching relationship between the air pressure value and WiFi fingerprint data is used.
It improves the accuracy and robustness of floor positioning, reduces the power consumption of electronic devices, and reduces the workload of data acquisition.
Smart Images

Figure CN119729754A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of positioning technology, and in particular, to a floor positioning method, an electronic device, and a readable storage medium. Background Art
[0002] With the diversification of users' positioning needs, positioning technology has developed from positioning in two-dimensional planes to positioning in three-dimensional space. In the positioning in three-dimensional space, floor positioning is an important direction.
[0003] At present, a barometer can be set in an electronic device, and the electronic device can determine the height change of the electronic device in the building through the air pressure value collected by the barometer, and then determine the floor where the electronic device is located. However, air pressure is easily affected by noise, and floor positioning based solely on air pressure values has low accuracy and poor robustness. Summary of the invention
[0004] The embodiments of the present application provide a floor positioning method, an electronic device, and a readable storage medium, which can improve the accuracy of floor positioning.
[0005] In the first aspect, the embodiment of the present application provides a method for floor positioning, and the execution subject of the method can be an electronic device or a chip in the electronic device. The following is an explanation using an electronic device as an example. In the method, when the electronic device detects that the electronic device enters a building, the electronic device can collect air pressure values and WiFi fingerprint data of key locations. Among them, when the first condition is met, the electronic device can determine the floor where the electronic device is located based on the air pressure value.
[0006] When the first condition is not met, the electronic device determines the floor where the electronic device is located based on the WiFi fingerprint data and the WiFi fingerprint database of the building, where the WiFi fingerprint database of the building is constructed based on historically collected air pressure values and WiFi fingerprint data of key locations, and the WiFi fingerprint database of the building includes: WiFi fingerprint data of key locations of at least one floor.
[0007] After the electronic device obtains the floor where the electronic device is located, the electronic device can output the floor where the electronic device is located.
[0008] In a possible implementation, the key location includes: the entrance of the building, an elevator entrance, a staircase entrance, or an escalator entrance on at least one floor.
[0009] In the embodiment of the present application, the electronic device does not need to rely on the change of the air pressure value to locate the floor. The electronic device can select the corresponding method according to whether the first condition is met to determine the floor where the electronic device is located, which can improve the accuracy of floor positioning. In addition, the WiFi fingerprint database of the building is constructed based on the historically collected air pressure values and WiFi fingerprint data of key locations, rather than always collecting WiFi fingerprint data of each location on each floor of the building, which can reduce the workload of collection and reduce the power consumption of electronic devices.
[0010] In a possible implementation, the first condition includes: the change in air pressure value does not come from noise; and, entering the building from the first floor; and, after the electronic device enters the building, the electronic device is not restarted.
[0011] It should be understood that the first condition is used to indicate that an electronic device can accurately determine the floor where the electronic device is located using only the air pressure value. Therefore, when the first condition is met, the electronic device can determine the floor where the electronic device is located based on the air pressure value. When the first condition is not met, the electronic device cannot accurately determine the floor where the electronic device is located based on the air pressure value. Therefore, the electronic device can determine the floor where the electronic device is located based on the WiFi fingerprint data and the WiFi fingerprint database of the building, thereby enabling the electronic device to accurately locate the floor.
[0012] In a possible implementation, the key position of the building includes a first key position, or the key position includes the first key position and a second key position. The first key position is the position of the electronic device when it enters the building, such as the entrance of the building. The second key position is the position of the electronic device when it ends crossing the floor, such as the elevator entrance, escalator entrance or stair entrance.
[0013] After the electronic device enters the building, the electronic device can collect air pressure values at a preset frequency; and when the electronic device is detected to enter the building, the WiFi fingerprint data of the first key position is collected. In addition, the electronic device can collect WiFi fingerprint data of the second key position based on the air pressure value when the cross-layer end is detected.
[0014] The electronic device may determine the start and end of cross-layering according to the air pressure value. Exemplarily, when the change in the air pressure value within the first preset time is greater than or equal to the third threshold, the electronic device may determine the start of cross-layering, and when the change in the air pressure value within the first preset time is less than the fourth threshold, the electronic device may determine the end of cross-layering.
[0015] Due to different geographical locations, the same change in air pressure value brings about different changes in altitude. In order to more accurately determine the start and end of layer crossing, in some embodiments, the electronic device can determine the altitude change within the first preset time period according to the air pressure value within the first preset time period. If the altitude change within the first preset time period is greater than or equal to the first threshold, the electronic device determines that the layer crossing begins. If the altitude change within the first preset time period is less than the second threshold, the electronic device determines that the layer crossing ends.
[0016] The following describes the process of constructing a building's WiFi fingerprint database based on historically collected air pressure values and WiFi fingerprint data of key locations:
[0017] Method 1:
[0018] The historically collected air pressure values include: the air pressure value sequence collected when the electronic device enters the building for the nth time, and the historically collected WiFi fingerprint data of the key positions include: the WiFi fingerprint data sequence collected when the electronic device enters the building for the nth time, where n is an integer greater than 1. The WiFi fingerprint data sequence includes: the WiFi fingerprint data of the first key position when the electronic device enters the building, or the WiFi fingerprint data sequence includes: the WiFi fingerprint data of the first key position, and the WiFi fingerprint data of the second key position when the cross-layer is completed.
[0019] First, the electronic device can obtain the first height change according to the air pressure value of the second key position and the air pressure value of the first key position. If the electronic device can determine the floor where the second key position is located according to the first height change, the electronic device can build a WiFi fingerprint database of the building according to the floor where the first key position is located, the WiFi fingerprint data of the first key position, the floor where the second key position is located, and the WiFi fingerprint data of the second key position.
[0020] In some embodiments, there is at least one second key position, and each second key position corresponds to a floor.
[0021] Secondly, if the electronic device fails to determine the floor where the second key position is located based on the first height change, the electronic device can determine the floor where the second key position is located based on the height change of the key position when entering the building multiple times.
[0022] The electronic device may obtain the similarity of the WiFi fingerprint data of any two key positions when the electronic device enters the building at different times, and take the key positions with a similarity greater than or equal to a similarity threshold as the same key position. The electronic device detects whether the floors determined by the same key position when the electronic device enters the building at different times are the same. If the floors at the same key position are different, the electronic device may determine that the floors determined by the electronic device when entering the building at different times are wrong.
[0023] The electronic device can cluster the determined floors of the same key position to obtain the accurate floor of the same key position. The electronic device can obtain the floor of each key position according to the floor of the same key position and the height change of each key position, wherein each key position includes the second key position. In this way, the electronic device can accurately determine the floor of each key position each time entering the building.
[0024] In this way, the electronic device can construct a WiFi fingerprint database of the building according to the floor where each key location is located and the WiFi fingerprint data of each key location.
[0025] In a possible implementation, after obtaining the floor where each key position is located, the electronic device can also detect whether there is an incorrect floor among the floors where the determined key positions are located according to the floors where each key position is located. If there is an incorrect floor among the floors where the determined key positions are located, the electronic device can modify the incorrect floor to a correct floor. In this way, the electronic device can construct a WiFi fingerprint database of the building according to the modified floors of the key positions and the WiFi fingerprint data of the key positions.
[0026] Method 2:
[0027] In a possible implementation, the WiFi fingerprint data sequence includes: the WiFi fingerprint data of the first key position when the electronic device enters the building, or the WiFi fingerprint data sequence includes: the WiFi fingerprint data of the first key position, and the WiFi fingerprint data of the second key position when the cross-layer ends. Alternatively, the WiFi fingerprint data sequence includes: the WiFi fingerprint data of the first key position, the WiFi fingerprint data of the second key position when the cross-layer ends, and the WiFi fingerprint data of the third key position when the cross-layer starts.
[0028] In this example, the electronic device can also obtain the second height change according to the air pressure value of the third key position and the air pressure value of the first key position.
[0029] Among them, if the electronic device can determine the floor where the third key position is located based on the second height change, the electronic device constructs the WiFi fingerprint database of the building based on the floor where the first key position is located, the WiFi fingerprint data of the first key position, the floor where the second key position is located, the WiFi fingerprint data of the second key position, the floor where the third key position is located, and the WiFi fingerprint data of the third key position.
[0030] Among them, if the electronic device cannot accurately determine the floor where the third key position is located based on the second height change, the electronic device can determine the floor where the second key position is located based on the height change of the key position when entering the building multiple times, and refer to the description in method 1. Different from method 1, the key position in method 2 can further include the third key position when starting to cross floors. Compared with method 1, the electronic device can obtain more floors and WiFi fingerprint data of key positions in the building, thereby enriching the WiFi fingerprint database of the building and improving the accuracy of floor positioning.
[0031] In a possible implementation, the WiFi fingerprint database of the building includes: WiFi fingerprint data of the first floor entrance of the building. When the electronic device detects that the electronic device enters the building, the WiFi fingerprint data of the electronic device when entering the building can be collected, and the electronic device can obtain the similarity between the WiFi fingerprint data of the electronic device when entering the building and the WiFi fingerprint data of the first floor entrance of the building. When the similarity is greater than or equal to the similarity threshold, the electronic device can determine that the electronic device enters the building from the first floor. When the similarity is less than the similarity threshold, the electronic device can determine that the electronic device does not enter the building from the first floor.
[0032] Accordingly, by using the WiFi fingerprint data similarity method, the electronic device can determine whether the electronic device enters the building from the first floor.
[0033] The above example introduces a method in which an electronic device can build a WiFi fingerprint database based on historically collected air pressure values and WiFi fingerprint data. In some embodiments, a server can build a WiFi fingerprint database based on historically collected air pressure values and WiFi fingerprint data, wherein the historically collected air pressure values and WiFi fingerprint data can be collected and reported to the server by multiple electronic devices after entering the building. In other words, the server can adopt a crowdsourcing method to build a WiFi fingerprint database for the building based on the air pressure values and WiFi fingerprint data reported historically by multiple electronic devices. Among them, the way the server builds the WiFi fingerprint database for the building can refer to the relevant description of the electronic device building the WiFi fingerprint database for the building based on the historically collected air pressure values and WiFi fingerprint data, and can specifically refer to the descriptions in Method 1 and Method 2.
[0034] In this example, after collecting the air pressure value and the WiFi fingerprint data of the key position, the electronic device may send the air pressure value and the WiFi fingerprint data of the key position to the server.
[0035] The server can determine the floor where the electronic device is located based on the air pressure value and the WiFi fingerprint data of the key position. Specifically, the server can determine the floor where the electronic device is located based on the WiFi fingerprint data and the WiFi fingerprint database of the building, and can refer to the relevant description of the electronic device determining the floor where the electronic device is located based on the WiFi fingerprint data and the WiFi fingerprint database of the building.
[0036] After determining the floor where the electronic device is located, the server can send the floor where the electronic device is located to the electronic device, so that the electronic device can output the floor where the electronic device is located. The floor where the electronic device is located is obtained by the server according to the WiFi fingerprint data and the WiFi fingerprint database of the building, and the WiFi fingerprint database of the building is constructed by the server according to the air pressure value reported by at least one electronic device in history and the WiFi fingerprint data of the key position.
[0037] In the embodiment of the present application, the server can use crowdsourcing to construct and update the WiFi fingerprint database of the building based on the air pressure value sequence and WiFi fingerprint data sequence from multiple electronic devices. Among them, the advantage of using crowdsourcing is that even if the user has never been to the building, or has been to the building less frequently, the server can accurately construct the WiFi fingerprint database of the building based on the data collected when a large number of other users enter the building, and can achieve accurate positioning of the floor.
[0038] In a second aspect, an embodiment of the present application provides an electronic device, which may include: a processor and a memory. The memory is used to store computer executable program code, and the program code includes instructions; when the processor executes the instructions, the instructions cause the electronic device to execute the method in the first aspect.
[0039] In a third aspect, an embodiment of the present application provides an electronic device, which may include a unit, a module or a circuit for executing the method provided in the first aspect above.
[0040] In a fourth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the method in the first aspect.
[0041] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer executes the method in the first aspect above.
[0042] The beneficial effects of the possible implementation methods of the second to fifth aspects mentioned above can be referred to the beneficial effects brought about by the first aspect mentioned above, and will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 A schematic diagram of a process of floor positioning;
[0044] Figure 2 A schematic diagram of a process for constructing a WiFi fingerprint database for a building provided in an embodiment of the present application;
[0045] Figure 3 A schematic diagram of a cross-floor situation when an electronic device enters a building twice according to an embodiment of the present application;
[0046] Figure 4 A schematic diagram of a cross-floor structure when an electronic device enters a building three times according to an embodiment of the present application;
[0047] Figure 5 A schematic diagram of constructing a WiFi fingerprint database of a building for an electronic device provided in an embodiment of the present application;
[0048] Figure 6 A schematic diagram of a server provided in an embodiment of the present application constructing a WiFi fingerprint database of a building based on crowdsourced data;
[0049] Figure 7 A schematic diagram of a flow chart of an embodiment of a method for floor positioning provided in an embodiment of the present application;
[0050] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0051] Positioning technology is widely used. For example, it is necessary to locate the real-time position of the user when navigating, and it is necessary to locate the position of the target when searching for the target. Current positioning technology is widely used for positioning in two-dimensional planes, such as positioning the latitude and longitude of the target, the coordinate position of the target, etc. With the development of positioning technology and the diverse needs of users for positioning technology, positioning in three-dimensional planes has received more attention. In positioning in three-dimensional planes, floor positioning is an important direction. Floor positioning can be understood as the floor where the positioning target is located. Targets may include but are not limited to: users, animals, robots, objects, etc. Exemplarily, when a user is going up and down the stairs, if the floor is not marked in the building, the user can use floor positioning to locate the current floor. Exemplarily, when a child is playing in the building, parents can use floor positioning to locate the child's current floor. Exemplarily, when friends meet in a shopping mall, floor positioning can be used to locate the floor where the friend is located. The embodiment of the present application does not limit the use scenario of floor positioning.
[0052] The electronic device in the embodiments of the present application may be referred to as user equipment (UE), terminal, etc. For example, the electronic device may be a mobile phone, a portable android device (PAD), a personal digital assistant (PDA), a handheld device with a wireless communication function, a computing device, a vehicle-mounted device or a wearable device, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in a smart home, etc. The form of the electronic device is not specifically limited in the embodiments of the present application.
[0053] In a building, because the heights of different floors are different, the air pressure values of different floors are different as the height changes. In some embodiments, a barometer can be set in the electronic device, and the barometer is used to detect the air pressure value. Exemplarily, when a user enters the first floor indoors from the outdoors, the barometer can collect the air pressure value of the first floor. When the user takes the elevator or walks up and down the stairs, the air pressure value collected by the barometer will change, and the electronic device can calculate the change in the air pressure value compared to the first floor to obtain the height change. When the height of a floor in the building is known, the electronic device can determine the floor where the electronic device is located based on the height change.
[0054] However, the barometer is sensitive to noise and easily affected by airflow, temperature, etc. Electronic equipment using a barometer alone for floor positioning has poor robustness and low accuracy.
[0055] In some embodiments, a WiFi module may be provided in an electronic device, and based on the WiFi module, the electronic device may scan surrounding access points (APs), and the electronic device may access the AP to surf the Internet and communicate with other electronic devices. For example, the WiFi module may be a WiFi chip.
[0056] In this example, a WiFi fingerprint database for each floor in the building can be pre-constructed, and the WiFi fingerprint database includes: WiFi fingerprint data for each location on each floor in the building. WiFi fingerprint data may include, but is not limited to: the identification of the AP, and the collected WiFi signal strength. The identification of the AP may include, but is not limited to: the address of the AP, the service set identifier (SSID) of the AP. In order to construct a WiFi fingerprint database for each floor in the building, the collector can move with a handheld electronic device. During the movement, the electronic device can collect WiFi fingerprint data for each location on each floor of the building. The electronic device can store each location on each floor in correspondence with the WiFi fingerprint data of the location to construct a WiFi fingerprint database for each floor in the building.
[0057] After the electronic device has built a WiFi fingerprint database for each floor in the building, when positioning, the electronic device can use the WiFi module to perform WiFi scanning to obtain the WiFi fingerprint data of the user's current location. The electronic device can match the currently scanned WiFi fingerprint data with the WiFi fingerprint data in the WiFi fingerprint database, and determine the floor where the electronic device is located based on the matching result. For example, if the WiFi fingerprint data of the user's current location matches the WiFi fingerprint data of position A on the 3rd floor of the building, the electronic device can determine that the floor where the electronic device is located is the 3rd floor.
[0058] In this method, it is necessary to pre-build a WiFi fingerprint database for each floor in the building, which is time-consuming and labor-intensive. In addition, if APs are added or reduced in the building later, it is necessary to re-collect WiFi fingerprint data at each location on each floor to update the WiFi fingerprint database on each floor, which has high maintenance costs.
[0059] In order to improve the efficiency of floor positioning, reduce maintenance costs, and improve the accuracy of floor positioning, in some embodiments, the air pressure value collected by the barometer and the WiFi fingerprint data collected by the WiFi module can be combined to build a WiFi fingerprint database for each floor in a crowdsourcing manner. It should be understood that the crowdsourcing method can be understood as: multiple electronic devices in the building collect air pressure values and WiFi fingerprint data, which can avoid one electronic device traversing every location on each floor, which is efficient.
[0060] Reference Figure 1 , the floor positioning method in this example may include:
[0061] S101, receiving air pressure values and WiFi fingerprint data from multiple electronic devices.
[0062] When a user is active in a building, the user's electronic device can collect air pressure values and WiFi fingerprint data at a preset frequency, and send the collected air pressure values and WiFi fingerprint data to the positioning device. The positioning device can be, for example, a cloud or a server, and the following description takes the server as an example. Because there can be multiple electronic devices in a building, each electronic device can collect air pressure values and WiFi fingerprint data and report them to the server, so the server can receive air pressure values and WiFi fingerprint data from multiple electronic devices.
[0063] S102, data preprocessing.
[0064] After receiving the air pressure values and WiFi fingerprint data from multiple electronic devices, the server may pre-process the data. For example, the server may align the air pressure values and WiFi fingerprint data from different electronic devices according to the time dimension.
[0065] S103, using a hierarchical clustering algorithm to obtain the total number of floors in the building and the air pressure value of each floor.
[0066] The server can use a hierarchical clustering algorithm to cluster the air pressure values and obtain the total number of floors of the building. The server clustering the air pressure values using the hierarchical clustering algorithm can be simply understood as: the server clusters the air pressure values within a certain value range together according to the air pressure values, and the clustering together can form a cluster, and the air pressure value in each cluster is the air pressure value of one floor.
[0067] For example, the server clusters the air pressure values to obtain 5 clusters, and the server can determine that the total number of floors of the building is 5. The server can use the cluster center of each cluster as the air pressure value of the floor, and can obtain the air pressure value corresponding to each floor according to the order of the air pressure values of the floors from large to small.
[0068] S104, taking the total number of floors of the building as the number of categories and the air pressure value of each floor as the initial clustering center, to obtain a WiFi fingerprint database of each floor.
[0069] The server uses the total number of floors in the building as the number of categories and the air pressure value of each floor as the initial cluster center to perform K-Means clustering on the WiFi fingerprint data of each floor to obtain a WiFi fingerprint database for each floor. The server can store the WiFi fingerprint database for each floor.
[0070] When the electronic device performs floor positioning, the electronic device can collect the WiFi fingerprint data of the current location and send the WiFi fingerprint data of the current location to the server. The server can match the WiFi fingerprint data currently scanned with the WiFi fingerprint data in the WiFi fingerprint database of each floor, and determine the floor where the electronic device is located according to the matching result. After the server determines the floor where the electronic device is located, the server can feedback the floor where the electronic device is located to the electronic device.
[0071] In this method, the server builds a WiFi fingerprint database for each floor, which needs to rely on crowdsourcing data. If the electronic device on a certain floor in the building does not send the air pressure value and WiFi fingerprint data to the server, the air pressure value of a certain floor is missing in the crowdsourcing data. Correspondingly, the total number of floors of the building obtained by the server using the hierarchical clustering algorithm is wrong, resulting in errors in the WiFi fingerprint database of the subsequent floors. In addition, the area of each floor in the building is large. When the WiFi fingerprint data in the crowdsourcing data cannot cover all areas of the floor, the WiFi fingerprint database of the floor constructed by the server is incomplete, which will affect the accuracy of floor positioning. In addition, in this method, the WiFi fingerprint database of each floor is constructed based on crowdsourcing data, which requires the electronic device to keep the WiFi module turned on, and the electronic device needs to collect WiFi fingerprint data all the time and report it to the server, which consumes a lot of power.
[0072] Based on the above problems, the embodiment of the present application provides a method for floor positioning. On the one hand, each time the electronic device enters the building, the electronic device can collect air pressure values and WiFi fingerprint data of key positions, because the electronic device only needs to collect WiFi fingerprint data of key positions in the building, so that the electronic device does not need to turn on the WiFi module all the time, which can save the power consumption of the electronic device. On the other hand, in the present application, according to the user's habits, the air pressure value collected by the electronic device when the electronic device enters the building multiple times can be combined to determine the floor height, and then the WiFi fingerprint database of key positions of different floors can be constructed in combination with the WiFi fingerprint data. When performing floor positioning, the user can be positioned in combination with the air pressure value, WiFi fingerprint data, and WiFi fingerprint database of key positions of different floors collected by the electronic device. Among them, when the air pressure value collected by the electronic device has abnormal fluctuations, the WiFi fingerprint data and the WiFi fingerprint database of key positions of different floors can be relied on to ensure the accuracy of floor positioning.
[0073] The floor positioning method provided by the embodiment of the present application is described below in conjunction with specific embodiments. The following embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0074] In order to facilitate understanding of the floor positioning method provided in the embodiment of the present application, the following first introduces the process of constructing a WiFi fingerprint database of key locations on different floors of a building. Figure 2 , the method of constructing a WiFi fingerprint database of key locations on different floors of a building may include:
[0075] S201, indoor and outdoor recognition.
[0076] In some embodiments, a position detection module may be provided in the electronic device, and the position detection module is used to obtain the position of the electronic device. Exemplarily, for example, the position detection module may be a global positioning system (GPS) or a global navigation satellite system (GNSS). In the embodiment of the present application, taking the position detection module GNSS as an example, the electronic device may detect whether the electronic device has entered a building based on the signal strength of the GNSS. When the signal strength of the GNSS is greater than the strength threshold, the electronic device may determine that the electronic device is outdoors, and when the signal strength of the GNSS is less than the strength threshold or the GNSS signal is not detected, the electronic device may determine that the electronic device has entered the building and is indoors.
[0077] In some embodiments, for example, in a scenario where a user returns home, when the smart access control system captures the user's face, it can send a message to the electronic device to return home. In response to receiving the message from the smart access control system, the electronic device can determine that the electronic device has entered the building.
[0078] In some embodiments, for example, when an electronic device enters a building, the smart access control system can play audio such as "Welcome home", and the electronic device can detect ambient sound. When audio such as "Welcome home" is detected, it can be determined that the electronic device has entered the building.
[0079] In some embodiments, for example, in a scenario where a user drives into a parking lot, when the smart parking system recognizes the license plate of the vehicle, it can send an entry message to the electronic device, and the electronic device can determine that the electronic device has entered the building in response to receiving the entry message from the smart access control system.
[0080] It should be understood that the embodiments of the present application do not limit the method for an electronic device to identify that an electronic device enters a building, and the method for identifying that an electronic device enters a building may be different in different application scenarios.
[0081] S202, when the electronic device enters the building, it starts collecting air pressure values and WiFi fingerprint data at the entrance.
[0082] When the electronic device enters the building, the electronic device can control the barometer to start collecting air pressure values at a preset frequency to obtain an air pressure value sequence.
[0083] When an electronic device enters a building, the electronic device can start scanning WiFi and collect WiFi fingerprint data at the entrance, and stop scanning WiFi after the collection is completed, so as to avoid the electronic device from continuously scanning WiFi and reduce the power consumption of the electronic device.
[0084] In some embodiments, the building entrance can be considered a key location of the building.
[0085] S203, based on the air pressure value, detect whether there is a cross-layer. If so, execute S204, if not, execute S207.
[0086] After the electronic device enters the building, when the user goes upstairs or downstairs, the air pressure value collected by the electronic device also changes due to the different heights of different floors. In the embodiment of the present application, the electronic device can detect whether there is a cross-layer according to the air pressure value. Cross-layer can be understood as a change in floor, such as when the user goes upstairs or downstairs.
[0087] In an embodiment of the present application, the electronic device can detect the change in the air pressure value within a first preset time period, wherein when the change in the air pressure value within the first preset time period is greater than or equal to a third threshold value, the electronic device can determine that the user has started to cross floors. For example, for example, a user takes an elevator from the 1st floor to the 3rd floor. During the elevator's upward movement, the electronic device detects that the change in the air pressure value within the first preset time period is greater than or equal to the third threshold value, and can determine that the user has started to cross floors. It should be understood that in the embodiment of the present application, the way in which the user goes up and down the stairs is not limited, and the user can take the elevator, escalator, or walk up and down the stairs.
[0088] After the user starts to cross floors, the electronic device may continue to detect the change in the air pressure value within the first preset time length, wherein when the change in the air pressure value within the first preset time length is less than the fourth threshold, the electronic device may determine that the cross-floor crossing is over. Exemplarily, when the elevator stops at the 3rd floor, the electronic device detects that the change in the air pressure value within the first preset time length is less than the fourth threshold, and the electronic device may determine that the cross-floor crossing is over. In some embodiments, the fourth threshold may be less than or equal to the third threshold.
[0089] Due to geographical differences, different altitudes have different height changes for the same air pressure value change. In some embodiments, in order to more accurately detect whether there is a cross-layer, the air pressure value change can be uniformly converted into a height change according to the conversion relationship between the local air pressure value change and the height change, and then the height change is used to detect whether there is a cross-layer, which can improve the accuracy of cross-layer detection.
[0090] In the embodiment of the present application, the change in the air pressure value within the first preset time period can be converted into the change in altitude. If the change in altitude within the first preset time period is greater than or equal to the first threshold, the electronic device determines that the cross-layer operation has started, and if the change in altitude within the first preset time period is less than the second threshold, the electronic device determines that the cross-layer operation has ended.
[0091] In some embodiments, the second threshold may be less than or equal to the first threshold.
[0092] It should be understood that the following embodiments take "the height change within the first preset time period" as an example to illustrate how the electronic device detects whether there is a cross-layer.
[0093] Because users go up and down stairs at different speeds when taking elevators, escalators, or walking, for example, when a user goes up 4 floors, the change in air pressure is the same, but the time taken by the users is different. In order to more accurately detect the start of crossing floors, in some embodiments, the electronic device may use the change in height per unit time as the user's floor-crossing speed. The electronic device may determine the start of crossing floors based on the user's floor-crossing speed.
[0094] Exemplarily, a mapping relationship between the user's layer crossing speed and time may be preconfigured, and the time may be the time taken to reach a preset height change when the user crosses layers at the layer crossing speed. The electronic device may detect, based on the user's layer crossing speed, whether the time taken by the user when the height change of the user's layer crossing reaches the preset height change is less than or equal to the time mapped by the layer crossing speed. If the time taken by the user is less than or equal to the time mapped by the layer crossing speed, the electronic device may determine that the user has started to cross layers.
[0095] Exemplarily, the user's crossing speed is A m / s, the time of the crossing speed mapping is B s, and the preset height change is, for example, 2 m. When the user starts to cross layers, the electronic device can calculate the height change within a unit time length to obtain the user's crossing speed A m / s. When the user crosses layers at a crossing speed of A m / s, the electronic device can also calculate the time taken to reach the preset height change. For example, if the time taken is less than or equal to B s, the electronic device can determine that the user starts to cross layers.
[0096] In some embodiments, when the height change within the first preset time period is less than a second threshold, the electronic device determines that the cross-layer is completed.
[0097] S204, when the cross-layer is completed, collect WiFi fingerprint data.
[0098] When the cross-layer is completed, the electronic device can start scanning WiFi, collect WiFi fingerprint data, and stop scanning WiFi after the collection is completed. It should be understood that when the cross-layer is completed, the user is at the elevator entrance, escalator entrance or stair entrance of the building, and the WiFi fingerprint data collected by the electronic device is the WiFi fingerprint data of the elevator entrance, escalator entrance or stair entrance.
[0099] In some embodiments, the user's position at the end of the cross-layer (such as the elevator entrance or staircase entrance) can be used as the key position of the building. In the embodiment of the present application, the electronic device does not continuously scan WiFi, but scans WiFi at the key position of the building, collects WiFi fingerprint data at the key position, and can reduce the power consumption of the electronic device.
[0100] In some embodiments, the electronic device can detect at least one cross-layer process when the user goes up and down the stairs. For example, after the electronic device enters the building, the user takes the elevator from the 1st floor to the 6th floor. During the elevator's upward movement, the elevator stops once on the 2nd floor, once on the 4th floor, and finally stops on the 6th floor, and the user gets off the elevator. Among them, the electronic device can detect three cross-layers based on the height change within the first preset time. The first cross-layer is from the 1st floor to the 2nd floor, the second cross-layer is from the 2nd floor to the 4th floor, and the third cross-layer is from the 4th floor to the 6th floor. Therefore, the electronic device can collect the WiFi fingerprint data of the elevator entrance on the 2nd floor, the WiFi fingerprint data of the elevator entrance on the 4th floor, and the WiFi fingerprint data of the elevator entrance on the 6th floor.
[0101] Similarly, after the electronic device enters the building, the user walks from the 1st floor to the 6th floor. During the walking process, the user stops once on the 2nd floor, once on the 4th floor, and finally enters the home on the 6th floor. Among them, the electronic device can detect 3 cross-layers according to the height change within the first preset time. The first cross-layer is from the 1st floor to the 2nd floor, the second cross-layer is from the 2nd floor to the 4th floor, and the third cross-layer is from the 4th floor to the 6th floor. The electronic device can collect WiFi fingerprint data at the staircase entrance on the 2nd floor, the WiFi fingerprint data at the staircase entrance on the 4th floor, and the WiFi fingerprint data at the staircase entrance on the 6th floor.
[0102] S205, determining the floor at the end of each cross-floor operation according to the change in the air pressure value.
[0103] In some embodiments, the electronic device can also detect the change in the air pressure value within a second preset time period, wherein, when the change in the air pressure value within the second preset time period is less than a fifth threshold, the electronic device can determine that the user is stable on a certain floor and no longer crosses floors.
[0104] When the electronic device enters the building, because the electronic device is constantly collecting air pressure values, when the cross-floor crossing is completed, the electronic device can also collect the air pressure values at the elevator entrance, escalator entrance, or stair entrance at the end of the cross-floor crossing. In the embodiment of the present application, when the user is stable on a certain floor, the electronic device can obtain the floor at the end of each cross-floor crossing based on the air pressure value at the entrance of the building and the air pressure value at the end of each cross-floor crossing.
[0105] Exemplarily, after the electronic device enters the building, the user takes the elevator from the 1st floor to the 6th floor. During the elevator's upward movement, the elevator stops once on the 2nd floor, once on the 4th floor, and finally stops on the 6th floor, and the user gets off the elevator. Among them, the electronic device can detect 3 cross-layers, the first cross-layer is from the 1st floor to the 2nd floor, the second cross-layer is from the 2nd floor to the 4th floor, and the third cross-layer is from the 4th floor to the 6th floor. After the user gets off the elevator from the 6th floor, the electronic device detects that the change in the air pressure value within the second preset time is less than the fifth threshold, and it can be determined that the user is stable on the 6th floor and no longer crosses the floor. After the electronic device enters the building, the electronic device has been collecting air pressure values. Therefore, during the elevator's upward movement, the electronic device can obtain the air pressure values at the end of the 3 cross-layers, which are air pressure value 1 at the end of the first cross-layer, air pressure value 2 at the end of the second cross-layer, and air pressure value 3 at the end of the third cross-layer.
[0106] Exemplarily, when the electronic device enters the building, the air pressure value collected by the electronic device is air pressure value 0, and the air pressure value 0 can be used as the air pressure value at the entrance of the building. The electronic device can obtain the difference 1 between air pressure value 1 and air pressure value 0. Because the change in air pressure is related to the change in height, the electronic device can obtain the height change 1 corresponding to difference 1 based on difference 1. Similarly, the electronic device can obtain the difference 2 between air pressure value 2 and air pressure value 0, and based on difference 2, obtain the height change 2 corresponding to difference 2. Similarly, the electronic device can obtain the difference 3 between air pressure value 3 and air pressure value 0, and based on difference 3, obtain the height change 3 corresponding to difference 3.
[0107] In some embodiments, it is known that the height of each floor of the building is Am, and the default building entrance is floor 1. The electronic device can determine the floor at the end of the first cross-floor as "1+height change 1 / A" based on the height change 1, the electronic device can determine the floor at the end of the second cross-floor as "1+height change 2 / A" based on the height change 2, and the electronic device can determine the floor at the end of the third cross-floor as "1+height change 3 / A" based on the height change 3.
[0108] Because the floor heights of different buildings are different, in order to increase the scope of application of the floor positioning method in the embodiment of the present application and cover all buildings, the height of each floor can be set to Am-Bm, and the default building entrance is the 1st floor. In this example, the electronic device can determine the floor at the end of the first cross-layer based on the height change 1. For example, the electronic device can calculate the height change 1 / A, and calculate the height change 1 / B, and obtain the floor range at the end of the first cross-layer as {1+height change 1 / B, 1+height change 1 / A}. The electronic device can determine the floor at the end of the first cross-layer based on the floor range at the end of the first cross-layer.
[0109] In some embodiments, if the floor range {1+height change 1 / B, 1+height change 1 / A} contains an integer, the integer can be used as the floor at the end of the first cross-floor. Exemplarily, the floor range is {1.5, 2.5}, and an integer "2" is included between 1.5 and 2.5, and the electronic device can determine that the floor at the end of the first cross-floor is the second floor.
[0110] In some embodiments, if the floor range {1+height change 1 / B, 1+height change 1 / A} contains multiple integers, the electronic device can use the multiple integers as candidate floors at the end of the first cross-layer. In some embodiments, the electronic device can use the floor closest to the mean among the candidate floors as the floor at the end of the first cross-layer. Exemplarily, the floor range {1.5, 4.5}, the electronic device can contain three integers 2, 3, 4 between 1.5 and 4.5, and the electronic device can use the 2nd, 3rd, and 4th floors as candidate floors at the end of the first cross-layer. Among them, the mean of 1.5 and 4.5 is 3, and the electronic device can determine that the floor is the 3rd floor at the end of the first cross-layer. In some embodiments, the electronic device can use any floor among the candidate floors as the floor at the end of the first cross-layer. Exemplarily, the electronic device can use the 2nd, 3rd, or 4th floor as the floor at the end of the first cross-layer.
[0111] In this example, the electronic device cannot accurately determine the floor at the end of a cross-layer based only on the height change at the end of a cross-layer. In order to improve the accuracy of the electronic device in determining the floor at the end of a cross-layer, the electronic device can use the multiple integers as candidate floors at the end of the first cross-layer, and the electronic device can determine the floor at the end of the first cross-layer in combination with the height change at the end of other cross-layers. In other words, the electronic device can determine the floor at the end of the first cross-layer in combination with the height change at the end of multiple cross-layers when the electronic device enters the building once.
[0112] For example, the electronic device may select the 2nd, 3rd, and 4th floors as candidate floors when the first cross-layer operation ends. Similarly, the electronic device may calculate the height change 2 / A and the height change 2 / B to obtain the range of floors {1+height change 2 / B, 1+height change 2 / A} when the second cross-layer operation ends.
[0113] Referring to the description of "the floor range at the end of the first cross-layer operation", if the floor range {1+height change 2 / B, 1+height change 2 / A} contains an integer, the electronic device can use the integer as the floor at the end of the second cross-layer operation. If the floor range {1+height change 2 / B, 1+height change 2 / A} contains multiple integers, the electronic device can use the multiple integers as candidate floors at the end of the second cross-layer operation. In some embodiments, the electronic device can use the floor close to the mean among the candidate floors as the floor at the end of the second cross-layer operation, or the electronic device can determine the floors at the end of the two cross-layer operations based on the height change at the end of the two cross-layer operations.
[0114] It should be understood that compared with the height at the entrance of the building, the electronic device can accurately calculate the height change at the end of each cross-layer by combining the air pressure value collected at the end of each cross-layer. Because the range of each floor height "Am-Bm" is not set properly, the floor at the end of each cross-layer obtained by the electronic device is inaccurate. The electronic device can combine the height change at the end of two or more cross-layers to determine the floor at the end of two cross-layers.
[0115] For example, the candidate floors at the end of the first layer crossing are the 2nd, 3rd, and 4th floors, and the candidate floors at the end of the second layer crossing are the 3rd, 4th, and 5th floors. Because the user has performed layer crossing, the floors at the end of the two layer crossings are different. Therefore, when the candidate floor at the end of the first layer crossing is the 2nd floor, the floors at the end of the second layer crossing may be the 3rd, 4th, and 5th floors. When the candidate floor at the end of the first layer crossing is the 3rd floor, the floors at the end of the second layer crossing may be the 4th and 5th floors. When the candidate floor at the end of the first layer crossing is the 4th floor, the floor at the end of the second layer crossing may be the 5th floor.
[0116] In the embodiment of the present application, the electronic device can calculate the quotient of the height change 2 and the height change 1, "height change 2 / height change 1", and the electronic device can determine the floor at the end of the two cross-floor trips based on the quotient. For example, if the quotient is 3, the following conditions can be obtained:
[0117] When the candidate floor at the end of the first layer crossing is the 2nd floor, it means that the floor of the first layer crossing is the 1st floor. Because the quotient is 3, the floor at the end of the second layer crossing can be the 4th floor. In this way, the height change at the end of the second layer crossing (4th floor - 1st floor) is 3 times the height change at the end of the first layer crossing (2nd floor - 1st floor).
[0118] When the candidate floor at the end of the first cross-layer is the 3rd floor, it means that the floor of the first cross-layer is the 2nd floor. According to the quotient value of 3, the height change at the end of the second cross-layer should be 3 times that of the 2nd floor, that is, the 6th floor. The floor at the end of the second cross-layer should be the 7th floor, which is not included in the range of "3rd floor, 4th floor, 5th floor". In addition, when the candidate floor at the end of the first cross-layer is the 4th floor, it means that the floor of the first cross-layer is the 3rd floor. According to the quotient value of 3, the height change at the end of the second cross-layer should be 3 times that of the 3rd floor, that is, the 9th floor. The floor at the end of the second cross-layer should be the 10th floor, which is not included in the range of "3rd floor, 4th floor, 5th floor".
[0119] In summary, the electronic device can determine the floor at the end of the first cross-floor trip as the 2nd floor and the floor at the end of the second cross-floor trip as the 4th floor by combining the height changes at the end of the two cross-floor trips. In other words, when the electronic device enters a building, the electronic device can determine the floor at the end of each cross-floor trip by combining the height changes at the end of multiple cross-floor trips.
[0120] In a possible scenario, for example, if the quotient "height change 2 / height change 1" is 2, the following two situations may be met:
[0121] When the candidate floor at the end of the first layer crossing is the 2nd floor, it means that the floor of the first layer crossing is the 1st floor. The quotient is calculated as 2. On the basis of the 2nd floor, one more layer is crossed, and the floor at the end of the second layer crossing can be the 3rd floor. In this way, the height change at the end of the second layer crossing (3rd floor - 1st floor) is twice the height change at the end of the first layer crossing (2nd floor - 1st floor).
[0122] When the candidate floor at the end of the first layer crossing is the 3rd floor, it means that the floor of the first layer crossing is the 2nd floor. With the quotient value of 2, 2 more layers are crossed on the basis of the 3rd floor, and the floor at the end of the second layer crossing can be the 5th floor. In this way, the height change at the end of the second layer crossing (5th floor - 1st floor) is twice the height change at the end of the first layer crossing (3rd floor - 1st floor).
[0123] In this scenario, the electronic device still cannot determine the floor at the end of the first cross-layer operation and the floor at the end of the second cross-layer operation based on the height change at the end of the two cross-layer operations. In an embodiment of the present application, the electronic device can continue to determine the floor at the end of the third cross-layer operation based on the height change 3 at the end of the third cross-layer operation.
[0124] Take the case where the candidate floors at the end of the third cross-floor crossing are the 4th, 5th, and 6th floors as an example:
[0125] In some embodiments, the electronic device can calculate the quotient of the height change 3 and the height change 1 "height change 3 / height change 1", and the quotient of the height change 3 and the height change 2 "height change 3 / height change 2", and the electronic device can combine the two quotients to continue to determine the floor at the end of the three cross-layers. It should be understood that the electronic device can calculate the quotient of the height change 3 and the height change 1 "height change 3 / height change 1", and / or the quotient of the height change 3 and the height change 2 "height change 3 / height change 2", and the electronic device can combine at least one of the quotients to determine the floor at the end of the three cross-layers.
[0126] Exemplarily, taking the quotient of "height change 2 / height change 1" as 2 and the quotient of "height change 3 / height change 2" as 2 as an example, based on the above description, the following two situations are included: the candidate floor at the end of the first cross-layer is the 2nd floor, and the candidate floor at the end of the second cross-layer is the 3rd floor, and the candidate floor at the end of the first cross-layer is the 3rd floor, and the candidate floor at the end of the second cross-layer is the 5th floor. The following analysis is combined with the quotient of "height change 3 / height change 2" as 2:
[0127] When the candidate floor at the end of the first cross-layer is the 2nd floor, it means that the floor of the first cross-layer is the 1st floor, and the quotient of "height change 2 / height change 1" is 2. On the basis of the 2nd floor, one more floor is crossed, and the floor at the end of the second cross-layer is the 3rd floor. The floor of the second cross-layer is the 1st floor, and the quotient of "height change 3 / height change 2" is 2. On the basis of the 3rd floor, two more floors are crossed, and the floor at the end of the third cross-layer is the 5th floor. In this way, the quotient of "height change 2 (3rd floor - 1st floor) / height change 1 (2nd floor - 1st floor)" is 2, and the quotient of "height change 3 (5th floor - 1st floor) / height change 2 (3rd floor - 1st floor)" is 2.
[0128] However, when the candidate floor at the end of the first cross-layer is the 3rd floor, it means that the floor of the first cross-layer is the 2nd floor. The quotient of "height change 2 / height change 1" is 2, and the floor at the end of the second cross-layer is 2nd floor. The floor at the end of the second cross-layer is the 5th floor. The floor at the end of the second cross-layer is the 2nd floor. The quotient of "height change 3 / height change 2" is 2, and the floor at the end of the third cross-layer is 4th floor. It is not included in "4th floor, 5th floor, 6th floor", so the electronic device can exclude this situation.
[0129] In summary, the electronic device can accurately determine that the floor at the end of the first cross-floor crossing is the 2nd floor, the floor at the end of the second cross-floor crossing is the 3rd floor, and the floor at the end of the third cross-floor crossing is the 5th floor by combining the height changes at the end of three cross-floor crossings. In other words, when the electronic device enters the building, the electronic device can determine the floor at the end of each cross-floor crossing by combining the height changes at the end of multiple cross-floor crossings.
[0130] It should be understood that if there is no crossing of floors after the electronic device enters the building, or at least one crossing of floors that exists is not sufficient to support the electronic device to calculate the floor at the end of the crossing, the electronic device can combine data such as the height change at the end of the crossing of floors after entering the building multiple times to calculate the floor at the end of each crossing. Please refer to the above description of "After the electronic device enters the building, the electronic device can combine the height change at the end of multiple crossings to determine the floor at the end of each crossing."
[0131] In some embodiments, the electronic device can obtain the floor at the end of each cross-floor operation based on the air pressure value at the entrance and the air pressure value at the end of each cross-floor operation. Please refer to the description in the above embodiments.
[0132] It should be understood that in some embodiments, after detecting that the electronic device enters a building, the electronic device can also detect that the user leaves the building. When the electronic device detects that the electronic device leaves the building, the data of the electronic device entering the building can be stored together, so that the electronic device can distinguish the data collected when entering the building at different times, the data obtained by calculation, etc.
[0133] S206, constructing a WiFi fingerprint database of the building according to the WiFi fingerprint data of the building entrance, the floor at the end of each cross-floor crossing, and the WiFi fingerprint data collected at the end of each cross-floor crossing.
[0134] The default floor at the building entrance is the 1st floor. The electronic device can store the floor at the building entrance (1st floor) and the WiFi fingerprint data of the building entrance accordingly. In addition, the electronic device can collect WiFi fingerprint data at the end of each cross-layer. Therefore, after the electronic device determines the floor at the end of each cross-layer, the electronic device can store the WiFi fingerprint data collected at the end of each cross-layer and the floor at the end of each cross-layer to construct a WiFi fingerprint database of the building.
[0135] Among them, the WiFi fingerprint database of the building includes: WiFi fingerprint data of key locations of at least one floor. Among them, the key locations may include the entrance of the building, and the elevator floor, escalator entrance or stair entrance at the end of each cross-layer. Exemplarily, the WiFi fingerprint database of the building may include: the identification of the floor, the identification of the key location in the floor, and the WiFi fingerprint data of the key location. Among them, the identification of the floor can be such as -1 floor, 1 floor, 2 floor, 3 floor, etc. Taking the 1st floor as an example, the identification of the key location in the 1st floor can be, for example, 1-1, 1-2, etc. In the embodiment of the present application, there is no limitation on the identification of the floor and the identification of the key location in the floor.
[0136] S207, store the floors of the building entrances and the WiFi fingerprint data of the building entrances in correspondence with each other.
[0137] In an embodiment of the present application, when an electronic device enters a building, if there is no cross-floor operation, that is, the user does not go up or down the stairs, the electronic device can default the floor of the building entrance to the first floor, and store the building entrance floor and the WiFi fingerprint data of the building entrance correspondingly.
[0138] Figure 2 The section introduces the process of electronic devices collecting air pressure values, WiFi fingerprint data at the building entrance, and WiFi fingerprint data at the end of each floor crossing after the electronic device enters the building. It also introduces a method for the electronic device to determine the floor at the end of each floor crossing based on the air pressure value. The following is an overall introduction to the process of electronic devices building a building's WiFi fingerprint database.
[0139] Phase 1:
[0140] When the electronic device enters the building for the first time, the electronic device may execute S201-S207. If the electronic device can determine the floor where the key location is located based on the air pressure value and WiFi fingerprint data collected when the electronic device enters the building for the first time, the electronic device may build a WiFi fingerprint database for the building. In some embodiments, the WiFi fingerprint database may be referred to as an initial WiFi fingerprint database.
[0141] In some embodiments, when the electronic device enters the building for the first time, the entrance of the building can be called the first key position, and the elevator entrance, stair entrance or escalator entrance at the end of each cross-layer is called the second key position. Among them, when the electronic device enters the building for the first time, there is one first key position, at least one second key position, and each second key position can correspond to a floor, and reference can be made to the description in S205. It should be understood that when the electronic device enters the building for the first time, if there is no cross-layer, the entrance of the building can be called the first key position, and there is no second key position.
[0142] When the electronic device enters the building for the first time, the electronic device may collect a first air pressure value sequence and a first WiFi fingerprint data sequence. The first air pressure value sequence includes: a first air pressure value collected at a preset frequency after the electronic device enters the building. The first WiFi fingerprint data sequence includes: WiFi fingerprint data of a key position. The key position may include a first key position, or the key position may include a first key position and a second key position.
[0143] In an embodiment of the present application, the electronic device can detect whether there is a cross-layer when the electronic device enters a building for the first time based on the first air pressure value sequence. Exemplarily, when it is detected that the change in the first air pressure value within the first preset time length is greater than or equal to the third threshold, the electronic device determines that the cross-layer begins, and when it is detected that the change in the first air pressure value within the first preset time length is less than the fourth threshold, the electronic device determines that the cross-layer ends, and the specific description can be referred to in S203. Among them, when there is a cross-layer, the key position may include the first key position and the second key position, and when there is no cross-layer, the key position may include the first key position.
[0144] When the key position includes a second key position, there is at least one second key position. For each second key position, the electronic device can obtain the first height variable according to the first air pressure value of the second key position and the first air pressure value of the first key position, and the first height change can be understood as the height difference between the floor where the second key position is located and the floor where the first key position is located. In some embodiments, the floor where the first key position is located can be defaulted to the 1st floor.
[0145] In the embodiment of the present application, the electronic device may determine the floor where the second key position is located according to the first height change. Alternatively, the electronic device may determine the floor where each second key position is located according to the height change of the floor where at least one second key position is located and the floor where the first key position is located, and the specific details may refer to the description in S205.
[0146] Wherein, referring to the description in S205, in some embodiments, if the electronic device can determine the floor where each second key position is located when entering the building for the first time, the electronic device can store the floor where each key position is located and the WiFi fingerprint data of each key position accordingly to build a WiFi fingerprint database, which can refer to the description in S206. Exemplarily, the electronic device can store the floor (1st floor) where the first key position is located and the WiFi fingerprint data of the first key position accordingly, and store the floor where each second key position is located and the WiFi fingerprint data of each second key position accordingly to build the WiFi fingerprint database of the building.
[0147] In some embodiments, referring to the description in S205, if the electronic device fails to determine the floor where each second key position is located when the electronic device enters the building for the first time, the electronic device can determine the floor where each second key position is located based on the height change of the key position when the user enters the building multiple times, so as to construct a WiFi fingerprint database for the building, which can refer to the description in the following embodiments.
[0148] Phase 2:
[0149] In a scenario where an electronic device enters a building multiple times, when the electronic device enters the building for the nth time, the electronic device may execute S201-S205 to obtain a second air pressure value sequence and a second WiFi fingerprint data sequence. The second WiFi fingerprint data sequence may include: WiFi fingerprint data of key locations when the user enters the building. The key locations may include: the building entrance, and the elevator entrance, escalator entrance, or stair entrance at the end of each cross-floor crossing.
[0150] Taking n as 2 as an example, when the electronic device enters the building for the second time, the electronic device can execute S201-S205 to obtain the second air pressure value sequence and the second WiFi fingerprint data sequence. For example, the second WiFi fingerprint data sequence includes "WiFi fingerprint data at the fourth key position when the electronic device enters the building, and WiFi fingerprint data at the fifth key position when the cross-layer ends".
[0151] In an embodiment of the present application, the fifth key position is the elevator entrance, escalator entrance or stair entrance at the end of the cross-layer, and the fifth key position may be at least one. At least one fifth key position and at least one second key position may overlap or not overlap. The fourth key position can be regarded as the entrance to the building, and the fourth key position may be the same as or different from the first key position. Exemplary, for example, the building has two entrances, the electronic device enters the building from entrance 1 (first key position) for the first time, and the electronic device enters the building from entrance 2 (fourth key position) for the second time, and the fourth key position is different from the first key position. For example, the electronic device enters the building from entrance 1 (first key position) for the first time, and the electronic device enters the building from entrance 1 (fourth key position) for the second time, and the fourth key position is the same as the first key position.
[0152] Similar to the calculation method when the electronic device enters the building for the first time, when the electronic device enters the building for the second time, the electronic device can detect whether there is a cross-layer when the electronic device enters the building for the second time according to the second air pressure value sequence, and reference can be made to the description in S203. Wherein, when there is a cross-layer, the key position may include the fourth key position and the fifth key position, and when there is no cross-layer, the key position may include the fourth key position.
[0153] When the key position includes the fifth key position, the fifth key position is at least one. For each fifth key position, in an embodiment of the present application, the electronic device can obtain the third height change of the floor where the fifth key position is located and the floor where the fourth key position is located according to the second air pressure value of the fourth key position and the second air pressure value of the fifth key position. In some embodiments, the floor where the fourth key position is located can be defaulted to the 1st floor. In an embodiment of the present application, the electronic device can determine the floor where the fifth key position is located according to the third height change, and the calculation method can refer to the description in S205. In some embodiments, there is at least one fifth key position, and each fifth key position can correspond to a floor.
[0154] In an embodiment of the present application, if the electronic device can determine the floor where each fifth key position is located according to the calculation method in S205, the electronic device can store the floor where the fourth key position is located (such as the first floor) and the WiFi fingerprint data of the fourth key position accordingly, and the electronic device can store the floor where each fifth key position is located and the WiFi fingerprint data of each fifth key position accordingly.
[0155] In some embodiments, if the electronic device cannot determine the floor where the second key position is located when the electronic device enters the building for the first time based on the calculation method in S205, and / or cannot determine the floor where the fifth key position is located when the electronic device enters the building for the second time, the electronic device can determine the floor where each second key position is located and the floor where the fifth key position is located based on the change in height of the key positions when the user enters the building multiple times.
[0156] Among them, the electronic device can obtain the similarity of the WiFi fingerprint data of any two key positions when the electronic device enters the building at different times. Exemplarily, the electronic device can obtain the first similarity between the WiFi fingerprint data of the first key position and the WiFi fingerprint data of the fourth key position, the second similarity between the WiFi fingerprint data of the first key position and the WiFi fingerprint data of each fifth key position, the third similarity between the WiFi fingerprint data of the fourth key position and the WiFi fingerprint data of each second key position, and the fourth similarity between the WiFi fingerprint data of each fifth key position and the WiFi fingerprint data of each second key position.
[0157] The electronic device may regard key positions with a similarity greater than or equal to a similarity threshold as the same key position. Exemplarily, for example, if the first similarity is greater than the similarity threshold, the electronic device may regard the first key position and the fourth key position as the same key position, for example, the electronic device may regard the first key position and the fourth key position as the same entrance to a building. Exemplarily, for example, if the fourth similarity of the WiFi fingerprint data of the second key position 1 and the WiFi fingerprint data of the fifth key position 1 is greater than the similarity threshold, the electronic device may regard the second key position 1 and the fifth key position 1 as the same key position.
[0158] In an embodiment of the present application, the electronic device can obtain the similarity of the WiFi fingerprint data of any two key positions when entering the building at different times, and use the key positions with similarity greater than or equal to the similarity threshold as the same key position. In this way, the electronic device can align the same key position. Among them, when the electronic device enters the building at different times, the electronic device determines that the same key position is located at different floors, and the electronic device can determine that there is an error in the floor where the same key position is located. As for how to determine the correct floor where the same key position is located, the electronic device can cluster the floors where the same key position is located when entering the building at different times to obtain the correct floor where the same key position is located. Alternatively, the electronic device can also use the floor with the highest proportion among the floors where the same key position is located when entering the building at different times as the correct floor where the same key position is located.
[0159] Among them, after the electronic device determines the floor where the same key position is located, the electronic device can refer to the description in S205, and the electronic device can re-determine the floor where each key position is located according to the height change (such as the first height change, the third height change) of each key position when the electronic device enters the building for different times. In the embodiment of the present application, after obtaining the floor where each key position in the building is located, the electronic device can construct a WiFi fingerprint database of the building according to the floor where each key position is located and the WiFi fingerprint data of each key position.
[0160] It should be understood that after determining the floor where the same key position is located, the electronic device can also detect whether there is an incorrect floor among the floors where each second key position is located and the floors where each fifth key position is located. When an incorrect floor exists, the electronic device can modify the incorrect floor to a correct floor according to the floor where the same key position is located and the height change amount of the key position.
[0161] For example, refer to Figure 3In a, when the electronic device enters the building for the first time, the elevator stops at the 3rd floor and the 5th floor respectively, and the user gets off the elevator at the 6th floor. Referring to the description in S205, the electronic device can determine three second key positions, namely, the second key position 1 (3rd floor), the second key position 2 (5th floor), and the second key position 3 (6th floor), and the electronic device can determine the floor where each second key position is located. For example, referring to the description in S205, the electronic device can determine that the floor where the second key position 1 is located is the 3rd floor, the floor where the second key position 2 is located is the 5th floor, and the floor where the second key position 3 is located is the 6th floor.
[0162] Reference Figure 3 In b, when the electronic device enters the building for the second time, the elevator stops at the 3rd floor, and the user gets off the elevator at the 6th floor. Referring to the description in S205, the electronic device can determine two fifth key positions, namely the fifth key position 1 (3rd floor) and the fifth key position 2 (6th floor). Referring to the description in S205, the electronic device cannot accurately determine the floor where the fifth key position 1 is located, and the floor where the fifth key position 2 is located, based on the third height change between the fifth key position 1 and the fourth key position, and the third height change between the fifth key position 2 and the fourth key position. For example, the electronic device can determine that the floor where the fifth key position 1 is located may be the 2nd floor, the 3rd floor or the 4th floor, and the floor where the fifth key position 2 is located may be the 4th floor, the 5th floor or the 6th floor. Among them, there is an incorrect floor in the floor "2nd floor, the 3rd floor or the 4th floor" where the fifth key position 1 is located, and there is an incorrect floor in the floor "4th floor, the 5th floor or the 6th floor" where the fifth key position 2 is located.
[0163] By calculating the similarity of WiFi fingerprint data at different key positions after the electronic device enters the building twice, the electronic device can determine that the similarity of the WiFi fingerprint data at the second key position 1 and the fifth key position 1 is greater than the similarity threshold. The electronic device can determine that the second key position 1 and the fifth key position 1 are the same key position, because when the electronic device enters the building for the first time, the electronic device can accurately determine the floor where the second key position 1 is located, and because the second key position 1 and the fifth key position 1 are the same key position, the electronic device can determine that the floor where the fifth key position 1 is located is the 3rd floor.
[0164] In addition, the electronic device may also determine that the similarity between the WiFi fingerprint data of the second key position 3 and the fifth key position 2 is greater than the similarity threshold, and the electronic device may determine that the floor where the fifth key position 2 is located is the 6th floor. Alternatively, after the electronic device determines that the floor where the fifth key position 1 is located is the 3rd floor, the electronic device may also recalculate the floor where the fifth key position 2 is located as the 6th floor based on the third height change between the fifth key position 2 and the fourth key position, and the third height change between the fifth key position 1 and the fourth key position. The calculation method may refer to the description in S205.
[0165] In this way, the electronic device can accurately determine the floor where each key position is located each time the building is entered by combining the data obtained after the electronic device enters the building multiple times. Then the electronic device can update the initial WiFi fingerprint database according to the floor where each key position is located to obtain the WiFi fingerprint database of the building.
[0166] It should be understood that when the electronic device enters the building for the third time, the fourth time, ..., and the nth time, the electronic device can continuously update the WiFi fingerprint database based on the data obtained after entering the building multiple times, and the accuracy of the WiFi fingerprint database is gradually improved. Among them, the more times the electronic device enters the building and the greater the difference in the key position each time it enters the building, the more accurate the WiFi fingerprint database of the building can be obtained by the electronic device.
[0167] In some scenarios, a floor includes multiple elevator entrances, escalator entrances, and staircase entrances. In order to more accurately distinguish each elevator entrance, escalator entrance, and staircase entrance, in an embodiment of the present application, in addition to collecting WiFi fingerprint data at the stair entrance and WiFi fingerprint data at the end of each cross-floor movement, the electronic device can also collect WiFi fingerprint data at the beginning of each cross-floor movement.
[0168] For example, a user takes elevator 1 from the 1st floor to the 3rd floor, and then continues to take elevator 1 to the 5th floor. Based on cross-floor detection, the electronic device can collect WiFi fingerprint data of elevator port 1 on the 3rd floor and WiFi fingerprint data of elevator port 1 on the 5th floor. For example, a user takes elevator 1 from the 1st floor to the 3rd floor, and then walks to elevator 2 and takes elevator 2 to the 5th floor. Based on cross-floor detection, the electronic device can collect WiFi fingerprint data of elevator port 1 on the 3rd floor and WiFi fingerprint data of elevator port 2 on the 5th floor. However, because the electronic device collects WiFi fingerprint data at the end of the cross-floor, the electronic device does not collect WiFi fingerprint data of elevator port 2 on the 3rd floor. In this way, the WiFi fingerprint data of elevator port 2 on the 3rd floor is not included in the WiFi fingerprint database of the building. If the user is located at elevator port 2 on the 3rd floor, the electronic device cannot locate the floor where the electronic device is located using the WiFi fingerprint database of the building.
[0169] In order to more accurately distinguish each elevator entrance, escalator entrance, and stair entrance, enrich the WiFi fingerprint database of key locations of the building, and facilitate accurate positioning, in some embodiments, the electronic device can collect WiFi fingerprint data when the cross-floor crossing starts when it detects that the cross-floor crossing starts. In addition, the electronic device can also determine the floor when the cross-floor crossing starts based on the air pressure value at the building entrance and the air pressure value when the cross-floor crossing starts. Please refer to the description of "Determining the floor when the cross-floor crossing ends" in S205.
[0170] In some embodiments, when the key position also includes the position of the elevator entrance or staircase entrance when starting to cross floors, taking the first time that the electronic device enters the building and the nth time that the electronic device enters the building as examples, the process of the electronic device building and updating the WiFi fingerprint database is introduced:
[0171] When the electronic device enters the building for the first time, the first WiFi fingerprint data sequence may further include: WiFi fingerprint data of the third key position when starting to cross floors. When the electronic device enters the building for the nth time, the second WiFi fingerprint data sequence may further include: WiFi fingerprint data of the sixth key position when starting to cross floors.
[0172] Similar to the second key position at the end of the cross-layer, the electronic device can obtain the second height change according to the first air pressure value of the third key position and the first air pressure value of the first key position, and the second height change is the height change (or height difference) between the floor where the third key position is located and the floor where the first key position is located. The electronic device can determine the floor where the third key position is located according to the second height change.
[0173] In some embodiments, if the electronic device can obtain the floor where each second key position is located based on the first height change, and can obtain the floor where each third key position is located based on the third height change, then the electronic device can store the floor where the first key position is located and the WiFi fingerprint data of the first key position in correspondence, store the floor where the second key position is located and the WiFi fingerprint data of the second key position in correspondence, and store the floor where the third key position is located and the WiFi fingerprint data of the third key position in correspondence, to construct a WiFi fingerprint database.
[0174] Similarly, when the electronic device enters the building for the nth time, the electronic device can obtain the fourth height change between the floor where the sixth key position is located and the floor where the third key position is located based on the second air pressure value at the fourth key position and the second air pressure value at the sixth key position. The electronic device can determine the floor where the sixth key position is located based on the fourth height change.
[0175] In the embodiment of the present application, because the electronic device can obtain the floor where the third key position is located when starting to cross the layer, and the floor where the sixth key position is located, therefore, when the electronic device obtains different times to enter the building, it can obtain the similarity of the WiFi fingerprint data of any two key positions, and the key position includes the position when starting to cross the layer (such as the third key position, the sixth key position). Similarly, the electronic device can take the key position whose similarity is greater than or equal to the similarity threshold as the same key position, and cluster the floors where the same key position is located to obtain the floor where the same key position is located. After the electronic device determines the floor where the same key position is located, the electronic device can determine the floor where each key position is located according to the height change of each key position, and the electronic device can build or update the WiFi fingerprint database of the building according to the floor where each key position is located and the WiFi fingerprint data of each key position.
[0176] For example, refer to Figure 4 For example, when a user takes an elevator upstairs, the electronic device enters the building for the first time from the building entrance 1-1. The electronic device can determine the key position 1. Figure 4 The user takes elevator 1 to the 3rd floor and then gets off the elevator. The electronic device can determine the key position 2 at the end of the cross-floor trip. The key position 2 is the elevator 1 on the 3rd floor. Figure 4 The user walks to another elevator 2 on the 3rd floor, takes the elevator 2 upstairs, and stops at the 5th floor. The electronic device can determine the key position 3 at the beginning of the cross-floor crossing and the key position 4 at the end of the cross-floor crossing. Among them, the key position 3 is the elevator 2 entrance on the 3rd floor. Figure 4 The key position 4 is the elevator 2 on the 5th floor. Figure 4 In addition, the user takes elevator 2 to the 6th floor and gets off the elevator. The electronic device can determine the key position 5 at the end of the cross-floor trip, because the key position at the beginning of the cross-floor trip is key position 4, and the electronic device does not make repeated records. Among them, key position 5 is elevator exit 2 on the 6th floor. Figure 4 The mark is 6-2.
[0177] Reference Figure 4 When the electronic device enters the building for the second time, it enters from the building entrance 1-1. The electronic device can determine the key position 1A. Figure 4 The user takes elevator 1 to the 4th floor and then gets off the elevator. The electronic device can determine the key position 2A at the end of the cross-floor trip. The key position 2A is the elevator exit 1 on the 4th floor. Figure 4The user walks to another elevator 2 on the 4th floor, takes the elevator 2 upstairs, and gets off the elevator on the 6th floor. The electronic device can determine the key position 3A when the cross-floor crossing begins, and the key position 4A when the cross-floor crossing ends. Among them, the key position 3A is the elevator 2 exit on the 4th floor. Figure 4 The key location 4A is the elevator 2 on the 6th floor. Figure 4 The mark is 6-2.
[0178] Reference Figure 4 When the electronic device enters the building for the third time, it enters from building entrance 1-2. The electronic device can determine the key position 1B. Figure 4 The user takes elevator 1 to the 2nd floor and gets off the elevator. The electronic device can determine the key position 2B at the end of the cross-floor trip. The key position 2A is the elevator 1 exit on the 2nd floor. Figure 4 The user walks to another elevator 2 on the 2nd floor, takes the elevator 2 upstairs, and gets off the elevator on the 3rd floor. The electronic device can determine the key position 3B when the cross-floor starts, and the key position 4B when the cross-floor ends. The key position 3B is the elevator 2 on the 2nd floor. Figure 4 The key location 4B is the elevator exit 2 on the 3rd floor. Figure 4 The user walks to another elevator 3 on the 3rd floor, takes the elevator 3 upstairs, and gets off the elevator on the 5th floor. The electronic device can determine the key position 5B when the cross-floor crossing begins, and the key position 6B when the cross-floor crossing ends. The key position 5B is the elevator exit 3 on the 3rd floor. Figure 4 The key location 6B is the elevator exit 3 on the 5th floor. Figure 4 Marked as 5-3.
[0179] Combined with the similarity of the WiFi fingerprint data at different key positions when the electronic device enters the building three times, the electronic device can determine that the key position 3 when entering the building for the first time is the same as the key position 5B when entering the building for the third time. In addition, the electronic device can determine that the key position 5 when entering the building for the first time is the same as the key position 4A when entering the building for the second time. In addition, by calculating the similarity of the WiFi fingerprint data at the entrance each time entering the building, the electronic device can determine that the similarity between the WiFi fingerprint data at the entrance when entering the building for the first time and the WiFi fingerprint data at the entrance when entering the building for the second time is greater than the similarity threshold, and the similarity between the WiFi fingerprint data at the entrance when entering the building for the second time and the WiFi fingerprint data at the entrance when entering the building for the third time is less than the similarity threshold. In this way, the electronic device can determine that the building has two entrances, namely entrance 1-1 and entrance 1-2.
[0180] In addition, the electronic device can align the floors where the same key position is located, wherein when the electronic device enters the building at different times, if the floors where the same key position is located determined by the electronic device are different, the electronic device can determine that the floor where the same key position is located is wrong. The electronic device can cluster the floors where the same key position is located when entering the building at different times to obtain the correct floor where the same key position is located.
[0181] After the electronic device determines the correct floor where the same key position is located, the electronic device can re-determine the floor where the other key positions are located based on the height change of other key positions (such as the height change when the cross-floor crossing ends and when the electronic device enters the building, and / or the height change when the cross-floor crossing starts and when the electronic device enters the building). For details, please refer to the description in S205.
[0182] In an embodiment of the present application, each time the electronic device enters a building, the electronic device can determine the floor where each key position is located according to the collected air pressure value sequence. In addition, the electronic device can also collect the WiFi fingerprint data of each key position, so the electronic device can store the floor where each key position is located and the WiFi fingerprint data of each key position accordingly. In addition, the electronic device can also determine the same key position in combination with the similarity of the WiFi fingerprint data of each key position determined when the electronic device enters the building multiple times. When there is an error in the floor where the same key position is located, a clustering method can be used to cluster the floor where the same key position is located. After determining the floor where the same key position is located, the electronic device can also re-determine the floors where other key positions are located based on the height changes of other key positions. In this way, the electronic device can accurately determine the floor where each key position is located, and then obtain an accurate WiFi fingerprint database of the building. The WiFi fingerprint database of the building may include fingerprint data of the key position of at least one floor.
[0183] It is conceivable that when a user enters different buildings, the electronic device can construct WiFi fingerprint databases of different buildings according to the description in the above embodiments.
[0184] Reference Figure 5 , Figure 5 Taking a watch as an example, after the electronic device enters a building, the electronic device can collect air pressure values and WiFi fingerprint data of key locations. The electronic device can determine the floor where each key location is located based on the air pressure value, and then the electronic device stores the floor where each key location is located and the WiFi fingerprint data of each key location, and builds and updates the WiFi fingerprint database.
[0185] In some embodiments, the present application may also adopt crowdsourcing to build and update the WiFi fingerprint database. Figure 6 , there are multiple electronic devices in the building. After detecting that an electronic device has entered the building, each electronic device can collect air pressure values and WiFi fingerprint data at key locations, and report the air pressure value sequence and WiFi fingerprint data sequence to the server. It should be understood that the air pressure value sequence may include: collection time and air pressure value, and the WiFi fingerprint data sequence may include collection time and WiFi fingerprint data. It should be understood that, Figure 6 In the figure, air pressure is used to represent the air pressure value sequence, and WiFi is used to represent the WiFi fingerprint data sequence.
[0186] After receiving the air pressure value sequences and WiFi fingerprint data sequences from multiple electronic devices, the server can align the air pressure values and WiFi fingerprint data according to the time dimension. The server can execute S203-S207 to build and update the WiFi fingerprint database. The process of the server building and updating the WiFi fingerprint database can refer to the description in stage one and stage two.
[0187] In some embodiments, in order to enable the server to distinguish between the air pressure value sequences and WiFi fingerprint data sequences of different buildings, the electronic device may also report the building identification to the server when reporting the air pressure value sequence and WiFi fingerprint data sequence to the server. The building identification is used to distinguish between different buildings, and the building identification may include but is not limited to information such as the building number, name, and location. In this example, the electronic device can distinguish the air pressure value sequences and WiFi fingerprint data sequences of different buildings reported by the electronic device based on the building identification, so that the electronic device can build and update the WiFi fingerprint database of the building based on the air pressure value sequence and WiFi fingerprint data sequence of the same building.
[0188] In addition, when performing floor positioning, the electronic device can send the collected air pressure value and WiFi fingerprint data to the server, and the server can execute S702-S703 to obtain the floor where the electronic device is located, and feedback the floor where the electronic device is located to the electronic device. For details, please refer to Figure 7 It should be understood that Figure 6 "Floor" is used to indicate the floor where the electronic equipment is located.
[0189] In an embodiment of the present application, the electronic device can collect air pressure values and WiFi fingerprint data of key locations by itself, and build and update the WiFi fingerprint database of the building by itself. Alternatively, the server can adopt a crowdsourcing method to build and update the WiFi fingerprint database of the building based on the air pressure value sequence and WiFi fingerprint data sequence from multiple electronic devices. Among them, the advantage of using the crowdsourcing method is that even if the user has not been to the building, or has been to the building less frequently, the server can accurately build the WiFi fingerprint database of the building based on the data collected when a large number of other users enter the building, and can achieve accurate positioning of the floor.
[0190] Based on the introduction of how electronic devices or servers construct a building's WiFi fingerprint database, the following describes a process for floor positioning using the building's WiFi fingerprint database. Figure 7 A flow chart of an embodiment of the floor positioning method provided in the present application. Figure 7 The floor positioning method provided in the embodiment of the present application may include:
[0191] S701, when an electronic device is detected entering a building, air pressure values and WiFi fingerprint data of key locations are collected.
[0192] S701 may refer to the description in S201 - S202 .
[0193] In some embodiments, for example, the electronic device may detect whether the electronic device enters a building based on the location of the electronic device.
[0194] Among them, the key position may include: the key position when the electronic device enters the building, or the key position includes the key position when the electronic device enters the building and the key position at the end of crossing the floor, or the key position may include: the key position when the electronic device enters the building, the key position at the end of crossing the floor, and the key position at the beginning of crossing the floor.
[0195] For example, the key position when the electronic device enters a building can be the first key position and the fourth key position in the above embodiment. For example, the key position when the electronic device ends crossing a floor can be the second key position and the fifth key position in the above embodiment.
[0196] In the embodiment of the present application, when it is detected that the electronic device enters the building, the electronic device can continuously collect air pressure values, for example, the electronic device collects air pressure values at a preset frequency. In addition, based on the continuously collected air pressure values, when it is detected that the cross-layer starts, the electronic device can collect WiFi fingerprint data at key locations. In addition, when it is detected that the cross-layer ends, the electronic device can collect WiFi fingerprint data at key locations, and reference can be made to the description in S203-S204.
[0197] In the embodiment of the present application, when the electronic device enters a building, the electronic device does not need to scan the WiFi all the time, but scans the WiFi at key locations to collect WiFi fingerprint data, which can reduce the power consumption of the electronic device.
[0198] S702: When the first condition is met, determine the floor where the electronic device is located according to the air pressure value.
[0199] In the embodiment of the present application, the electronic device may default to the number of floors when the electronic device enters the building as 1, and the electronic device may obtain the change in the air pressure value based on the collected air pressure value, and determine the height change based on the change in the air pressure value. When the height of each floor is known, the electronic device may determine the floor where the electronic device is located based on the height change.
[0200] The first condition can be understood as a condition that the electronic device can accurately locate the floor based on the air pressure value alone. In some embodiments, the first condition can include, for example, the following three conditions:
[0201] 1. The change in air pressure value does not come from noise. For example, the electronic device can determine whether the change in air pressure value comes from noise based on the user status and the change in ambient temperature.
[0202] Exemplarily, the user state may include, but is not limited to: swimming state, walking state, running state, etc. In some embodiments, an inertial measurement unit (IMU) may be provided in the electronic device, and the electronic device may determine the user state based on the data collected by the IMU. Among them, some states of the user may cause a huge change in the air pressure value. For example, when a user wears an electronic device to swim in the water, the electronic device detects that the air pressure value increases sharply, and when the user wears the electronic device to exit the water, the electronic device detects that the air pressure value decreases sharply, wherein the change in the air pressure value is not caused by the user crossing layers, but is caused by the user state.
[0203] In the embodiment of the present application, a preset state can be pre-set, and the preset state is a change in air pressure caused by noise, such as swimming state, parachuting state, etc. Among them, when the electronic device detects a change in air pressure value, it can also determine the user state according to the data collected by the IMU. When the user state is the preset state, the electronic device can determine that the change in air pressure value comes from noise. When the user state is not the preset state, the electronic device can determine that the change in air pressure value is caused by the user crossing floors. Therefore, the electronic device can accurately locate the floor based on the air pressure value.
[0204] In addition, temperature is an important factor affecting the air pressure value. When detecting the change in the air pressure value, if the change in temperature is greater than or equal to the temperature threshold, it can be determined that the change in the air pressure value is caused by the temperature, not by the user crossing the floor. In this way, the electronic device only locates the floor based on the air pressure value, which will cause floor positioning errors. Therefore, in the embodiment of the present application, when the change in temperature is less than the temperature threshold, it indicates that the air pressure value collected by the barometer is not affected by noise, that is, the change in the air pressure value does not come from noise, and the electronic device can accurately locate the floor based on the air pressure value alone.
[0205] 2. The electronic device enters the building from the first floor. When the building has multiple entrances, and the entrances include entrances other than the first floor, because the electronic device locates the floor only based on the air pressure value, the default floor when the electronic device enters the building is 1st floor. However, when the electronic device enters the building from an entrance other than the first floor, the electronic device will incorrectly determine the floor where the electronic device is located based only on the change in the air pressure value.
[0206] Therefore, in the embodiment of the present application, when the electronic device enters the building from the first floor, the electronic device can obtain the change in the air pressure value based on the collected air pressure value, and determine the height change based on the change in the air pressure value. When the height of each floor is known, the electronic device can accurately determine the floor where the electronic device is located based on the height change.
[0207] In some embodiments, the WiFi fingerprint database of the building includes: WiFi fingerprint data of the first floor entrance of the building. When the electronic device detects that the electronic device enters the building, the WiFi fingerprint data of the electronic device when entering the building can be collected. The electronic device can obtain the WiFi fingerprint data of the electronic device when entering the building and the similarity with the WiFi fingerprint data of the first floor entrance of the building. When the similarity is greater than or equal to the similarity threshold, the electronic device can determine that the electronic device enters the building from the first floor. When the similarity is less than the similarity threshold, the electronic device can determine that the electronic device does not enter the building from the first floor. Accordingly, by using the WiFi fingerprint data similarity method, the electronic device can determine whether the electronic device enters the building from the first floor.
[0208] 3. After the electronic device enters the building, the electronic device is not restarted. After the electronic device enters the building, the electronic device can collect air pressure values at a preset frequency. If the electronic device is restarted, the collected air pressure values are lost, and the electronic device cannot determine the floor where the electronic device is located based on the air pressure values.
[0209] In an embodiment of the present application, when the electronic device enters a building, if the change in the air pressure value is less than a first threshold, the change in temperature is less than a second threshold, the electronic device enters the building from the first floor, and the electronic device is not restarted after entering the building, the electronic device can accurately determine the floor where the electronic device is located based on the air pressure value.
[0210] S703, when the first condition is not met, determine the floor where the electronic device is located based on the WiFi fingerprint data and the WiFi fingerprint database of the building, the WiFi fingerprint database of the building is constructed based on the historically collected air pressure values and WiFi fingerprint data of key locations, and the WiFi fingerprint database of the building includes: WiFi fingerprint data of key locations of at least one floor.
[0211] When the first condition is not met, the electronic device cannot determine or cannot accurately determine the floor where the electronic device is located based only on the air pressure value. In an embodiment of the present application, the electronic device can determine the floor where the electronic device is located based on the WiFi fingerprint data and the WiFi fingerprint database of the building. The electronic device can obtain the WiFi fingerprint data and the similarity of the WiFi fingerprint data of each key position in the WiFi fingerprint database of the building, and the floor where the key position with a similarity greater than the similarity threshold is located is used as the floor where the electronic device is located.
[0212] It should be understood that the WiFi fingerprint database of a building is constructed based on historically collected air pressure values and WiFi fingerprint data of key locations, and the WiFi fingerprint database of a building includes: WiFi fingerprint data of key locations of at least one floor.
[0213] In some embodiments, the WiFi fingerprint database of the building is constructed by the electronic device based on the air pressure values and WiFi fingerprint data of key locations collected historically by the electronic device. In some embodiments, the WiFi fingerprint database of the building is constructed by the server based on the air pressure values and WiFi fingerprint data of key locations collected historically by multiple electronic devices. The construction and update of the WiFi fingerprint database of the building can refer to the description in the above embodiments.
[0214] S704, output the floor where the electronic device is located.
[0215] In some embodiments, the electronic device may display the floor where the electronic device is located on the interface of the electronic device. Alternatively, the electronic device may play the audio of the floor where the electronic device is located. The embodiment of the present application does not limit the manner in which the electronic device outputs the floor where the electronic device is located.
[0216] For example, when a user uses an electronic device to locate a floor, the electronic device can display the floor the electronic device is located on the interface of the electronic device. For example, when a user is climbing stairs for fitness, the electronic device can locate the floor the electronic device is located on in real time and play the audio of the floor the electronic device is located on.
[0217] In the embodiment of the present application, for example, after a user takes an elevator from the 1st floor to the 6th floor, the user gets off the elevator to go home. When the user enters the house, he enters a low-temperature air-conditioned room from the high temperature outdoors. If the electronic device only performs floor positioning based on the barometer, it will think that the user is crossing floors and obtain an incorrect floor positioning result. However, in the embodiment of the present application, the electronic device can combine the WiFi fingerprint data of the elevator entrance on the 6th floor collected by the electronic device and the WiFi fingerprint database of the building to accurately locate the floor where the electronic device is located as the 6th floor.
[0218] It should be understood that when the server builds the WiFi fingerprint database, the electronic device can send the air pressure value and the WiFi fingerprint data of the key location to the server after executing S701, and the server can execute S702-S703 and output the floor where the electronic device is located. Among them, the server outputting the floor where the electronic device is located can be understood as: the server sends the floor where the electronic device is located to the electronic device. It should be understood that Figure 7 In the example, an electronic device executing S701-S704 is taken as an example.
[0219] In the embodiment of the present application, after the electronic device detects that the electronic device has entered a building, the air pressure value can be collected, but there is no need to scan WiFi all the time to collect WiFi fingerprint data. Instead, the WiFi fingerprint data of key locations is collected, which can reduce the power consumption of the electronic device. In addition, the electronic device can also distinguish the air pressure environment in which the electronic device is located, and use the air pressure value or WiFi fingerprint data to locate the floor, which is highly flexible and has high positioning accuracy.
[0220] In some embodiments, after executing S701, the electronic device can directly locate the floor where the electronic device is located based on the WiFi fingerprint data. For example, the electronic device can execute the step of "determining the floor where the electronic device is located based on the WiFi fingerprint data and the WiFi fingerprint database of the building."
[0221] In some embodiments, after the electronic device executes S701, when the first condition is met, the electronic device can locate the floor where the electronic device is located according to the air pressure value and the WiFi fingerprint data. For example, the electronic device can determine the first floor where the electronic device is located according to the air pressure value, and determine the second floor where the electronic device is located according to the WiFi fingerprint data and the WiFi fingerprint database of the building. The electronic device can determine the floor where the electronic device is located according to the first floor and the second floor. Exemplarily, when the first floor and the second floor are equal, the electronic device can use the first floor as the floor where the electronic device is located. In this example, the electronic device uses both the air pressure value and the WiFi fingerprint data to locate the floor where the electronic device is located, which can improve the accuracy of floor positioning.
[0222] It should be noted that the data involved in this application (including but not limited to data used for analysis, stored data, displayed data, etc.) are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0223] In one embodiment, the present application also provides an electronic device, referring to Figure 8 , the electronic device may include: a processor 801 (such as a CPU), and a memory 802. The memory 802 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (NVM), such as at least one disk memory. The memory 802 may store various instructions for completing various processing functions and implementing the method steps of the present application.
[0224] Optionally, the electronic device involved in the present application may further include: a power supply 803, a communication bus 804 and a communication port 805. The above-mentioned communication port 805 is used to realize the connection and communication between the electronic device and other peripherals. In the embodiment of the present application, the memory 802 is used to store computer executable program code, and the program code includes instructions; when the processor 801 executes the instruction, the instruction causes the processor 801 of the electronic device to perform the action in the above-mentioned method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0225] In some embodiments, the electronic device may further include: a display screen 806. The display screen 806 may display an interface of the electronic device, for example, the display screen 806 may display the floor where the electronic device is located.
[0226] It should be noted that the modules or components described in the above embodiments may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASICs), or one or more digital signal processors (DSPs), or one or more field programmable gate arrays (FPGAs). For another example, when a module above is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processors that can call program codes, such as a controller. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0227] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loading and executing computer program instructions on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integrated. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0228] The term "plurality" in this article refers to two or more than two. The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the previous and next associated objects are in an "or" relationship; in the formula, the character " / " indicates that the previous and next associated objects are in a "division" relationship. In addition, it should be understood that in the description of this application, words such as "first" and "second" are only used for the purpose of distinguishing descriptions, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order.
[0229] It should be understood that the various numerical numbers involved in the embodiments of the present application are only used for the convenience of description and are not used to limit the scope of the embodiments of the present application.
[0230] It can be understood that in the embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
Claims
1. A method for floor positioning, characterized in that: Applied to electronic equipment, the method comprises: When an electronic device is detected entering a building, air pressure values and WiFi fingerprint data of key locations are collected; When the first condition is met, determining the floor where the electronic device is located according to the air pressure value; When the first condition is not met, determining the floor where the electronic device is located according to the WiFi fingerprint data and the WiFi fingerprint database of the building, wherein the WiFi fingerprint database of the building is constructed according to the historically collected air pressure values and the WiFi fingerprint data of key locations, and the WiFi fingerprint database of the building includes: WiFi fingerprint data of key locations of at least one floor; The floor where the electronic device is located is output.
2. The method according to claim 1, characterized in that The first condition includes: The changes in air pressure values are not caused by noise; and, The electronic device enters the building from the first floor; and After the electronic device entered the building, the electronic device was not restarted.
3. The method according to claim 1 or 2, characterized in that: The key position includes a first key position, or the key position includes the first key position and a second key position; The collecting of air pressure values and WiFi fingerprint data of key locations includes: collecting air pressure values at a preset frequency; and, When the electronic device is detected to enter the building, WiFi fingerprint data of the first key position is collected; According to the air pressure value, when the end of the cross-layer is detected, the WiFi fingerprint data of the second key position is collected.
4. The method according to claim 3, characterized in that The method further comprises: Determining a change in altitude within a first preset time period according to the air pressure value within the first preset time period; If the height change within the first preset time period is greater than or equal to a first threshold, it is determined that the cross-layer starts; if the height change within the first preset time period is less than a second threshold, it is determined that the cross-layer ends.
5. The method according to any one of claims 1 to 4, characterized in that The historically collected air pressure values include: a sequence of air pressure values collected when the electronic device enters the building for the nth time; the historically collected WiFi fingerprint data of key locations include: a sequence of WiFi fingerprint data collected when the electronic device enters the building for the nth time, where n is an integer greater than 1; The WiFi fingerprint data sequence includes: WiFi fingerprint data of a first key position when the electronic device enters the building, or the WiFi fingerprint data sequence includes: WiFi fingerprint data of the first key position, and WiFi fingerprint data of a second key position when the cross-layer ends; The method further comprises: Acquire a first height change according to the air pressure value at the second key position and the air pressure value at the first key position; If the floor where the second key position is located is determined according to the first height change, a WiFi fingerprint database of the building is constructed according to the floor where the first key position is located, the WiFi fingerprint data of the first key position, the floor where the second key position is located, and the WiFi fingerprint data of the second key position; If the floor where the second key position is located is not determined according to the first height change, the floor where the second key position is located is determined according to the height change of the key position when entering the building multiple times.
6. The method according to claim 5, characterized in that There is at least one second key position, and each second key position corresponds to a floor.
7. The method according to claim 5 or 6, characterized in that: Determining the floor where the second key position is located according to the height change of the key position when entering the building multiple times includes: Obtaining the similarity of WiFi fingerprint data of any two key locations when the electronic device enters the building at different times; The key positions whose similarity is greater than or equal to the similarity threshold are regarded as the same key position; If the same key position exists on different floors, clustering the determined floors of the same key position is performed to obtain the floor where the same key position is located; According to the floor where the same key position is located and the height change amount of each key position, the floor where each key position is located is obtained, wherein each key position includes the second key position; The method further comprises: According to the floor where each key location is located and the WiFi fingerprint data of each key location, a WiFi fingerprint database of the building is constructed.
8. The method according to claim 7, characterized in that After obtaining the floor where each key position is located, the method further includes: According to the floor where each key position is located, detecting whether there is an erroneous floor among the floors where the determined key positions are located; If so, the wrong floor is modified to a correct floor.
9. The method according to claim 5 or 6, characterized in that: The WiFi fingerprint data sequence also includes: WiFi fingerprint data at the third key position when starting to cross layers; The method further comprises: Acquire a second height change according to the air pressure value at the third key position and the air pressure value at the first key position; The step of constructing the WiFi fingerprint database of the building includes: If the floor where the third key position is located is determined based on the second height change, the WiFi fingerprint data of the first key position, the floor where the second key position is located, the WiFi fingerprint data of the second key position, the floor where the third key position is located, and the WiFi fingerprint data of the third key position are constructed according to the floor where the first key position is located, the WiFi fingerprint data of the first key position, the floor where the second key position is located, the WiFi fingerprint data of the second key position, the floor where the third key position is located, and the WiFi fingerprint data of the third key position.
10. The method according to claim 2, characterized in that The WiFi fingerprint database of the building includes: WiFi fingerprint data of the entrance of the first floor of the building; The method further comprises: Obtain the WiFi fingerprint data of the electronic device when it enters the building, and the similarity with the WiFi fingerprint data of the first floor entrance of the building; When the similarity is greater than or equal to a similarity threshold, determining that the electronic device enters the building from the first floor; When the similarity is less than the similarity threshold, it is determined that the electronic device has not entered the building from the first floor.
11. The method according to any one of claims 1 to 10, characterized in that The key locations include: the entrance of the building, the elevator entrance, the stair entrance or the escalator entrance of at least one floor.
12. The method according to claim 1, characterized in that After collecting the air pressure value and the WiFi fingerprint data of the key position, it also includes: Sending the air pressure value and WiFi fingerprint data of key locations to a server; Determining the floor where the electronic device is located according to the WiFi fingerprint data and the WiFi fingerprint database of the building includes: Receive the floor where the electronic device is located from the server, where the floor where the electronic device is located is obtained by the server based on the WiFi fingerprint data and the WiFi fingerprint database of the building, and the WiFi fingerprint database of the building is constructed by the server based on the air pressure value historically reported by at least one electronic device and the WiFi fingerprint data of key locations.
13. An electronic device, characterized in that: include: Processor and memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 12.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program or instruction, and when the computer program or instruction is executed, the method according to any one of claims 1 to 12 is implemented.