Disclosure of Invention
In view of the defects of the prior art, an object of the present invention is to provide an assisted positioning method and system based on WiFiAware, which aim to solve the problem that the existing intelligent terminal cannot provide accurate positioning service and navigation service when the network signal is not good and the satellite positioning function is unavailable.
The technical scheme of the invention is as follows:
an auxiliary positioning method based on WiFiAware comprises the following steps:
step A, the current intelligent terminal receives a user instruction to start WiFiAware and establishes connection with other intelligent terminals which start WiFiAware at the periphery;
b, acquiring longitude and latitude information of other intelligent terminals, and calculating the relative distance between the current intelligent terminal and the other intelligent terminals;
and step C, calculating the longitude and latitude information of the current intelligent terminal according to the longitude and latitude information of other intelligent terminals and the relative distance between the current intelligent terminal and other intelligent terminals.
The auxiliary positioning method based on WiFiAware comprises the following specific steps:
a1, the current intelligent terminal receives a user instruction to start WiFiAware;
a2, detecting whether other intelligent terminals for starting WiFiAware exist around the current intelligent terminal;
and step A3, when detecting that other intelligent terminals for opening the WiFiAware exist around, establishing network connection with other intelligent terminals for opening the WiFiAware around.
The auxiliary positioning method based on WiFiAware, wherein the step B specifically comprises the following steps:
step B1, the current intelligent terminal sends a request for obtaining the position to other intelligent terminals supporting the auxiliary positioning service through a WiFiAware service interface;
step B2, the current intelligent terminal acquires the feedback information of other intelligent terminals to the position request, and analyzes the feedback information;
and step B3, determining longitude and latitude information of other intelligent terminals through the analyzed contents, and calculating and storing the relative distance between the current intelligent terminal and other intelligent terminals.
In the auxiliary positioning method based on WiFiAware, in step B2, the type of the feedback information is one of satellite position information, network position information, and non-information data.
In the step C, when the calculated relative distance is smaller than a preset relative distance threshold, it is determined that the current intelligent terminal and other intelligent terminals are at the same position.
The auxiliary positioning method based on the WiFiAware comprises the following specific steps:
step C1, substituting the known quantity and the unknown quantity into an open earth surface distance calculation formula to obtain an equation about the longitude and latitude information of the current intelligent terminal, wherein the longitude and latitude information of other intelligent terminals and the relative distance between the current intelligent terminal and other intelligent terminals are known quantities, and the longitude and latitude information of the current intelligent terminal is unknown quantity;
and C2, calculating the optimal solution of the equation by adopting a Newton iteration method.
An auxiliary positioning system based on WiFiAware, comprising:
the connection module is used for receiving a user instruction by the current intelligent terminal to start the WiFiAware and establishing connection with other intelligent terminals which start the WiFiAware at the periphery;
the acquisition and analysis module is used for acquiring longitude and latitude information of other intelligent terminals and calculating the relative distance between the current intelligent terminal and the other intelligent terminals;
and the calculation module is used for calculating the longitude and latitude information of the current intelligent terminal according to the longitude and latitude information of other intelligent terminals and the relative distance between the current intelligent terminal and other intelligent terminals.
The auxiliary positioning system based on WiFiAware, wherein the connection module comprises:
the instruction receiving unit is used for receiving a user instruction to start the WiFiAware by the current intelligent terminal;
the detection unit is used for detecting whether other intelligent terminals for starting WiFiAware exist around the current intelligent terminal;
and the connection unit is used for establishing network connection with other intelligent terminals which open the WiFiAware when detecting that other intelligent terminals which open the WiFiAware exist around.
The auxiliary positioning system based on the WiFiAware, wherein the acquisition and analysis module comprises:
the position request unit is used for sending a request for acquiring the position of the current intelligent terminal to other intelligent terminals supporting the auxiliary positioning service through a service interface of WiFiAware;
the information feedback unit is used for acquiring feedback information of other intelligent terminals to the position request by the current intelligent terminal and analyzing the feedback information;
and the calculation storage unit is used for determining the longitude and latitude information of other intelligent terminals through the analyzed content, calculating the relative distance between the current intelligent terminal and other intelligent terminals and storing the relative distance.
The auxiliary positioning system based on WiFiAware, wherein the computing module comprises:
the system comprises an equation establishing unit, a calculation unit and a calculation unit, wherein the equation establishing unit is used for substituting the known quantity and the unknown quantity into an open earth surface distance calculation formula to obtain an equation about the longitude and latitude information of the current intelligent terminal, the longitude and latitude information of other intelligent terminals and the relative distance between the current intelligent terminal and other intelligent terminals are the known quantity, and the longitude and latitude information of the current intelligent terminal is the unknown quantity;
and the solving unit is used for calculating the optimal solution of the equation by adopting a Newton iteration method.
Has the advantages that: according to the invention, the longitude and latitude information of the current intelligent terminal is calculated through the longitude and latitude information of other intelligent terminals acquired by the WiFiAware and the relative distance between the current intelligent terminal and other intelligent terminals, so that the current intelligent terminal can acquire more accurate positioning information of the current intelligent terminal through the WiFiAware under the condition that no network signal or satellite signal exists, and effective positioning information and navigation information can be conveniently and further acquired.
Detailed Description
The invention provides an auxiliary positioning method and system based on WiFiAware, and the invention is further described in detail below in order to make the purpose, technical scheme and effect of the invention clearer and more clear and definite. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a flowchart illustrating a preferred embodiment of a wifi aware-based assisted positioning method according to the present invention, and as shown in the figure, the method includes the following steps:
s1, the current intelligent terminal receives a user instruction to start the WiFiAware and establishes connection with other surrounding intelligent terminals which start the WiFiAware;
s2, acquiring longitude and latitude information of other intelligent terminals, and calculating the relative distance between the current intelligent terminal and the other intelligent terminals;
and S3, calculating the longitude and latitude information of the current intelligent terminal according to the longitude and latitude information of other intelligent terminals and the relative distance between the current intelligent terminal and other intelligent terminals.
In this embodiment, when the network signal of the intelligent terminal is not good or the satellite positioning function is unavailable, the latitude and longitude information of the intelligent terminal and the relative distance between the current intelligent terminal and other intelligent terminals are obtained through the WiFiAware, so that the accurate positioning of the current intelligent terminal is determined, the accurate navigation is obtained, and the method is favorable for obtaining the accurate positioning through the assistance of other intelligent terminals when the intelligent terminal cannot accurately position.
As a preferred embodiment, fig. 2 is a specific flowchart of step S1 in the method of fig. 1, and as shown, it includes the following steps:
s11, the current intelligent terminal receives a user instruction to start WiFiAware;
s12, detecting whether other intelligent terminals for starting WiFiAware exist around the current intelligent terminal;
and S13, when detecting that other intelligent terminals for opening the WiFiAware exist around, establishing network connection with other intelligent terminals for opening the WiFiAware around.
In step S11, the user downloads application software (i.e. application software for implementing the method of the present invention, and certainly, the function of the present invention can also be applied to other software) to the mobile terminal in advance, and when the user has insufficient power or the network is not good and accurate positioning and navigation cannot be obtained, the current intelligent terminal receives a user instruction to start WiFiAware; in step S12, the intelligent terminal detects other intelligent terminals that open WiFiAware around through the WiFiAware bottom layer detection function; in step S13, when the smart terminal detects that there are other smart terminals that open the WiFiAware in the surroundings, it establishes network connection with other smart terminals that open the WiFiAware in the surroundings. The instruction can be a touch instruction or a shortcut instruction preset by a user, and comprises pressing a certain function key, such as a volume key; and continuously shaking the mobile phone for more than two times within a preset time length, wherein the preset time length can be 3s, 5s and 10s, and preferably, the preset time length is 5 s. The periphery is a circle with the radius of 40-60 m or a square with the side length of 70-100 m, and the position of the current intelligent terminal is taken as the center. The number of the other intelligent terminals which open the WiFiAware around can be one or more.
As a preferred embodiment, fig. 3 is a detailed flowchart of step S2 in the method of fig. 1, and as shown, the method includes the following steps:
s21, the current intelligent terminal sends a request for obtaining the position to other intelligent terminals supporting the auxiliary positioning service through a WiFiAware service interface;
s22, the current intelligent terminal acquires feedback information of other intelligent terminals to the position request, and analyzes the feedback information;
and S23, determining longitude and latitude information of other intelligent terminals through the analyzed contents, and calculating and storing the relative distance between the current intelligent terminal and the other intelligent terminals.
In step S21, the current intelligent terminal subscribes to the assisted location service through a service interface of WiFiAware, monitors whether there are other intelligent terminals supporting the assisted location service nearby, and sends a request to the other intelligent terminals to obtain location information thereof if it monitors that the other intelligent terminals supporting the assisted location service are present. Other intelligent terminals supporting the auxiliary positioning service broadcast self service content through a broadcast interface (Publish interface), the service content does not contain any private information related to the identity, age, gender and the like of the intelligent terminal user, and the intelligent terminal can provide self position information only by expressing the position information through the service content, so that the privacy safety and the information safety of the intelligent terminal user providing the position information can be effectively protected, more intelligent terminal users can conveniently broadcast the self position information, and the current intelligent terminal can be more accurately positioned and navigated. Of course, the current intelligent terminal and other intelligent terminals can transmit and receive the position information.
In step S22, the current intelligent terminal obtains feedback information of the other intelligent terminals to the location request, and analyzes the feedback information; the feedback information comprises longitude and latitude information, protocol information, WiFi transmission models and the like of other intelligent terminals providing the feedback information. The other intelligent terminals providing the feedback information firstly acquire the longitude and latitude information of the other intelligent terminals, the process of acquiring the longitude and latitude information is that the other intelligent terminals providing the feedback information firstly read the position information of the other intelligent terminals and judge whether the position information is newer position information, and if so, the other intelligent terminals directly transmit the position information and the acquiring mode (satellite information type or network information type) of the position information to the current intelligent terminal through WiFiAware; if not, other intelligent terminals providing feedback information first apply for satellite positioning to obtain self position information, if the acquisition is successful, the other intelligent terminals are firstly marked as satellite data types, and then the acquisition modes of the position information and the position information are sent to the current intelligent terminal through WiFiAware; and if the satellite positioning can not be successfully requested, re-requesting the network position information, if the acquisition is successful, firstly marking the position information as a network information type, and sending the position information and the acquisition mode of the position information to the current intelligent terminal through WiFiAware after packaging. And if the network position information and the satellite position information can not be acquired, directly replying non-information data to the current intelligent terminal. The updated position information refers to the position information of the other intelligent terminals which provide feedback information within a certain time period before the time of reading the position information, wherein the certain time period can be 12h, 24h and 48 h.
In step S23, the current intelligent terminal determines latitude and longitude information of other intelligent terminals according to the content obtained by parsing, and calculates and stores relative distances between the current intelligent terminal and the other intelligent terminals. At this time, the other intelligent terminals are the other intelligent terminals providing the feedback information. And calculating the relative distance between the current intelligent terminal and other intelligent terminals by adopting different methods according to whether the protocol time exists in the information fed back by other intelligent terminals. And if the information fed back by the other intelligent terminals carries the 802.11mc protocol time information, calculating the distance between the current intelligent terminal and the other intelligent terminals according to the RTT time of the protocol. RTT time = current time — echo time of a timestamp option in a packet, where the echo time of the timestamp is the time when a certain packet is sent out, and a measured value of RTT time can be obtained by knowing the receiving time (current time) and the sending time (echo time) of the packet. The distance calculation mode through the RTT time is realized by a chip manufacturer of the mobile terminal, and is obtained by calling a corresponding interface through application. And if the information fed back by other intelligent terminals does not carry the RTT time information, calculating the relative distance between the current intelligent terminal and the other intelligent terminals according to the Rssi signal intensity value in a mode of reading the Rssi signal intensity value of the other intelligent terminals. The process mainly adopts a public model formula d =10^ (ABS (RSSI) -A)/(10 x n)) of WiFi transmission to calculate the distance, wherein parameters A and n are calculated according to sampling. The application of the intelligent terminal can store experience values of chips of different platforms, such as chips of high-pass, Mac-Tong, MTK and the like, in the intelligent terminal such as a mobile phone and the like, and simultaneously read the chip type of the terminal, and different platform chips obtain different parameter values. If parameter values matching other intelligent terminal device types cannot be found in the application storage, default empirical parameter values are used. When calculating the corresponding parameter value, the value is taken for a plurality of times according to the actual situation, the number of times of taking the value can be set by the user (such as 5, 6, 10, etc.), or the default value can be written (such as 5 times), firstly, the highest value and the lowest value obtained by the model are removed, and then, the corresponding value is obtained by averaging. The method has the advantages that the pertinence for obtaining the distance information by adopting different point algorithms is stronger, the reliability of data is high, and errors caused by adopting a single method for calculation are avoided. In addition, the method of measuring for many times, removing the maximum value and the minimum value and averaging the rest data can effectively avoid calculation errors and improve the reliability of calculation results.
In addition, according to different modes of acquiring the position information by other intelligent terminals, classifying and storing the position information, and marking the position information according to the satellite position information, the network position information and the non-information data; and the relative distance between the current intelligent terminal and other intelligent terminals is obtained only by storing the result without marking a specific method for obtaining the distance.
As a preferred embodiment, fig. 4 is a specific flowchart of step S3 in the method of fig. 1, which specifically includes the steps of:
s31, substituting the known quantity and the unknown quantity into an open earth surface distance calculation formula to obtain an equation about the longitude and latitude information of the current intelligent terminal, wherein the longitude and latitude information of other intelligent terminals and the relative distance between the current intelligent terminal and other intelligent terminals are known quantities, and the longitude and latitude information of the current intelligent terminal is unknown quantity;
and S32, calculating the optimal solution of the equation by adopting a Newton iteration method.
In step S31, the relative distance between the current intelligent terminal and another intelligent terminal is first determined, and at this time, the another intelligent terminal is another intelligent terminal that provides feedback information. . Considering that other intelligent terminals are around the current intelligent terminal and are not far away from the current intelligent terminal, when the relative distance between the current intelligent terminal and the other intelligent terminals is smaller than a preset relative distance threshold value, the current intelligent terminal and the other intelligent terminals are judged to be at the same position. The relative distance threshold may be a default value of the intelligent terminal, such as 10m, 20 m, 40 m, or may be set by the user according to the situation of the location of the user, and if the surrounding environment is complex and difficult to find, the relative distance threshold is set to a smaller value, such as 5 m, 8 m, or the like; if the environment is more open, the relative distance threshold is set to a larger value, such as 25 m, 50 m, etc. This facilitates the user in determining his or her position in the fastest way.
And when the relative distance between the current intelligent terminal and other intelligent terminals is not smaller than a preset relative distance threshold value, judging that the current intelligent terminal and other intelligent terminals are not at the same position, and determining the position of the current intelligent terminal through further calculation. At this time, the number of other intelligent terminals feeding back the position information is determined first. When the number of other intelligent terminals feeding back the position information is 1, the latitude and longitude information fed back by the intelligent terminals can only be used as rough estimation of the position of the current intelligent terminal. When the number of the intelligent terminals feeding back the position information is multiple, the method for acquiring the longitude and latitude information by the intelligent terminals feeding back the position information needs to be judged. If only one satellite position information exists in the longitude and latitude information acquired by the current intelligent terminal, the acquired network position information is required to be used as a known parameter for calculation. If the longitude and latitude information acquired by the current intelligent terminal contains 1 piece of satellite position information and more than 1 piece of network position information, selecting 1 piece of network position information from the more than 1 piece of network position information, eliminating other network position information, and calculating by adopting the acquired 1 piece of satellite position information and 1 piece of network position information as known parameters. If the longitude and latitude information acquired by the current intelligent terminal contains more than 2 satellite position information, the acquired network position information is eliminated, and all the acquired satellite position information is adopted as a known parameter for calculation.
In the calculation process, the known quantity is longitude and latitude information of other intelligent terminals and the relative distance between the current intelligent terminal and the other intelligent terminals, the unknown quantity is the longitude and latitude information of the current intelligent terminal and is the unknown quantity, and the known quantity and the unknown quantity are brought into an open earth surface distance calculation formula
. The longitude and latitude coordinates of the current intelligent terminal are (x, y), the longitude and latitude coordinates of the longitude and latitude information of other intelligent terminals are (LonB, LatB), d is the calculated relative distance between the current intelligent terminal and other intelligent terminals, R is the radius of the earth, C is the radian, and
the longitude and latitude information of other intelligent terminals and the relative distance between the current intelligent terminal and other intelligent terminals are substituted into the two equations, the following equation sets can be listed,
in step S32, an optimal solution of the equation is calculated using newton' S iteration. In the process of solving, firstly, an equation set is taken out, and a set of initial values x is given
0,y
0So that the system of equations may be 0. Setting the self-defined iteration number N, setting the self-defined error as sigma, listing the Jacobian matrix of an equation set according to a Newton iteration method formula, solving the inverse matrix of the Jacobian matrix, and finally calculating the optimal solution by utilizing the Newton iteration method. The iteration number may be N =15 defaulted by the intelligent terminal itself, or N =13 set by the user, and the custom error may be σ =10 defaulted by the intelligent terminal itself
-4Or σ =10 set by the user
-6. And finally, obtaining a more appropriate approximate value of longitude and latitude, which is enough to help the current intelligent terminal to accurately position and navigate.
Based on the above method, the present invention further provides an auxiliary positioning system based on wifi aware, as shown in fig. 5, which includes:
the connection module 100 is used for the current intelligent terminal to receive a user instruction to start the WiFiAware and establish connection with other intelligent terminals which start the WiFiAware at the periphery;
the acquisition and analysis module 200 is used for acquiring longitude and latitude information of other intelligent terminals and calculating the relative distance between the current intelligent terminal and the other intelligent terminals;
and the calculating module 300 is configured to calculate latitude and longitude information of the current intelligent terminal according to latitude and longitude information of other intelligent terminals and relative distances between the current intelligent terminal and other intelligent terminals.
Further, as shown in fig. 6, the connection module 100 includes:
the instruction receiving unit 110 is configured to receive a user instruction to start WiFiAware by the current intelligent terminal;
the detection unit 120 is used for detecting whether other intelligent terminals for starting the WiFiAware exist around the current intelligent terminal;
the connection unit 130 is configured to establish network connection with other surrounding intelligent terminals that open the wifi aware when detecting that other surrounding intelligent terminals that open the wifi aware exist.
Further, as shown in fig. 7, the acquiring and parsing module 200 includes:
a location request unit 210, configured to send a request for acquiring a location to another intelligent terminal supporting an auxiliary location service through a service interface of WiFiAware by a current intelligent terminal;
an information feedback unit 220, configured to obtain, by the current intelligent terminal, feedback information of the position request from another intelligent terminal, and analyze the feedback information;
and the calculation storage unit 230 is configured to determine latitude and longitude information of other intelligent terminals according to the analyzed content, calculate a relative distance between the current intelligent terminal and the other intelligent terminals, and store the relative distance.
Further, as shown in fig. 8, the calculating module 300 includes:
an equation establishing unit 310, configured to substitute the known quantity and the unknown quantity into an open earth surface distance calculation formula to obtain an equation related to latitude and longitude information of the current intelligent terminal, where the latitude and longitude information of other intelligent terminals and relative distances between the current intelligent terminal and other intelligent terminals are known quantities, and the latitude and longitude information of the current intelligent terminal is an unknown quantity;
and the solving unit 320 is used for calculating the optimal solution of the equation by adopting a Newton iteration method.
In summary, the latitude and longitude information of the current intelligent terminal is calculated through the latitude and longitude information of other intelligent terminals acquired by the WiFiAware and the relative distances between the current intelligent terminal and other intelligent terminals, so that the current intelligent terminal can acquire more accurate positioning information of the current intelligent terminal through the WiFiAware under the condition that no network signal or satellite signal exists, and effective navigation information can be further conveniently acquired.
It is to be understood that the invention is not limited to the examples described above, but that modifications and variations may be effected thereto by those of ordinary skill in the art in light of the foregoing description, and that all such modifications and variations are intended to be within the scope of the invention as defined by the appended claims.