A weighted centroid positioning method, system and storage medium
By constructing a group of base station circle equations, obtaining the vertices of the weighted centroid algorithm and using the solution error to weight the calculation of the positioning tag position, the positioning deviation problem of the weighted centroid algorithm when the ranging error is large is solved, and the positioning accuracy and stability are improved.
Patent Information
- Application Number
- CN202211639927.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-20
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2042-12-20
AI Technical Summary
The existing weighted centroid algorithm cannot determine the vertex when the ranging error is large, resulting in large deviations in positioning, and the solution error is small but the actual positioning error is large.
By constructing a circle equation group of n base stations, two base stations are selected to obtain the vertices of the weighted centroid algorithm. The weighted centroid algorithm is used to calculate the coordinates of the positioning tag, and the final position is calculated by weighting the error solution. The intersection point is constructed as the vertex to solve the vertex selection error caused by ranging error.
The accuracy and stability of the ranging positioning algorithm are improved, positioning deviation caused by ranging errors is avoided, and accurate positioning is ensured even when the ranging error is large.
Smart Images

Figure CN116033548B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of wireless communication positioning technology and indoor positioning technology, in particular to a high-precision weighted centroid positioning method, system and storage medium. BACKGROUND
[0002] At present, indoor positioning technology is widely used in many fields. Base station ranging can be divided into ranging-based spatial positioning algorithm and ranging-free spatial positioning algorithm. However, the positioning accuracy of the ranging-free algorithm is generally poor, so the ranging-based positioning algorithm is widely studied in the industry.
[0003] The weighted centroid algorithm is widely used in ranging-based spatial positioning algorithms. The commonly selected vertex in the weighted centroid algorithm is the combination of the intersection points of the areas with the smallest area formed by the intersection of two circles. However, when the ranging error is large, resulting in non-two-circle intersection (there are two circles without intersection), it will cause the weighted centroid algorithm to be unable to determine which vertices to use for weighted positioning. In actual measurement, when there is a large ranging error, a small calculation error may occur, but the actual positioning error is large. This situation can cause vertex selection errors and cause large deviations in positioning. SUMMARY
[0004] The purpose of the present application is to provide a high-precision weighted centroid positioning method, system and storage medium to realize the acquisition of weighted centroid vertices in various situations and solve the problem of vertex selection errors caused by large ranging errors, which can cause large deviations in positioning.
[0005] In order to achieve the above-mentioned application purpose, the present application provides a weighted centroid positioning method, which comprises the following steps:
[0006] Obtain n sets of distances from the positioning tag to n base stations and the coordinates of the n base stations, and construct n circle equations;
[0007] Select 2 base stations from the n base stations, a total of combinations, obtain the vertices of the weighted centroid algorithm of each combination, wherein n≥3;
[0008] Calculate the coordinates of the positioning tag using the weighted centroid algorithm for the area surrounded by the vertices;
[0009] Calculate the calculation error using the weighted centroid algorithm;
[0010] Weighted calculation of the final position of the positioning tag using the calculation error.
[0011] Optionally, the process of obtaining the vertex of the weighted centroid algorithm of each combination comprises: judging whether two circles formed by the two base stations of each combination have intersection points; if there are intersection points, taking the intersection points as the vertex, if there are no intersection points, constructing intersection points, and taking the constructed intersection points as the vertex.
[0012] Optionally, the process of obtaining the vertex of the weighted centroid algorithm of each combination further comprises:
[0013] The two circle center coordinates formed by the two base stations are respectively: circle 1 (x1, y1, z1) and circle 2 (x2, y2, z2). Assuming that the height z of the positioning tag is known, when the horizontal coordinates of the two circle centers are equal and the vertical coordinates are not equal:
[0014] That is, x1=x2, and y1≠y2, the expressions of the two circles are respectively:
[0015] (x-x1) 2 +(y-y1) 2 +(z-z1) 2 =d1 2
[0016]
[0017] Subtracting the two formulas can obtain:
[0018] 2*(y2-y1)*y+(z-z1) 2 -(z-z2) 2 +d2 2 -d1 2 +y1 2 -y2 2 =0
[0019] Let the linear equation be:
[0020] B=2*(y2-y1)
[0021] C=(z-z1) 2 -(z-z2) 2 +d2 2 -d1 2 +y1 2 -y2 2
[0022] y=-C / B
[0023] Then the equation of the straight line combined with the circle (x-x1) 2 +(y-y1) 2 +(z-z1) 2 =d1 2 can be obtained:
[0024] x2 -2*x1x+y 2 -2*y1y+(z-z1) 2 -d1 2 +y1 2 +x1 2 =0
[0025] make:
[0026] a=1
[0027] b=-2*x1
[0028] c=y 2 -2*y1y+(z-z1) 2 -d1 2 +y1 2 +x1 2
[0029] Then a*x 2 +b*x+c=0
[0030] In a quadratic equation: Δ = b 2 -4*a*c
[0031] When Δ≥0, the two circles intersect:
[0032] The intersection coordinates are
[0033] Otherwise, if the two circles have no intersection, then an intersection is constructed. The constructed intersection is: x=x1, y=-C / B, and the coordinates of the constructed intersection are (x1,-C / B,z).
[0034] Optionally, the process of obtaining the vertex of the weighted centroid algorithm of each combination further includes:
[0035] The coordinates of the centers of the two circles formed by the two base stations are: circle 1 (x1, y1, z1) and circle 2 (x2, y2, z2). Assuming that the height z of the positioning tag is known, when the vertical coordinates of the centers of the two circles are equal but the horizontal coordinates are not equal:
[0036] That is, x1≠x2, y1=y2, and the expressions of the two circles are:
[0037] (x-x1) 2 +(y-y1) 2 +(z-z1) 2 =d1 2
[0038] (x-x2) 2 +(y-y2) 2 +(z-z2) 2 =d22
[0039] Subtracting the two equations gives:
[0040] 2*(x2-x1)*x+(z-z1) 2 -(z-z2) 2 +d2 2 -d1 2 +x1 2 -x2 2 =0
[0041] Let the linear equation be:
[0042] A=2*(x2-x1)
[0043] C=(z-z1) 2 -(z-z2) 2 +d2 2 -d1 2 +x1 2 -x2 2
[0044] Then x=-C / A
[0045] The equation of the line together with the circle (x-x1) 2 +(y-y1) 2 +(z-z1) 2 =d1 2 is:
[0046] y 2 -2*y1y+x 2 -2*x1x+(z-z1) 2 -d1 2 +x1 2 +y1 2 =0
[0047] Let:
[0048] a=1
[0049] b=-2*y1
[0050] c=x 2 -2*x1x+(z-z1) 2 -d1 2 +x1 2 +y1 2
[0051] Then a*y 2 +b*y+c=0
[0052] In the quadratic equation: Δ=b 2 -4*a*c
[0053] When Δ ≥ 0, i.e. the two circles have intersection points:
[0054] The intersection point coordinates are
[0055] Otherwise, the two circles have no intersection points, and the constructed intersection point is x = -C / A, y = y1, and the constructed intersection point coordinates are (-C / A, y1, z).
[0056] Optionally, the process of obtaining the vertex of the weighted centroid algorithm of each combination further includes:
[0057] The two circle center coordinates formed by the two base stations are respectively: circle 1 (x1, y1, z1) and circle 2 (x2, y2, z2), assuming that the label height z is known, when the longitudinal coordinates of the two circle centers are not equal and the horizontal coordinates are not equal:
[0058] That is, x1≠x2, y1≠y2, the expressions of the two circles are respectively:
[0059] (x-x1) 2 +(y-y1) 2 +(z-z1) 2 =d1 2
[0060] (x-x2) 2 +(y-y2) 2 +(z-z2) 2 =d2 2
[0061] Subtracting the two formulas can obtain:
[0062] 2*(x2-x1)*x+2*(y2-y1)y+(z-z1) 2 -(z-z2) 2 +d2 2 -d1 2 +x1 2
[0063] -x2 2 +y1 2 -y2 2 =0
[0064] Let the first-order equation:
[0065] A=2*(x2-x1)
[0066] B=2*(y2-y1)
[0067] C=(z-z1) 2 -(z-z2) 2 +d22 - d1 2 + x1 2 - x2 2 + y1 2 - y2 2
[0068] The equation of the straight line and the circle (x-x1) 2 + (y-y1) 2 + (z-z1) 2 = d1 2 , we get:
[0069]
[0070] Let:
[0071] a = (1 + A / B)2
[0072]
[0073]
[0074] a * y 2 + b * y + c = 0
[0075] In the quadratic equation: Δ = b 2 - 4 * a * c
[0076] When Δ ≥ 0, that is, the two circles have two intersection points: y = -(C + A * x) / B
[0077] Then y1 = -(C + A * x1) / B
[0078] y2 = -(C + A * x2) / B
[0079] Then the intersection coordinates are:
[0080] Otherwise, the equation of the line connecting the centers is:
[0081] A1 * x + B1 * y + C1 = 0
[0082] Where A1 = y2 - y1, B1 = x1 - x2, C1 = (y1 - y2) * x1 - (x1 - x2) * y1
[0083] The straight line equation of the two circles is:
[0084] A * x + B * y + C = 0
[0085] The intersection point is constructed as:
[0086] y=-(A1*CA*C1) / (A2*BA*B1)
[0087] x=-(B*y+C) / A
[0088] Then the coordinates of the constructed intersection point are (-(B*y+C) / A,-(A1*CA*C1) / (A2*BA*B1),z.
[0089] Optionally, the process of calculating the coordinates of the positioning tag using a weighted centroid algorithm includes:
[0090] When any two of the n circles intersect, there are Vertices, the weighted centroid vertex is a combination of points at the intersection of any two circles, Combination of species;
[0091] When there are non-pairwise intersections among the n circles, Then construct an intersection point, and use the constructed intersection point as the weighted centroid vertex;
[0092] The m vertices are (X1, Y1, Z1), (X2, Y2, Z2)... (X m ,Y m ,Z m ), the corresponding coordinate calculation formula is:
[0093]
[0094] When two of the n circles intersect, 2 n The corresponding vertex combinations form k=2 n area, corresponding to the solution of 2 n The coordinates of the positioning tags;
[0095] When n circles do not intersect each other, the number of vertex combinations and the number of areas are less than 2 n ;
[0096] The weighted centroid algorithm is used to calculate the coordinates of a positioning tag in each area. Recorded as
[0097] Optionally, the process of calculating the solution error using the weighted centroid algorithm includes: using the weighted centroid algorithm for each region to calculate the coordinates of a positioning tag The distance from the positioning tag to n base stations (d1, d2, ... d n ), the coordinates of the n base stations are (x1,y1,z1),(x2,y2,z2)……,(x n ,y n ,z nIf the positioning label is located in the region, the calculation error corresponding to the coordinate of each region positioning label is calculated as follows:
[0098]
[0099] Optionally, the final position of the positioning label is calculated by using the calculation error weighting, including: using the reciprocal of the calculation error as a weight value, weighting the calculated coordinate of the positioning label in each region by the weight value to obtain the final coordinate:
[0100] w error_k′ = 1 / E error _(pos_k′)(k′∈[1,2 n ])
[0101] The final coordinate calculation formula is as follows:
[0102]
[0103] The application further discloses a weighted centroid positioning system, including: a direction-finding module, a weighted centroid vertex acquisition module and a calculation error module.
[0104] The direction-finding module is used for acquiring n sets of distances from a positioning label to n base stations and coordinates of the n base stations, and constructing n circle equations.
[0105] The weighted centroid vertex acquisition module is used for acquiring vertices of a weighted centroid algorithm.
[0106] The calculation error module is used for calculating coordinates of the positioning label by using the weighted centroid algorithm for a region surrounded by the vertices, thereby calculating a calculation error, and calculating a final position of the positioning label by using the calculation error weighting.
[0107] The application further includes a computer readable storage medium, wherein computer executable instructions are stored in the computer readable storage medium, and the computer executable instructions are executed by a processor to realize steps in the method.
[0108] Compared with the prior art, the application uses distance measurement values and base station coordinates to construct circle equations, n base stations and n distance measurement values to construct n circle equations, selects two base stations from the n base stations, wherein n is greater than or equal to 3, and there are combinations, acquires vertices of the circle equations of each combination, calculates coordinates and calculation errors of the positioning label by using the weighted centroid algorithm for a region surrounded by the vertices, and calculates a final position of the positioning label by using the calculation error weighting.
[0109] The application provides a weighted centroid positioning method, a system and a storage medium, which can ensure that when ranging errors are large and two circles do not have intersection points (such as the two circles being apart from each other, containing each other or being tangent to each other), the corresponding intersection points can still be constructed as the vertices of the weighted centroid algorithm; and the final position of the positioning tag is calculated by using error weighting calculation, so that the situation that the selection of the vertices is wrong due to ranging errors and thus the positioning has a large deviation is avoided; and the accuracy and stability of the ranging positioning algorithm are greatly improved. BRIEF DESCRIPTION OF DRAWINGS
[0110] Figure 1 A weighted centroid positioning method flowchart in the embodiment of the application;
[0111] Figure 2 A vertex coordinate construction diagram when two circles are apart from each other in the embodiment of the application;
[0112] Figure 3 A vertex coordinate construction diagram when two circles are tangent to each other in the embodiment of the application;
[0113] Figure 4 A vertex coordinate construction diagram when two circles contain each other in the embodiment of the application;
[0114] Figure 5 A vertex coordinate diagram when two circles intersect each other in the embodiment of the application;
[0115] Figure 6 A vertex coordinate diagram when two of the three circles intersect each other in the embodiment of the application;
[0116] Figure 7 A diagram of the position calculated based on the minimum calculation error of the vertex, the real position and the position calculated based on the error weighting calculation in the embodiment of the application Figure 1 ;
[0117] Figure 8 A diagram of the position calculated based on the minimum calculation error of the vertex, the real position and the position calculated based on the error weighting calculation in the embodiment of the application Figure 2 ;
[0118] Figure 9 A diagram of the position calculated based on the minimum calculation error of the vertex, the real position and the position calculated based on the error weighting calculation in the embodiment of the application Figure 3 ;
[0119] Figure 10 A positioning error comparison diagram based on the minimum calculation error of the vertex and the error weighting calculation in the embodiment of the application;
[0120] Figure 11The vertex calculation based on minimum calculation error and the positioning error cumulative distribution function calculated based on the calculation error weighted in the embodiment of the application;
[0121] Figure 12 The figure is a comparison diagram of base station ranging errors in the embodiment of the application. DETAILED DESCRIPTION
[0122] The weighted centroid positioning method, system and storage medium of the application will be described in more detail below with reference to the figures, which represent the preferred embodiments of the application, and it should be understood that those skilled in the art can modify the application described herein while still achieving the advantageous effects of the application. Therefore, the following description should be understood as extensive knowledge for those skilled in the art and not as a limitation on the application.
[0123] The application will be described in more detail in the following paragraphs with reference to the accompanying drawings. The advantages and features of the application will be more apparent from the following description and claims. It should be noted that the drawings are very simplified and use non-precise proportions, only for the purpose of conveniently and clearly assisting the description of the embodiments of the application.
[0124] A weighted centroid positioning method of the application will be described in detail below, with reference to Figure 1 The method comprises the steps of:
[0125] S1, obtaining n sets of distances from a positioning tag to n base stations and coordinates of the n base stations, and constructing n circle equations;
[0126] S2, selecting 2 base stations from the n base stations, there are combinations, and obtaining vertices of the weighted centroid algorithm of each combination, wherein (n≥3);
[0127] S3, calculating the coordinates of the positioning tag by using the weighted centroid algorithm for the area surrounded by the vertices;
[0128] S4, calculating the calculation error by using the weighted centroid algorithm;
[0129] S5, calculating the final position of the positioning tag by using the calculation error weighted.
[0130] In this embodiment, it is assumed that n=3, and the method of the application is not only applicable to three base stations, but also applicable to multiple base stations.
[0131] Specifically, in step S1, the ranging values and the base station coordinates are used to form the equations of circles, and three base stations and three ranging values are used to form three circle equations.
[0132] In step S2, when two circles in the n circles intersect, there are An intersection point (vertex), due to the existence of ranging error, two circles in n circles can not have intersection points, there are apart, contain, tangent and other cases, so it is necessary to judge whether two circles formed by two base stations have intersection points; If there is an intersection point, the intersection point is taken as a vertex, if there is no intersection point, the intersection point is constructed, and the constructed intersection point is taken as a vertex.
[0133] Specifically, in the embodiment, two base stations are selected from three base stations, there are three combinations in total, the vertex of the weighted centroid algorithm of each combination is obtained, when two circles in three circles intersect, there are six intersection points (vertices) in total; If two circles are apart, contain or tangent, two circles have only one intersection point, so when two circles in three circles do not intersect, m < 6.
[0134] Specifically, the process of obtaining the vertex of the weighted centroid algorithm of each combination includes:
[0135] The coordinates of the centers of the two circles formed by two base stations are respectively: circle 1 (x1, y1, z1) and circle 2 (x2, y2, z2), assuming that the label height z is known, when the horizontal coordinates of the centers of the two circles are equal and the vertical coordinates are not equal,
[0136] That is, x1=x2, and y1≠y2, the expressions of the two circles are respectively:
[0137] (x-x1) 2 +(y-y1) 2 +(z-z1) 2 =d1 2
[0138] (x-x2) 2 +(y-y2) 2 +(z-z2) 2 =d2 2
[0139] Subtracting the two formulas can obtain:
[0140] 2*(y2-y1)*y+(z-z1) 2 -(z-z2) 2 +d2 2 -d1 2 +y1 2 -y2 2 =0
[0141] Let the first-order equation:
[0142] B=2*(y2-y1)
[0143] C=(z-z1) 2 -(z-z2) 2 +d2 2- d1 2 + y1 2 - y2 2
[0144] y = -C / B
[0145] The equation of the straight line and the circle (x-x1) 2 + (y-y1) 2 + (z-z1) 2 = d1 2 We can get:
[0146] x 2 - 2*x1x + y 2 - 2*y1y + (z-z1) 2 - d1 2 + y1 2 + x1 2 = 0
[0147] Let:
[0148] a = 1
[0149] b = -2*x1
[0150] c = y 2 - 2*y1y + (z-z1) 2 - d1 2 + y1 2 + x1 2
[0151] a*x 2 + b*x + c = 0
[0152] In the quadratic equation: Δ = b 2 - 4*a*c
[0153] When Δ ≥ 0, that is, the two circles have intersection points:
[0154] The intersection coordinates are That is, the intersection point is taken as the vertex of the weighted centroid algorithm.
[0155] Otherwise, the two circles have no intersection points, and the intersection point is constructed: x = x1, y = -C / B, and the constructed intersection point coordinates are (x1, -C / B, z). That is, the constructed intersection point is taken as the vertex of the weighted centroid algorithm.
[0156] When the longitudinal coordinates of the two circle centers are equal and the horizontal coordinates are not equal:
[0157] That is, x1≠x2, y1=y2, and the expressions of the two circles are respectively:
[0158] (x-x1) 2+ (y - y1) 2 + (z - z1) 2 = d1 2
[0159] (x - x2) 2 + (y - y2) 2 + (z - z2) 2 = d2 2
[0160] Subtracting the two equations gives:
[0161] 2 * (x2 - x1) * x + (z - z1) 2 - (z - z2) 2 + d2 2 - d1 2 + x1 2 - x2 2 = 0
[0162] Let the linear equation be:
[0163] A = 2 * (x2 - x1)
[0164] C = (z - z1) 2 - (z - z2) 2 + d2 2 - d1 2 + x1 2 - x2 2
[0165] Then x = -C / A
[0166] The equation of the line together with the circle (x - x1) 2 + (y - y1) 2 + (z - z1) 2 = d1 2 gives:
[0167] y 2 - 2 * y1 * y + x 2 - 2 * x1 * x + (z - z1) 2 - d1 2 + x1 2 + y1 2 = 0
[0168] Let:
[0169] a = 1
[0170] b = -2 * y1
[0171] c = x 2 - 2 * x1 * x + (z - z1) 2 - d1 2 + x12 + y1 2
[0172] a * y 2 + b * y + c = 0
[0173] In the quadratic equation: Δ = b 2 - 4 * a * c
[0174] When Δ ≥ 0, that is, the two circles have intersection points:
[0175] The intersection point coordinates are That is, the intersection point is taken as the vertex of the weighted centroid algorithm;
[0176] Otherwise, the two circles have no intersection points, and the intersection point is constructed as: x = -C / A, y = y1, and the constructed intersection point coordinates are (-C / A, y1, z), that is, the constructed intersection point is taken as the vertex of the weighted centroid algorithm.
[0177] When the longitudinal coordinates of the centers of the two circles are not equal and the horizontal coordinates are not equal:
[0178] That is, x1≠x2,y1≠y2, the expressions of the two circles are respectively:
[0179] (x - x1) 2 + (y - y1) 2 + (z - z1) 2 = d1 2
[0180] (x - x2) 2 + (y - y2) 2 + (z - z2) 2 = d2 2
[0181] Subtracting the two formulas can obtain:
[0182] 2 * (x2- x1) * x + 2 * (y2- y1) y + (z - z1) 2 - (z - z2) 2 + d2 2 - d1 2 + x1 2 - x2 2 + y1 2 - y2 2 = 0
[0183] Let the linear equation be:
[0184] A = 2 * (x2- x1)
[0185] B = 2 * (y2- y1)
[0186] C = (z - z1) 2 -(z - z2) 2 +d2 2 -d1 2 +x1 2 -x2 2 +y1 2 -y2 2
[0187] Then the equation of the straight line and the circle (x - x1) 2 +(y - y1) 2 +(z - z1) 2 =d1 2 , we can get:
[0188]
[0189] Let:
[0190] a = (1 + A / B) 2
[0191]
[0192]
[0193] Then a*x 2 +b*x + c = 0
[0194] In the quadratic equation: Δ = b 2 -4*a*c
[0195] When Δ ≥ 0, that is, the two circles have two intersection points: y = -(C + A*x) / B
[0196] Then y1 = -(C + A*x1) / B
[0197] y2 = -(C + A*x2) / B
[0198] Then the two intersection points are:
[0199] Otherwise, the equation of the line connecting the centers of the two circles is:
[0200] A1*x + B1*y + C1 = 0
[0201] Where A1 = y2 - y1, B1 = x1 - x2, C1 = (y1 - y2)*x1 - (x1 - x2)*y1
[0202] The equation of the straight line of the two circles is:
[0203] A*x + B*y + C = 0
[0204] The intersection point of the construction is:
[0205] y = -(A1*C - A*C1) / (A2*B - A*B1)
[0206] x = -(B*y + C) / A
[0207] The coordinates of the intersection point of the construction are (-(B*y + C) / A, -(A1*C - A*C1) / (A2*B - A*B1), z, i.e. the intersection point of the construction is taken as the vertex of the weighted centroid algorithm.
[0208] Specifically, no matter whether the two circles formed by the two base stations are apart, contain each other, intersect or touch, there will be the above three coordinate conditions (horizontal coordinate is equal and vertical coordinate is not equal, horizontal coordinate is not equal and vertical coordinate is equal, or horizontal and vertical coordinates are not equal), and specific descriptions are made for the acquisition of the vertexes for the four possible states of the two circles (the related diagrams are only special examples):
[0209] 1. Please refer to FIG. 1, when the two circles are apart, since the straight line obtained by subtracting the equations of the two circles is perpendicular to the line connecting the centers of the two circles, and the length of any point on the straight line to the tangent of the two circles is equal, when the radii of the two circles are equal, the straight line is symmetrical about the two circles, therefore the vertex P is the intersection point of the straight line and the line connecting the centers of the two circles. Figure 2 2. Please refer to FIG. 2, when the two circles are tangent, since the straight line obtained by subtracting the equations of the two circles is the common tangent passing through the tangent point, therefore the intersection point P is the tangent point, i.e. the vertex P is constructed.
[0210] Figure 3 3. Please refer to FIG. 3, when the two circles contain each other, since the length of any point on the straight line obtained by subtracting the equations of the two circles to the tangent of the two circles is equal, therefore the vertex P is the intersection point of the straight line and the line connecting the centers of the two circles.
[0211] 4. Please refer to FIG. 4, when the two circles intersect, the obtained straight line is the straight line on which the intersecting chord is located, the intersection point is the intersection point P1 and P2 of the straight line and the two circles, and the vertex is one of P1 and P2. Figure 4 Further, in step S3, please refer to FIG. 5, the formula of the weighted centroid algorithm is as follows (taking the case that the two circles intersect as an example), the three vertexes are P1 (X1, Y1, Z1), P2 (X2, Y2, Z2) and P3 (X3, Y3, Z3),
[0212] Figure 5
[0213] Figure 6
[0214]
[0215] After the apexes of the weighted centroid algorithm are obtained, the coordinates of the positioning tags can be calculated according to the above formula, wherein when two of the n circles intersect, there are a total of apexes, the weighted centroid apexes are a combination of one point in the intersection points of the intersection of any two circles, and there are a total of combinations, in this embodiment, when three circles intersect with each other, there are a total of six apexes, which correspond to two 3 areas, and the coordinates of two positioning tags can be calculated. 3 When two circles are included, separated or tangent, the number of apex combinations and the number of areas are less than two 3 .
[0216] In step S4, taking three circles as an example, it is assumed that the circles intersect with each other and have two intersection points, and there are a total of six intersection points, which enclose eight areas, and the coordinates of one positioning tag in each area can be calculated using the weighted centroid algorithm and marked as The measured distances of the positioning tag to the three base stations are (d1, d1, d3), and the coordinates of the three base stations are (x1, y1, z1), (x2, y2, z2), and (x3, y3, z3), specifically, the measured distances can be obtained by a logarithmic attenuation model using the received signal strength indication (RSSI) of the tag to the base station or a time measurement such as a time of flight measurement (TOF) ranging algorithm.
[0217] Then the calculation error of the position of the positioning tag in each area is:
[0218]
[0219] In step S5, specifically, in the prior art, the tag position calculated by the apex combination with the smallest calculation error is generally selected as the coordinate value of the positioning tag, and in theory, the smaller the calculation error, the more accurate the positioning. However, please refer to Figure 12 When there is a large ranging error, there may be a case that the calculation error is small (the calculation error is defined as the difference between the distance from the calculated position to each base station and the measured distance) but the actual positioning error is large; therefore, in order to avoid the selection error of the apex caused by the ranging error and cause a large deviation in positioning, the present application proposes an improved weighted centroid algorithm based on the calculation error, that is, according to the calculation error, which intersection points are used as the apexes to calculate the position more accurately, which can greatly improve the positioning accuracy.
[0220] In the embodiment, 8 regions are used to estimate 8 positioning positions by using the weighted centroid algorithm, and the 8 estimated positions correspond to 8 calculation errors, theoretically, the smaller the calculation error is, the more accurate the positioning is, in order to avoid the situation that the positioning appears a larger deviation caused by the selection error of the weighted centroid algorithm vertex caused by the ranging error, the application provides a weighted centroid algorithm based on calculation error weighting, uses the reciprocal of the calculation error as the weight, and obtains the final coordinates by weighting the coordinates of each region by the weight:
[0221] w error_k′ =1 / E error _(pos_k′)(k′∈[1,8])
[0222] The final coordinate calculation formula is:
[0223]
[0224] Please refer to Figures 7-9 , through the actual measurement data, it is proved that the position calculated by the three intersection points with the smallest calculation error is greatly different from the true position (because the ranging error is large), and the calculation error weighting method can further improve the accuracy.
[0225] And in Figures 10-11 , by comparing the positioning error calculated based on the vertex with the smallest calculation error and the positioning error calculated based on the calculation error weighting, it can be seen that the error of the calculation error weighting method is smaller.
[0226] The embodiment of the application also provides a weighted centroid positioning system, comprising: a direction finding module, a weighted centroid vertex acquisition module and a calculation error module.
[0227] The direction finding module is used to acquire n sets of distances from a positioning tag to n base stations and the coordinates of the n base stations, and construct n circle equation groups.
[0228] The weighted centroid vertex acquisition module is used to acquire the vertex of the weighted centroid algorithm.
[0229] The calculation error module is used to calculate the coordinates of the positioning tag by using the weighted centroid algorithm for the region surrounded by the vertex, so as to calculate the calculation error, and calculate the final position of the positioning tag by using the calculation error weighting.
[0230] The weighted centroid vertex acquisition module is specifically used to obtain the vertex of the weighted centroid algorithm in the following form:
[0231] Suppose that the height z of the tag is known, when the horizontal coordinates of the centers of the two circles are equal and the vertical coordinates are not equal
[0232] That is, x1=x2, and y1≠y2, the expressions of the two circles are respectively:
[0233] (x - x1) 2 +(y - y1) 2 +(z - z1) 2 = d1 2
[0234] (x - x2) 2 +(y - y2) 2 +(z - z2) 2 = d2 2
[0235] Subtracting the two equations gives:
[0236] 2*(y2 - y1)*y + (z - z1) 2 -(z - z2) 2 + d2 2 - d1 2 + y1 2 - y2 2 = 0
[0237] Let the linear equation be:
[0238] B = 2*(y2 - y1)
[0239] C = (z - z1) 2 -(z - z2) 2 + d2 2 - d1 2 + y1 2 - y2 2
[0240] Then y = -C / B
[0241] Then the equation of the line together with the circle (x - x1) 2 +(y - y1) 2 +(z - z1) 2 = d1 2 gives:
[0242] x 2 - 2*x1x + y 2 - 2*y1y + (z - z1) 2 - d1 2 + y1 2 + x1 2 = 0
[0243] Let:
[0244] a = 1
[0245] b = -2*x1
[0246] c = y 2 - 2*y1y + (z - z1) 2- d1 2 + y1 2 + x1 2
[0247] then a*x 2 + b*x + c = 0
[0248] In the quadratic equation: Δ = b 2 - 4*a*c
[0249] When Δdelta≥0, that is, the two circles have intersection points:
[0250] The intersection point coordinates are That is, the intersection point is taken as the vertex of the weighted centroid algorithm.
[0251] Otherwise, the two circles have no intersection points, and the intersection point is constructed as: x=x1, y=-C / B; The constructed intersection point coordinates are (x1,-C / B,z), that is, the constructed intersection point is taken as the vertex of the weighted centroid algorithm.
[0252] When the longitudinal coordinates of the centers of the two circles are equal and the horizontal coordinates are not equal:
[0253] That is, x1≠x2, y1=y2, and the expressions of the two circles are respectively:
[0254] (x-x1) 2 +(y-y1) 2 +(z-z1) 2 =d1 2
[0255] (x-x2) 2 +(y-y2) 2 +(z-z2) 2 =d2 2
[0256] Subtracting the two formulas can obtain:
[0257] 2*(x2-x1)*x+(z-z1) 2 -(z-z2) 2 +d2 2 -d1 2 +x1 2 -x2 2 =0
[0258] Let the linear equation be:
[0259] A=2*(x2-x1)
[0260] C=(z-z1) 2 -(z-z2) 2 +d2 2 -d12 + x1 2 - x2 2
[0261] x = -C / A
[0262] The equation of the straight line and the circle (x-x1) 2 + (y-y1) 2 + (z-z1) 2 = d1 2 We can get:
[0263] y 2 -2*y1y + x 2 -2*x1x + (z-z1) 2 - d1 2 + x1 2 + y1 2 = 0
[0264] Let:
[0265] a = 1
[0266] b = -2*y1
[0267] c = x 2 -2*x1x + (z-z1) 2 - d1 2 + x1 2 + y1 2
[0268] a*y 2 + b*y + c = 0
[0269] In the quadratic equation: Δ = b 2 -4*a*c
[0270] When Δ ≥ 0, that is, the two circles have intersection points:
[0271] The intersection coordinates are That is, the intersection point is taken as the vertex of the weighted centroid algorithm;
[0272] Otherwise, the two circles have no intersection points, and the intersection point is constructed as: x = -C / A, y = y1, and the constructed intersection point coordinates are (-C / A, y1, z), that is, the constructed intersection point is taken as the vertex of the weighted centroid algorithm.
[0273] When the longitudinal coordinates of the two circle centers are not equal and the horizontal coordinates are not equal:
[0274] That is, x1≠x2, y1≠y2, and the expressions of the two circles are respectively:
[0275] (x-x1) 2 + (y-y1)2 +(z-z1) 2 =d1 2
[0276] (x-x2) 2 +(y-y2) 2 +(z-z2) 2 =d2 2
[0277] Subtracting the two equations gives:
[0278] 2*(x2-x1)*x+2*(y2-y1)y+(z-z1) 2 -(z-z2) 2 +d2 2 -d1 2 +x1 2 -x2 2 +y1 2 -y2 2 =0
[0279] Let the linear equation be:
[0280] A=2*(x2-x1)
[0281] B=2*(y2-y1)
[0282] C=(z-z1) 2 -(z-z2) 2 +d2 2 -d1 2 +x1 2 -x2 2 +y1 2 -y2 2
[0283] Then the equation of the line together with the circle (x-x1) 2 +(y-y1) 2 +(z-z1) 2 =d1 2 gives:
[0284]
[0285] Let:
[0286] a=(1+A / B) 2
[0287]
[0288]
[0289] Then a*x 2 +b*x+c=0
[0290] In the quadratic equation: Δ = b 2 -4*a*c
[0291] When Δ ≥ 0, that is, two circles have two intersection points: y = -(C + A*x) / B
[0292] Then y1 = -(C + A*x1) / B
[0293] y2 = -(C + A*x2) / B
[0294] Then the coordinates of the two intersection points are:
[0295] Otherwise, the equation of the line connecting the centers is:
[0296] A1*x + B1*y + C1 = 0
[0297] Where A1 = y2 - y1, B1 = x1 - x2, C1 = (y1 - y2)*x1 - (x1 - x2)*y1
[0298] The equation of the line obtained by subtracting the two circles is:
[0299] A*x + B*y + C = 0
[0300] The constructed intersection point is:
[0301] y = -(A1*C - A*C1) / (A2*B - A*B1)
[0302] x = -(B*y + C) / A
[0303] Then the coordinates of the constructed intersection point are (-(B*y + C) / A, -(A1*C - A*C1) / (A2*B - A*B1), z, that is, the constructed intersection point is used as the vertex of the weighted centroid algorithm.
[0304] The solving error module is specifically configured to calculate the coordinates of the positioning tag in the following form to calculate the solving error:
[0305] When each two circles in the n circles intersect, there are vertices in total, and the weighted centroid vertex is a combination of one point in the intersection point of any two circles, and there are combinations;
[0306] When there is non-two-two circle intersection in the n circles, the constructed intersection point is used as the weighted centroid vertex;
[0307] m vertices are (X1, Y1, Z1), (X2, Y2, Z2) … (X m ,Y m ,Z m ), the corresponding coordinate calculation formula is:
[0308]
[0309] When two of the n circles intersect, 2 n The combination of the vertices corresponds to k = 2 n The number of regions, which can be calculated to solve the coordinates of 2 n Positioning tags;
[0310] When non-two of the n circles intersect, the number of vertex combinations and the number of regions is less than 2 n ;
[0311] Each region can calculate the coordinates of a positioning tag using the weighted centroid algorithm , denoted as
[0312] Using the weighted centroid algorithm, the coordinates of a positioning tag can be calculated in each region The distance (d1, d2, … d n ) from the positioning tag to the n base stations and the coordinates (x1, y1, z1), (x2, y2, z2) … (x n ,y n ,z n ) of the n base stations, the calculation error of the positioning tag in each region is:
[0313]
[0314] The calculation error module is specifically configured to calculate the final position of the positioning tag in the following form:
[0315] Based on the weighted centroid method based on the calculation error, the reciprocal of the calculation error is used as the weight, and the final coordinates are obtained by weighting the calculated coordinates of the positioning tag in each region:
[0316] w error_k′ = 1 / E error _(pos_k′)(k′∈[1,2 n ])
[0317] The final coordinate calculation formula is:
[0318]
[0319] Accordingly, other embodiments of the present application can also provide a computer readable storage medium having stored thereon computer-executable instructions that, when executed by a processor, implement methods of the present application. The computer readable storage medium includes permanent and non-permanent, movable and non-movable media that can be implemented by any method or technology to store information. The information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technologies, compact disc read only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible by a computing device.
[0320] In summary, the present application scheme can ensure that the corresponding intersection point can be constructed as the vertex of the weighted centroid algorithm when the ranging error is large enough to cause the two circles to have no intersection point, and can avoid the situation that the positioning deviation is large due to the selection error of the vertex caused by the ranging error, can greatly improve the accuracy and stability of the ranging positioning algorithm, and the method has the characteristics of simple operation and strong practicability.
[0321] Obviously, those skilled in the art can make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application also intends to include these modifications and variations.
Claims
1. A weighted centroid positioning method, characterized in that: The following steps are involved: Obtain n sets of distances from the positioning tag to n base stations and the coordinates of the n base stations, and construct n sets of circle equations; Select 2 base stations from n base stations, with a total of combinations, and obtain the vertex of the weighted centroid algorithm for each combination, where n≥3; Calculating the coordinates of the positioning tag using a weighted centroid algorithm for the area enclosed by the vertices; The solution error is calculated using the weighted centroid algorithm; The final position of the positioning tag is calculated using the weighted solution error; The process of obtaining the vertex of the weighted centroid algorithm of each combination includes: determining whether there is an intersection between two circles formed by the two base stations of each combination; if there is an intersection, using the intersection as the vertex; if there is no intersection, constructing an intersection and using the constructed intersection as the vertex; The process of calculating the coordinates of the positioning tag using the weighted centroid algorithm includes: When any two of the n circles intersect, there are Vertices, the weighted centroid vertex is a combination of points at the intersection of any two circles, Combination of species; When there are non-pairwise intersections among the n circles, Then construct an intersection point, and use the constructed intersection point as the weighted centroid vertex; The m vertices are (X1, Y1, Z1), (X2, Y2, Z2)... (X m ,Y m ,Z m ), the corresponding coordinate calculation formula is: When two of the n circles intersect, 2 n The corresponding vertex combinations form k=2 n area, corresponding to the solution of 2 n The coordinates of the positioning tags; When n circles do not intersect each other, the number of vertex combinations and the number of areas are less than 2 n ; The weighted centroid algorithm is used to calculate the coordinates of a positioning tag in each area. Recorded as 2. A weighted centroid positioning method according to claim 1, characterized in that: The process of obtaining the vertex of the weighted centroid algorithm of each combination also includes: The coordinates of the centers of the two circles formed by the two base stations are: circle 1 (x1, y1, z1) and circle 2 (x2, y2, z2). Assuming that the height z of the positioning tag is known, when the horizontal coordinates of the centers of the two circles are equal but the vertical coordinates are not equal: that is, x1 = x2 and y1 ≠ y2, the expressions of the two circles are: (x-x1) 2 +(y-y1) 2 +(z-z1) 2 =d1 2 (x-x2) 2 +(y-y2) 2 +(z-z2) 2 =d2 2 Subtracting the two formulas yields: 2*(y2-y1)*y+(z-z1) 2 -(z-z2) 2 +d2 2 -d1 2 +y1 2 -y2 2 =0 Let the linear equation be: B=2*(y2-y1) C=(z-z1) 2 -(z-z2) 2 +d2 2 -d1 2 +y1 2 -y2 2 We can get y = -C / B Then the equation of the circle connected with the straight line is (x-x1) 2 +(y-y1) 2 +(z-z1) 2 =d1 2 ,available: x 2 -2*x1x+y 2 -2*y1y+(z-z1) 2 -d1 2 +y1 2 +x1 2 0 make: a=1 b=-2*x1 c=y 2 -2*y1y+(z-z1) 2 -d1 2 +y1 2 +x1 2 Then a*x 2 +b*x+c=0 In a quadratic equation: Δ = b 2 -4*a*c When Δ≥0, the two circles intersect: The intersection coordinates are Otherwise, if the two circles have no intersection, then an intersection is constructed. The constructed intersection is: x=x1, y=-C / B, and the coordinates of the constructed intersection are (x1,-C / B,z).
3. A weighted centroid positioning method according to claim 1, characterized in that: The process of obtaining the vertex of the weighted centroid algorithm of each combination also includes: The coordinates of the centers of the two circles formed by the two base stations are: circle 1 (x1, y1, z1) and circle 2 (x2, y2, z2). Assuming that the height z of the positioning tag is known, when the vertical coordinates of the centers of the two circles are equal but the horizontal coordinates are not equal: That is, x1≠x2, y1=y2, and the expressions of the two circles are: (x-x1) 2 +(y-y1) 2 +(z-z1) 2 =d1 2 (x-x2) 2 +(y-y2) 2 +(z-z2) 2 =d2 2 Subtracting the two formulas yields: 2*(x2-x1)*x+(z-z1) 2 -(z-z2) 2 +d2 2 -d1 2 +x1 2 -x2 2 0 Let the linear equation be: A=2*(x2-x1) C=(z-z1) 2 -(z-z2) 2 +d2 2 -d1 2 +x1 2 -x2 2 So x=-C / A Then the equation of the circle connected with the straight line is (x-x1) 2 +(y-y1) 2 +(z-z1) 2 =d1 2 available: y 2 -2*y1y+x 2 -2*x1x+(z-z1) 2 -d1 2 +x1 2 +y1 2 0 make: a=1 b=-2*y1 c=x 2 -2*x1x+(z-z1) 2 -d1 2 +x1 2 +y1 2 Then a*y 2 + b*y + c = 0 In a quadratic equation: Δ = b 2 -4*a*c When Δ≥0, the two circles intersect: The intersection coordinates are Otherwise, the two circles have no intersection, so the intersection point is constructed as: x=-C / A, y=y1, and the coordinates of the constructed intersection point are (-C / A, y1, z).
4. A weighted centroid positioning method according to claim 1, characterized in that: The process of obtaining the vertex of the weighted centroid algorithm of each combination also includes: The coordinates of the centers of the two circles formed by the two base stations are: circle 1 (x1, y1, z1) and circle 2 (x2, y2, z2). Assuming that the tag height z is known, when the vertical coordinates and horizontal coordinates of the two circle centers are not equal: That is, x1≠x2, y1≠y2, and the expressions of the two circles are: (x-x1) 2 +(y-y1) 2 +(z-z1) 2 =d1 2 (x-x2) 2 +(y-y2) 2 +(z-z2) 2 =d2 2 Subtracting the two formulas yields: 2*(x2-x1)*x+2*(y2-y1)y+(z-z1) 2 -(z-z2) 2 +d2 2 -d1 2 +x1 2 -x2 2 +y1 2 -y2 2 =0 Let the linear equation be: A=2*(x2-x1) B=2*(y2-y1) C=(z-z1) 2 -(z-z2) 2 +d2 2 -d1 2 +x1 2 -x2 2 +y1 2 -y2 2 Then the equation of the circle connected with the straight line is (x-x1) 2 +(y-y1) 2 +(z-z1) 2 =d1 2 ,available: make: a=(1+A / B) 2 Then a*x 2 +b*x+c=0 In a quadratic equation: Δ = b 2 -4*a*c When Δ≥0, the two circles have two intersection points: y=-(C+A*x) / B but y1=-(C+A*x1) / B y2=-(C+A*x2) / B The coordinates of the two intersection points are: Otherwise, the equation of the line connecting the centers of the circles is: A1*x+B1*y+C1=0 Where A1=y2-y1,B1=x1-x2,C1=(y1-y2)*x1-(x1-x2)*y1 The equation of the line that subtracts two circles is: A*x+B*y+C=0 The constructed intersection is: y=-(A1*CA*C1) / (A2*BA*B1) x=-(B*y+C) / A Then the coordinates of the constructed intersection point are (-(B*y+C) / A,-(A1*CA*C1) / (A2*BA*B1),z).
5. A weighted centroid positioning method according to claim 1, characterized in that: The process of calculating the solution error using the weighted centroid algorithm includes: using the weighted centroid algorithm in each area to calculate the coordinates of a positioning tag The distance from the positioning tag to n base stations (d1, d2, ... d n ), the coordinates of the n base stations are (x1,y1,z1),(x2,y2,z2)……,(x n ,y n ,z n ), the solution error corresponding to the coordinates of each regional positioning label is calculated as:
6. A weighted centroid positioning method according to claim 1, characterized in that: The method of calculating the final position of the positioning tag by weighting the solution error includes using a weighted centroid algorithm based on the solution error weighting, using the inverse of the solution error as a weight, and weighting the calculated coordinates of the positioning tag of each area by the weight to obtain the final coordinates: w error_k' =1 / E error _(pos_k')(k'∈[1,2 n ]) The final coordinate calculation formula is:
7. A weighted centroid positioning system, characterized in that: include: Direction finding module, weighted centroid vertex acquisition module and error calculation module; The direction finding module is used to obtain n sets of distances from the positioning tag to n base stations and the coordinates of the n base stations, and to construct n sets of circle equations; The weighted centroid vertex acquisition module is used to obtain the vertices of the weighted centroid algorithm; The error calculation module is used to calculate the coordinates of the positioning tag using a weighted centroid algorithm for the area surrounded by the vertices to obtain a calculation error, and to calculate the final position of the positioning tag using the weighted calculation error.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
RSSI-based weighted centroid positioning algorithm improvement method
CN112135249A