Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Moreover, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to a first aspect of the embodiments of the present invention, there is provided a position location method based on bluetooth RSSI, optionally, as shown in fig. 1, the method includes:
s102, under the condition that a tag receives Bluetooth signals sent by a plurality of beacons, two or more than two target beacons with the minimum distance from the tag are determined;
s104, respectively determining two or more circles by taking the determined target beacon as a center and the distance between the determined target beacon and the tag as a radius;
and S106, determining the position coordinates of the label according to the intersection point of two or more circles.
Optionally, in this embodiment, the beacon is fixed in the scene, and the coordinates of the beacon are known. Tags are mobile in real time. The position coordinates of the tag are values to be calculated. When the tag is within the scene of the beacon, the beacon may transmit a bluetooth signal, which is received by the tag. If the beacon and tag are too far apart, the bluetooth signal cannot be received by the tag.
For a tag, the tag may receive 0-m bluetooth signals. m is the number of beacons. When the tag receives the bluetooth Signal, the Signal Strength (RSSI) of the bluetooth Signal can be determined. The strength of RSSI may be measured when a bluetooth signal is received. When the signal strength of the bluetooth signal is known, the distance can be calculated according to the above equations (1) and (2). Wherein A is the RSSI of the tag at a distance of 1 meter from the beacon, n is the attenuation factor, and n >0. The distance d calculated by equation (1) may be taken as the distance between the tag and the beacon. The distance calculated by the formula (1) can be optimized by the formula (2). In the formula (2), the difference in the vertical direction is taken into consideration, and therefore, the calculated D is more accurate. D is the exact distance between the tag and the beacon. In the formula (2), H is the distance from the beacon to the ground, and H is the distance from the tag to the ground, or H may be the distance from the beacon to the ground, and H is the distance from the tag to the ground.
Since the tag may receive 0-m bluetooth signals, if 0 bluetooth signal is received, the location coordinates of the tag cannot be determined. When 1 bluetooth signal is received, the tag-to-beacon distance can be calculated. Knowing the location of the beacon, knowing the distance of the tag from the beacon, a circle can be determined. Any point on the circle can be used as the position coordinates of the tag.
If the tag receives two bluetooth signals or multiple bluetooth signals, the tag may calculate the distance to each beacon and then determine the two beacons that are closest to the tag, the first and second beacons, respectively. The distances are a first distance and a second distance, respectively (the first distance is smaller than the second distance). The first beacon and the first distance then form a first circle, on which the tag may be at any point. The second beacon and the second distance form a second circle, and the tag may be at any point on the second circle.
Then, in determining the position coordinates of the tag, there are many cases.
The first case is that there are two intersections of the first circle with the second circle. When two intersection points exist between the first circle and the second circle, a beacon corresponding to the third smallest distance in the distances is used as a third beacon; and taking the coordinates of the intersection point with the smaller distance with the third beacon as the position coordinates of the tag. Or, when two intersections exist between the first circle and the second circle, the coordinates of the midpoint of the line connecting the two intersections are used as the position coordinates of the label. And a circle formed by the third beacon and the third small distance is a third circle, and the third beacon is the center of the target circle of the third circle.
That is, in the case where there are two intersections of the first circle and the second circle, there are two cases of subdivision. The first subdivision is that the tag only receives two bluetooth signals and therefore the tag position coordinates can only be determined by the first circle and the second circle. And taking the middle point of the connecting line of the two intersection points of the first circle and the second circle as the position coordinate of the label. A second subdivision is that the tag receives multiple bluetooth signals, and the first beacon and the second beacon are the closest and second closest beacons, respectively, to the tag. At this time, a third beacon which is the third closest to the tag is determined, and of two intersection points of the first circle and the second circle, an intersection point which is the closest to the third beacon is taken as the position of the tag, so that the position coordinates of the tag are obtained.
In the second case, there is an intersection between the first circle and the second circle, and if there is an intersection between the first circle and the second circle, the coordinates of the intersection are used as the position coordinates of the tag.
The third case is that there is no intersection point of the first circle and the second circle. In the case where there is no intersection between the first circle and the second circle, the first distance is expanded/contracted or the second distance is expanded/contracted while maintaining the ratio of the first distance to the second distance unchanged until there is at least one intersection between the first circle and the second circle.
That is, if there is no intersection point between the first circle and the second circle, and the first circle and the second circle expand or contract proportionally, there is one intersection point or two intersection points between the first circle and the second circle during the adjustment process. If one intersection exists, the intersection can be used as the position of the label, and if two intersections exist, the method can be adopted to determine one intersection from the two intersections as the position of the label, or the middle point of the connecting line of the two intersections is used as the position of the label.
In this embodiment, the above formula (1) aims to convert the signal intensity into a distance. The RSSI of each beacon received for each tag card is sorted and then converted to distance according to equation (1).
In order to further reduce errors, height compensation is added, the height value of the tag card is transmitted (default is 1 and can be set) in operation, the height value of the beacon is obtained, the beacon can be set on the deployment platform and read from the database, and after the distance is calculated, the projection edge on the plane is calculated through the hypotenuse and the height difference through the Pythagorean theorem. That is, the distance calculated by the formula (1) is optimized by using the formula (2) to obtain the distance D. This reduces the error in the calculated distance, especially at close distances, when d < (H-H) is directly considered to be at the beacon.
The judgment is added before each positioning, if the distance between the current beacon and a certain beacon is smaller than a specific attraction distance (default is 0.5m, and the current beacon can be configured), the position of the tag card is directly considered to be in the current beacon, firstly, a certain calculation amount can be reduced, in the actual working condition, the number of the tag cards and the beacons can reach hundreds of thousands, and each detailed calculation increases the burden of a server; secondly, certain error inclusion can be brought about, and the RSSI fluctuation is also large when the RSSI is located in a close range. The actual measured data may also differ from measurement to measurement, to name just one. It may happen that the calculated d is 0.5m or even 1m, but is located very close to the beacon, so that locating the beacon point when the distance is less than the attraction distance can reduce some error. Fig. 2 is a graph showing variation of RSSI fluctuation with a short distance.
After the above preliminary filtering and troubleshooting, single point, double point and three point positioning are performed, respectively, based on the number of received beacon signals. And through the algorithm, the error is reduced as much as possible and the point is made to be dynamic.
The method is that a point is randomly selected from a circle which takes the beacon as the center of a circle and calculates the distance as the radius.
When two beacon signals are received, two-point positioning is carried out by taking the middle point of the intersection points of two circles taking the beacons as circles, and if only one intersection point exists, the position of the intersection point is taken.
Three-point auxiliary positioning is carried out when three beacon signals are received, the method comprises the steps of taking two circles which take the beacons as circle centers and take the distance from the beacons to the tags as radii, taking two intersection points of the two circles, comparing the distance from the two intersection points to the third beacon with the distance from the tag card to the third beacon through calculation, obtaining a distance difference value, and obtaining who the distance difference value of which point is smaller. If there is only one intersection, then go to that one intersection location.
However, in actual conditions, due to the instability of RSSI and the fluctuation of environmental interference, the circle formed by the calculated position cannot generate a unique intersection point, even an intersection point, for example, as shown in fig. 3. In fig. 3, the first circle, the second circle, and the third circle have no intersection.
In this case, it is necessary to operate on two circles with better signals, that is, two circles with smaller radii are correspondingly scaled (expanded and contracted) according to the distance relationship (separation and inclusion) between the circles until the two circles intersect each other, but there may be two intersections, that is, the distance from the third circle to the third beacon is closest to the distance calculated by the third circle.
The schematic diagram of the non-intersection point expansion (contraction) with equal proportion until the intersection point exists is shown in fig. 4. The circle in the lower left corner and the circle in the lower right corner of fig. 4 have two intersection points, and the intersection point in the upper part is closer to the circle in the upper part of fig. 4, and therefore the intersection point serves as the position of the label.
The distance between two intersection points of the circle constructed by the beacon 1 and thebeacon 2 with better signals and the calculated distance to the tag card is equal to the distance between two intersection points of the circle constructed by the beacon 1 and thebeacon 2 with better signals and the calculated distance to the tag card, and the distance between the two intersection points and the beacon 3 is quite obviously close to the circle of the beacon 3, so that the intersection points are taken up and returned to be the position of the tag card, and the lower intersection points are abandoned, so that the position is further accurate, and a large amount of calculation is reduced.
If there is no intersection point in the two-point positioning, the same method is adopted, and proportional expansion (contraction) is also adopted until there is an intersection point. Taking two intersections takes its midpoint, and taking only one takes it. As shown in fig. 5 and 6. In fig. 5, the two circles do not have an intersection, and after inflation, the two circles have two intersections, and the midpoint of the two intersections serves as the position of the label.
Fig. 7 is a system flowchart of the present embodiment. The circle centers of the three points refer to position coordinates of beacons obtained by sorting the RSSI from good to bad after filtering, the radius is the distance calculated by an RSSI distance conversion algorithm, and the distance is changed by equal-proportion expansion (contraction), so that the intersection point is generated at last under the condition of no intersection point.
Compared with the traditional trilateral positioning algorithm, the algorithm is further optimized and improved, a three-point auxiliary positioning algorithm is used instead, namely, the intersection point of two circles generated by two-point positioning is adopted, the distance from the intersection point to the third beacon is compared with the distance from the tag card to the third beacon calculated by the RSSI, and the intersection point is selected and another intersection point is discarded when the distance from the intersection point to the beacon 3 is closer to the distance from the tag card to the third beacon calculated by the RSSI.
Meanwhile, the algorithm considers various complex conditions and the influence of errors, for example, the condition that two circles positioned by three points have no intersection point is considered, and in an actual working condition, the calculated distance fluctuates due to RSSI fluctuation. The trilateration algorithm may not be solved, at this time, it is first required to judge that the relationship between thebeacons 1 and 2 and the corresponding distances, namely, two circles formed by the radii of the circles, contains or separates, and both have no intersection point and no solution, at this time, the separated circles are amplified in a fixed proportion, the contained circles are shrunk in an equal proportion, the algorithm is recursed once until the intersection point is solved, the same method is used for comparison and rejection by the beacon 3, if the result is not obtained in 10 recursions, the algorithm returns to [ -1, -1] to perform overload protection on the program, the solution failure is indicated, and stack overflow caused by the fact that the program recursions all the time is avoided.
For the two-point algorithm, if two intersection points are calculated, the result is the midpoint of the two intersection points, if one intersection point is obtained, the same recursion processing is carried out under the condition that no intersection point exists, and infinite recursion is avoided by forcibly returning to [ -1, -1] more than ten times.
For the single-point algorithm, because one point cannot accurately locate one position, only presence detection is performed, and because in an actual working condition, the situation that the tag card only receives a signal of one beacon is very few, most of the situations occur in a small room, and only one point needs to be randomly selected on a circle corresponding to the distance.
It should be noted that for simplicity of description, the above-mentioned method embodiments are shown as a series of combinations of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
According to another aspect of the embodiments of the present application, there is also provided a position locating apparatus based on bluetooth RSSI, as shown in fig. 8, including:
a first determiningmodule 802, configured to determine, when a tag receives a bluetooth signal transmitted by multiple beacons, two or more target beacons with a minimum distance from the tag;
a second determiningmodule 804, configured to determine two or more circles respectively with the determined target beacon as a center and with a distance between the determined target beacon and the tag as a radius;
a third determiningmodule 806 for determining the position coordinates of the tag from the intersection of two or more circles.
Optionally, in this embodiment, the beacon is fixed in the scene, and the coordinates of the beacon are known. Tags are mobile in real time. The position coordinates of the tag are values to be calculated. When the tag is within the scene of the beacon, the beacon may transmit a bluetooth signal, which is received by the tag. If the beacon and tag are too far apart, the bluetooth signal cannot be received by the tag.
For a tag, the tag may receive 0-m bluetooth signals. m is the number of beacons. When the tag receives the bluetooth Signal, the Signal Strength (RSSI) of the bluetooth Signal can be determined. The strength of RSSI can be measured when a bluetooth signal is received. When the signal strength of the bluetooth signal is known, the distance can be calculated according to the above equations (1) and (2). Wherein A is the RSSI of the tag at a distance of 1 meter from the beacon, n is the attenuation factor, and n >0. The distance d calculated by equation (1) may be taken as the distance between the tag and the beacon. The distance calculated by the formula (1) can be optimized by the formula (2). In the formula (2), the difference in the vertical direction is taken into consideration, and therefore, the calculated D is more accurate. D is the exact distance between the tag and the beacon. In the formula (2), H is the distance from the beacon to the ground, and H is the distance from the tag to the ground, or H may be the distance from the beacon to the ground, and H is the distance from the tag to the ground.
Since the tag may receive 0-m bluetooth signals, if 0 bluetooth signal is received, the location coordinates of the tag cannot be determined. When 1 bluetooth signal is received, the tag-to-beacon distance can be calculated. Knowing the location of the beacon, knowing the distance of the tag from the beacon, a circle can be determined. Any point on the circle can be used as the position coordinates of the tag.
If the tag receives two bluetooth signals or multiple bluetooth signals, the tag may calculate the distance to each beacon and then determine the two beacons that are closest to the tag, the first and second beacons, respectively. The distances are a first distance and a second distance, respectively (the first distance is smaller than the second distance). The first beacon and the first distance then form a first circle, on which the tag may be at any point. The second beacon and the second distance form a second circle, and the tag may be at any point on the second circle.
Then, in determining the position coordinates of the tag, there are many cases.
The first case is where there are two intersections of the first circle with the second circle. When two intersection points exist between the first circle and the second circle, a beacon corresponding to the third-smallest distance in the distances is used as a third beacon; and taking the coordinates of the intersection point with the smaller distance with the third beacon as the position coordinates of the tag. Or, when two intersections exist between the first circle and the second circle, the coordinates of the midpoint of the line connecting the two intersections are used as the position coordinates of the label. The circle formed by the third beacon and the third small distance is a third circle, and the third beacon is the target circle center of the third circle.
That is, in the case where there are two intersections of the first circle and the second circle, there are two subdivision cases. The first subdivision is that the tag only receives two bluetooth signals and therefore the tag position coordinates can only be determined by the first circle and the second circle. And taking the middle point of the connecting line of the two intersection points of the first circle and the second circle as the position coordinate of the label. A second subdivision is that the tag receives a plurality of bluetooth signals, and the first beacon and the second beacon are the closest and second closest beacons, respectively, to the tag. At this time, a third beacon which is the third closest to the tag is determined, and of the two intersections of the first circle and the second circle, the intersection which is the closest to the third beacon is used as the position of the tag, so that the position coordinates of the tag are obtained.
In the second case, there is an intersection between the first circle and the second circle, and if there is an intersection between the first circle and the second circle, the coordinates of the intersection are used as the position coordinates of the tag.
The third case is that there is no intersection of the first circle and the second circle. In the case where there is no intersection between the first circle and the second circle, the first distance is expanded/contracted or the second distance is expanded/contracted while maintaining a constant ratio of the first distance to the second distance until there is at least one intersection between the first circle and the second circle.
That is, if there is no intersection point between the first circle and the second circle, and the first circle and the second circle expand or contract proportionally, there is one intersection point or two intersection points between the first circle and the second circle during the adjustment process. If there is one intersection, the intersection may be used as the position of the label, and if there are two intersections, the above method may be adopted to determine one intersection from the two intersections as the position of the label, or the midpoint of the connecting line of the two intersections as the position of the label.
For other examples of this embodiment, please refer to the above examples, which are not described herein.
Fig. 9 is a schematic diagram of an alternative electronic device according to an embodiment of the application, as shown in fig. 9, which includes aprocessor 902, acommunication interface 904, amemory 906 and acommunication bus 908, wherein theprocessor 902, thecommunication interface 904 and thememory 906 communicate with each other via thecommunication bus 908,
amemory 906 for storing a computer program;
theprocessor 902, when executing the computer program stored in thememory 906, implements the following steps:
under the condition that a tag receives Bluetooth signals transmitted by a plurality of beacons, determining two or more than two target beacons with the minimum distance from the tag;
determining two or more circles respectively by taking the determined target beacon as a center and the distance between the determined target beacon and the tag as a radius;
the position coordinates of the tag are determined from the intersection of two or more circles.
Alternatively, in the present embodiment, the communication bus may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 9, but that does not indicate only one bus or one type of bus. The communication interface is used for communication between the electronic equipment and other equipment.
The memory may include RAM, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory. Alternatively, the memory may be at least one memory device located remotely from the processor.
As an example, thememory 906 may include, but is not limited to, the first determiningmodule 802, the second determiningmodule 804, and the third determiningmodule 806 of the bluetooth RSSI based position location device. In addition, the positioning apparatus may further include, but is not limited to, other module units in the bluetooth RSSI-based position positioning apparatus, which is not described in detail in this example.
The processor may be a general-purpose processor, and may include but is not limited to: a CPU (Central Processing Unit), NP (Network Processor), and the like; but also a DSP (Digital Signal Processing), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment is not described herein again.
It can be understood by those skilled in the art that the structure shown in fig. 9 is only an illustration, and the device implementing the bluetooth RSSI-based position location method may be a terminal device, and the terminal device may be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, a Mobile Internet Device (MID), a PAD, and the like. Fig. 9 does not limit the structure of the electronic device. For example, the electronic device may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 9, or have a different configuration than shown in FIG. 9.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disk, ROM, RAM, magnetic or optical disk, and the like.
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, wherein the computer program is executed by a processor to perform the steps of the above-mentioned position location method based on bluetooth RSSI.
Alternatively, in this embodiment, a person skilled in the art may understand that all or part of the steps in the methods of the foregoing embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, read-Only memories (ROMs), random Access Memories (RAMs), magnetic or optical disks, and the like.
The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages and disadvantages of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing one or more computer devices (which may be personal computers, servers, network devices, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one type of logical functional division, and other divisions may be implemented in practice, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed coupling or direct coupling or communication connection between each other may be an indirect coupling or communication connection through some interfaces, units or modules, and may be electrical or in other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit may be implemented in the form of hardware, or may also be implemented in the form of a software functional unit.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and amendments can be made without departing from the principle of the present invention, and these modifications and amendments should also be considered as the protection scope of the present invention.