Positioning method and apparatus, electronic device, storage medium, and interaction system
Patent Information
- Application Number
- CN202611115702.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-24
- Publication Date
- 2026-10-16
AI Technical Summary
然而,基站坐标的人工测量不仅增加了系统部署复杂度,而且容易因测量误差导致定位精度下降
[0017] The positioning method provided in this application allows the device to directly determine the relative positions of multiple base stations in a planar coordinate system based on the distance between them, and then arrange these base stations in spatial order to form a closed polygon boundary. This achieves base station positioning and automatic construction of the activity area boundary without relying on external measuring equipment or manual calibration. In the real-time positioning phase, the device receives communication signals sent by different base stations during interaction and records their arrival times. It then calculates its own distance difference relative to different base stations based on the arrival time differences of their communication signals during the same round of interaction. This distance difference, combined with the relative positions of each base station in the planar coordinate system, allows it to calculate its target position. Finally, it determines its internal/external position relative to the target area based on the target position and the constructed closed polygon boundary. In this process, the data sources required for base station positioning, boundary construction, and real-time positioning all originate from signal interactions between base stations. The device under positioning only needs to passively receive communication signals to independently complete the entire calculation process. This eliminates the need for manual measurement of base station coordinates or manual configuration of boundary parameters, and avoids centralized position calculations by base stations or servers. This reduces system deployment complexity while providing the device with independent, real-time spatial positioning and boundary determination capabilities. This application also discloses a positioning device, an electronic device, a storage medium, and an interactive system, which can achieve the same technical effects as described above.
Smart Images

Figure CN122934201A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of wireless positioning technology, and more specifically, to positioning methods, devices, electronic devices, storage media, and interactive systems. Background Technology
[0002] With the development of immersive interactive entertainment, motion-sensing games, children's amusement equipment, and intelligent sports training, more and more systems need to perceive the location of participants in real time and determine boundaries and control interactive logic based on preset activity areas. Ultra-wideband (UWB) technology, with its advantages of centimeter-level positioning accuracy, strong multipath resistance, and high real-time performance, is gradually becoming an important technical means in the field of indoor and outdoor positioning.
[0003] In related technologies, it is typically necessary to pre-measure and fix the location coordinates of multiple base stations, and then use positioning algorithms such as Time Difference of Arrival (TDoA) and Two-Way Ranging (TWR) to calculate the location of the device to be located. However, manual measurement of base station coordinates not only increases the complexity of system deployment, but is also prone to decreased positioning accuracy due to measurement errors. Meanwhile, in related technologies, the boundaries of the activity area are usually manually set as independent configuration parameters, lacking the ability to automatically generate boundaries based on the spatial distribution of base stations. When the site changes or base stations are redeployed, the base station locations need to be remeasured and the boundary parameters reconfigured, resulting in low deployment efficiency. Furthermore, during real-time positioning, related technologies usually rely on centralized location calculation at the base station end, and the device to be located lacks independent location calculation capabilities, further limiting the system's flexibility and real-time response capabilities in dynamic scenarios.
[0004] Therefore, how to automatically construct the boundary of the activity area while the device can independently determine its real-time location is a technical problem that needs to be solved by those skilled in the art. Summary of the Invention
[0005] The purpose of this application is to provide a positioning method, device, electronic device, storage medium, and interactive system that enables the automatic construction of activity area boundaries while allowing the device to independently determine its real-time location.
[0006] To achieve the above objectives, this application provides a positioning method applied to a device, the method comprising: Obtain the distance between multiple base stations set at the boundary of the activity area, determine the relative positions of the multiple base stations in the plane coordinate system based on the distance between the different base stations, and arrange the multiple base stations in spatial order to form a closed polygon boundary; Receive communication signals sent by different base stations during the interaction process, and record the arrival time of the communication signals; The distance difference between the device and the different base stations is calculated based on the arrival times of the communication signals from the different base stations during the same round of interaction. Based on the distance difference between the device and the different base stations and the relative positions of the different base stations in the plane coordinate system, calculate the target position of the device in the plane coordinate system; The positional relationship of the device relative to the active area is determined based on the target location and the boundary of the closed polygon.
[0007] Optionally, determining the relative positions of the multiple base stations in a planar coordinate system based on the distance between different base stations includes: Using the first base station as the origin of the coordinate system and the direction of the second base station as the positive direction of the horizontal axis, the horizontal axis coordinate of the second base station is determined based on the distance between the first base station and the second base station. Based on the distance between the third base station and the first base station, the distance between the third base station and the second base station, and the distance between the first base station and the second base station, the horizontal and vertical coordinates of the third base station in the plane coordinate system are determined; wherein, the third base station refers to all base stations other than the first and second base stations.
[0008] Optionally, receiving communication signals sent by different base stations during the interaction process and recording the arrival time of the communication signals includes: Receive a start signal sent by the initiating base station, a response signal replied by the responding base station, an end signal sent by the initiating base station, and an acknowledgment signal replied by the responding base station, and record the arrival times of the start signal, the response signal, the end signal, and the acknowledgment signal; Accordingly, calculating the distance difference between the device and different base stations based on the arrival times of communication signals from different base stations during the same round of interaction includes: Based on the arrival times of the start signal, the response signal, the end signal, and the acknowledgment signal, the arrival time difference between the signal from the response base station and the signal from the initiating base station at the device is determined. The distance difference between the device and different base stations is calculated based on the arrival time difference and the signal propagation speed.
[0009] Optionally, determining the arrival time difference between the signal from the responding base station and the signal from the initiating base station at the device based on the arrival times of the start signal, the response signal, the end signal, and the acknowledgment signal includes: The round-trip time and response time of the initiating base station are determined from the termination signal; wherein, the round-trip time of the initiating base station is the time interval between the time when the response signal arrives at the initiating base station and the time when the initiating base station sends the start signal, and the response time of the initiating base station is the time interval between the time when the initiating base station sends the termination signal and the time when the response signal arrives at the initiating base station; The response signal determines the first moment when the start signal arrives at the response base station and the response time of the response base station, and the confirmation signal determines the second moment when the end signal arrives at the response base station; wherein, the response time of the response base station is the time interval between the moment when the response base station sends the response signal and the moment when the start signal arrives at the response base station; A first time-scale mapping coefficient is constructed based on the round-trip time of the initiating base station, the response time of the initiating base station, and the time when the device receives the end signal and the start signal, respectively. A second time-scale mapping coefficient is constructed based on the round-trip time of the initiating base station, the response time of the initiating base station, the first time, and the second time. Based on the times when the device receives the end signal, the response signal, and the start signal, the response time of the response base station, the response time of the initiating base station, the first time scale mapping coefficient, and the second time scale mapping coefficient, the arrival time difference of the signal from the response base station relative to the signal from the initiating base station to the device is calculated.
[0010] Optionally, calculating the target position of the device in the planar coordinate system based on the distance difference between the device and different base stations and the relative positions of the different base stations in the planar coordinate system includes: The distance difference is validated to eliminate distance differences that do not meet the amplitude constraint; wherein, the amplitude constraint is that the absolute value of the distance difference is less than the distance between the corresponding two base stations. A nonlinear positioning equation set is constructed using the distance difference between at least three pairs of base stations that have passed verification. The nonlinear positioning equation set is then transformed into a linear positioning equation set. The linear positioning equation set is solved using the least squares method to obtain the first candidate location. Using the reference location as the starting location, and the sum of squared residuals between the verified distance difference and the theoretical distance difference as the objective function, the location estimate is iteratively updated until the convergence condition is met, thus obtaining the second candidate location; wherein, the theoretical distance difference is the distance difference between the current estimated location and different base stations; When the deviation between the first candidate position and the second candidate position is less than a preset threshold, the consistency verification is passed. The first or second candidate position that has passed the consistency verification is taken as the current estimated position. The nonlinear positioning equations are expanded in first order Taylor at the current estimated position to linearize the nonlinear positioning equations into a linear equations about the position correction. The least squares method is used to solve the linear equations to obtain the position correction. If the magnitude of the position correction is less than the preset correction threshold, then the current estimated position is output as the final target position; If the magnitude of the position correction is greater than or equal to the preset correction threshold, the current estimated position is updated using the position correction, and the process re-enters the step of performing a first-order Taylor expansion of the nonlinear positioning equations at the current estimated position to linearize the nonlinear positioning equations into a linear equations with respect to the position correction, until the convergence condition is met and the target position at the current moment is determined.
[0011] Optionally, after determining the target position at the current moment, the method further includes: Calculate the displacement between the current target position and the historical position at the previous time; When the displacement exceeds the preset maximum allowable displacement threshold, the current moment is marked as an abnormal jump moment, and the number of consecutive abnormal jumps is accumulated. When the number of consecutive abnormal jumps is less than a preset threshold, the target position at the current moment is corrected to the historical position at the previous moment. When the number of consecutive abnormal transitions is greater than or equal to the preset threshold, the number of consecutive abnormal transitions is reset to zero. When the displacement is less than or equal to the preset maximum allowable displacement threshold, the number of consecutive abnormal jumps is reset to zero.
[0012] Optionally, determining the positional relationship of the device relative to the active area based on the target location and the boundary of the closed polygon includes: Calculate the directional bias of the target position relative to each edge of the closed polygon; wherein the directional bias is used to describe the lateral orientation of the target position relative to the edge; If all edges are oriented in the same direction, then the target location is determined to be inside the activity area; If there are edges with inconsistent directional deviations, the target location is determined to be outside the activity area.
[0013] To achieve the above objectives, this application provides a positioning device applied to a device, the device comprising: The first determining module is used to obtain the distance between multiple base stations set at the boundary of the activity area, determine the relative position of the multiple base stations in the plane coordinate system according to the distance between the different base stations, and arrange the multiple base stations in spatial order to form a closed polygon boundary. A recording module is used to receive communication signals sent by different base stations during the interaction process and record the arrival time of the communication signals; The first calculation module is used to calculate the distance difference between the device and different base stations based on the arrival times of the communication signals between different base stations during the same round of interaction. The second calculation module is used to calculate the target position of the device in the plane coordinate system based on the distance difference between the device and the different base stations and the relative positions of the different base stations in the plane coordinate system. The second determining module is used to determine the positional relationship of the device relative to the active area based on the target location and the boundary of the closed polygon.
[0014] To achieve the above objectives, this application provides an electronic device, comprising: Memory, used to store computer programs; A processor for implementing the positioning method described above when executing the computer program.
[0015] To achieve the above objectives, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the positioning method described above.
[0016] To achieve the above objectives, this application provides an interactive system, comprising: Multiple base stations are set up at the boundary of the activity area. The base station is used to: determine its own distance from other base stations by communicating with other base stations, and send its own distance from other base stations to the device. On the device side, it is used to determine the relative positions of multiple base stations in a planar coordinate system based on the distance between different base stations, and arrange the multiple base stations in spatial order to form a closed polygon boundary; receive communication signals sent by different base stations during interaction, and record the arrival time of the communication signals; calculate the distance difference between the device side and different base stations based on the arrival times of the communication signals between different base stations in the same round of interaction; calculate the target position of the device side in the planar coordinate system based on the distance difference between the device side and different base stations and the relative positions of different base stations in the planar coordinate system; and determine the positional relationship of the device side relative to the active area based on the target position and the closed polygon boundary.
[0017] The positioning method provided in this application allows the device to directly determine the relative positions of multiple base stations in a planar coordinate system based on the distance between them, and then arrange these base stations in spatial order to form a closed polygon boundary. This achieves base station positioning and automatic construction of the activity area boundary without relying on external measuring equipment or manual calibration. In the real-time positioning phase, the device receives communication signals sent by different base stations during interaction and records their arrival times. It then calculates its own distance difference relative to different base stations based on the arrival time differences of their communication signals during the same round of interaction. This distance difference, combined with the relative positions of each base station in the planar coordinate system, allows it to calculate its target position. Finally, it determines its internal / external position relative to the target area based on the target position and the constructed closed polygon boundary. In this process, the data sources required for base station positioning, boundary construction, and real-time positioning all originate from signal interactions between base stations. The device under positioning only needs to passively receive communication signals to independently complete the entire calculation process. This eliminates the need for manual measurement of base station coordinates or manual configuration of boundary parameters, and avoids centralized position calculations by base stations or servers. This reduces system deployment complexity while providing the device with independent, real-time spatial positioning and boundary determination capabilities. This application also discloses a positioning device, an electronic device, a storage medium, and an interactive system, which can achieve the same technical effects as described above.
[0018] It should be understood that the above general description and the following detailed description are merely exemplary and do not limit this application. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. The drawings are used to provide a further understanding of this disclosure and constitute a part of the specification. They are used together with the following detailed description to explain this disclosure, but do not constitute a limitation of this disclosure. In the drawings: Figure 1 This is a flowchart illustrating a positioning method according to an exemplary embodiment; Figure 2 This is a schematic diagram illustrating a multi-target real-time positioning system according to an exemplary embodiment; Figure 3 This is a schematic diagram illustrating a single-round information interaction based on DSTWR according to an exemplary embodiment; Figure 4 This is a schematic diagram illustrating a fully connected inter-base station ranging mechanism based on initiating base station rotation, according to an exemplary embodiment. Figure 5 for Figure 1 Detailed flowchart of step S14; Figure 6 This is a structural diagram illustrating a positioning device according to an exemplary embodiment; Figure 7 This is a structural diagram of an electronic device according to an exemplary embodiment. Detailed Implementation
[0020] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.
[0021] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0022] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0023] This application discloses a positioning method that enables the automatic construction of activity area boundaries, while the device can independently determine its real-time location.
[0024] See Figure 1 A flowchart illustrating a positioning method according to an exemplary embodiment, such as... Figure 1 As shown, it includes: S11: Obtain the distance between multiple base stations set at the boundary of the activity area, determine the relative positions of the multiple base stations in the plane coordinate system based on the distance between the different base stations, and arrange the multiple base stations in spatial order to form a closed polygon boundary; The execution subject in this embodiment is the device end, also known as the tag end, which refers to the object that moves with the game participants or mobile devices and passively receives base station signals to calculate its own position. For example, a mobile robot with a built-in UWB (Ultra Wide Band) device module or a flexible remote control that combines UWB device and Bluetooth module.
[0025] The activity area refers to the physical space within which game participants or mobile devices are permitted to move, such as a courtyard, playground, or indoor game area. A base station is a fixed node deployed at the boundary of the activity area for transmitting and receiving ultra-wideband wireless signals; also known as a beacon, each base station contains a built-in UWB transceiver chip, a microcontroller unit (MCU), a light-emitting diode (LED) indicator, and a battery, and has a unique serial number. A planar coordinate system refers to a mathematical reference system that describes the spatial location of a base station using two-dimensional rectangular coordinates. A closed polygon boundary refers to a closed geometric figure defined by multiple base stations connected sequentially end-to-end, used to delineate the activity area.
[0026] In this step, the user will freely deploy no fewer than four base stations along the boundary of the activity area, such as placing them at the four corners of a courtyard or on top of a fence. The relative distance between each base station is automatically obtained using UWB bidirectional ranging, and the bidirectional ranging of the full connection is completed by each base station taking turns as the initiating base station, without the need for manual coordinate measurement.
[0027] like Figure 2As shown, the system consists of four fixed base stations, including one master base station and three slave base stations. The master base station is responsible for initiating the ranging process and coordinating the entire self-localization process, while the other three slave base stations respond sequentially according to preset time slots. Through bidirectional ranging between the base stations, the relative distance information between each base station can be obtained, and the base station coordinates can be initialized and self-calibrated. After each base station enters the self-localization working mode, it sequentially acts as the initiating base station to perform the bidirectional ranging process in the network. Each base station, acting as the initiating base station, initiates ranging interactions based on bilateral bidirectional ranging with the other base stations to achieve synchronous acquisition of distance information and timestamp data between base stations.
[0028] like Figure 3 As shown, the bidirectional ranging process includes four types of message frames: POLL (start signal), RESP (response signal), FINAL (end signal) and ACK (acknowledgment signal). The interaction process is as follows: (1) The master base station sends a POLL message to notify the other base stations to enter the ranging response process and serves as the starting trigger signal for this round of ranging process; (2) After receiving the POLL message, each slave base station sends a RESP message in sequence according to the preset fixed processing delay Δt to realize bidirectional ranging response for each base station; (3) After the master base station completes the reception of the RESP message, it sends a FINAL message after a fixed delay Δt to complete the first stage round-trip ranging closed loop; (4) After receiving the FINAL message, each responding base station sends an ACK message again after a fixed delay Δt to send back the timestamp information obtained from the local measurement to the located receiver for data calculation.
[0029] The Time-of-Flight (ToF) between the master base station and the i-th slave base station can be represented as: ,in, To initiate the base station round-trip time, To initiate the base station response time, In response to the base station i response time, The round-trip time in response to base station i.
[0030] After defining the single-round ranging model, base station role rotation is performed. For example... Figure 4As shown, Tx POLL is the start signal, Tx RESP is the response signal, Tx FINAL is the end signal, and Tx ACK is the acknowledgment signal. Initiator represents the initiating base station, Responder represents the responding base station, Phase1, Phase2, and Phase3 represent Phase 1, Phase 2, and Phase 3 respectively, and A0, A1, A2, and A3 represent the four base stations. Each base station sequentially acts as the initiating base station to execute the above single-round DSTWR (Double-Sided Two-Way Ranging) process, while the remaining base stations participate in ranging as responding base stations. Through this rotational execution, the bidirectional ranging results between all base station pairs can be obtained within a complete cycle, thus constructing a complete distance set: {d12,d13,d14,d23,d24,d34,…}.
[0031] Furthermore, the device receives bidirectional ranging data between different base stations, summarizes the obtained pairwise distance information, and constructs a distance matrix between base stations: ,in: Indicates base station With base station The distance between them; This indicates the number of base stations. After obtaining the complete distance matrix, the device recovers the relative two-dimensional coordinates of each base station based on polygon ranging constraints: Subsequently, the equipment arranges each base station sequentially according to its spatial arrangement, forming the boundary base station set. ,in Let represent the two-dimensional coordinates of the i-th base station. Based on the sorted set of base stations, connect adjacent base stations sequentially, and connect the last base station to the first base station to form a closed polygon boundary. This polygon is used to describe the physical boundary of the target region, and its mathematical expression is a set of ordered edges. ,in And satisfy the closure condition .
[0032] As can be seen, this step eliminates the need for manual calibration of base station coordinates and manual input of boundary dimensions by using self-range measurement and coordinate self-calculation between base stations, thereby realizing the automatic construction of the activity area boundary, significantly reducing the system deployment complexity and improving the automation level of boundary generation.
[0033] As a feasible implementation, determining the relative positions of multiple base stations in a planar coordinate system based on the distance between different base stations includes: taking the first base station as the origin and the direction of the second base station as the positive direction of the horizontal axis, determining the horizontal axis coordinate of the second base station based on the distance between the first base station and the second base station; determining the horizontal axis coordinate and vertical axis coordinate of the third base station in the planar coordinate system based on the distance between the third base station and the first base station, the distance between the third base station and the second base station, and the distance between the first base station and the second base station; wherein, the third base station refers to all base stations other than the first base station and the second base station.
[0034] Among them, the first base station refers to the base station selected as the reference origin of the plane coordinate system; the second base station refers to the base station located in the positive direction of the horizontal axis and used to determine the orientation of the coordinate axis; the third base station refers to all other base stations whose coordinates need to be calculated, excluding the first and second base stations.
[0035] In practical implementation, when establishing a unified local plane coordinate system, the coordinates of the first base station are fixed as follows: The second base station is located in the positive x-axis direction, and its coordinates are defined as follows: ,in: Let be the distance between the first base station and the second base station. For the ... The third base station ( Let the distances between it and the first base station and the second base station be respectively. , Based on the geometric relationship of two-dimensional trilateration, its horizontal axis coordinate can be expressed as: The vertical axis coordinate can be represented as: If the error is due to measurement error: The corresponding terms are then truncated to 0 to improve the numerical stability of the coordinate recovery process. Ultimately, the relative positional relationships of all base stations in the local two-dimensional coordinate system can be recovered using the above method, providing a base station coordinate reference for subsequent real-time device positioning.
[0036] S12: Receive communication signals sent by different base stations during the interaction process, and record the arrival time of the communication signals; S13: Calculate the distance difference between the device and the different base stations based on the arrival times of the communication signals between the different base stations during the same round of interaction; In this context, communication signals refer to the radio frequency signals emitted by base stations during mutual ranging and interaction. These signals carry time stamps for transmission and reception and can include start signals, response signals, end signals, and acknowledgment signals. Distance difference refers to the difference in straight-line distance between a device and two different base stations, equal to the time difference of arrival of signals from the different base stations multiplied by the signal propagation speed.
[0037] In this step, after entering the real-time positioning mode, the base stations continuously communicate bidirectionally. The device passively listens to the bidirectional communication process between the base stations, obtains the timestamp information of the interaction process between each base station, and calculates the differential arrival time based on the difference between the arrival times of different signals, thereby calculating the distance difference between different base stations and the device.
[0038] As a feasible implementation, receiving communication signals sent by different base stations during the interaction process and recording the arrival time of the communication signals includes: receiving a start signal sent by the initiating base station, a response signal replied by the responding base station, an end signal sent by the initiating base station, and an acknowledgment signal replied by the responding base station, and recording the arrival times of the start signal, the response signal, the end signal, and the acknowledgment signal; correspondingly, calculating the distance difference between the device and different base stations based on the arrival times of the communication signals between different base stations in the same round of interaction includes: determining the arrival time difference of the signal from the responding base station relative to the signal from the initiating base station to the device based on the arrival times of the start signal, the response signal, the end signal, and the acknowledgment signal; and calculating the distance difference between the device and different base stations based on the arrival time difference and the signal propagation speed.
[0039] Among them, the initiating base station refers to the base station that first sends a signal in a round of ranging interaction to trigger the current round of process, also known as the master base station or initiating base station; the responding base station refers to the base station that responds in sequence after receiving the signal from the initiating base station and participates in the current round of ranging, also known as the slave base station or responding base station.
[0040] In practice, the initiating base station first sends a start signal (POLL frame) to notify each responding base station to enter the ranging response process. Upon receiving the start signal, each responding base station sequentially replies with a response signal (RESP frame) after a preset fixed processing delay. After receiving the response signal, the initiating base station sends an end signal (FINAL frame) after a fixed delay to close the first stage of round-trip ranging. Upon receiving the end signal, each responding base station replies with an acknowledgment signal (ACK frame) after a fixed delay, transmitting its locally measured timestamp back. The device passively receives signals throughout the process, recording the arrival times of these four types of signals and determining the time difference between the responding base station's signal and the initiating base station's signal. Multiply by the speed of light to get the distance difference between the device and the two base stations. , that is ,in, It represents the speed of light.
[0041] As a possible implementation, determining the arrival time difference between the signal from the responding base station and the signal from the initiating base station at the device end based on the arrival times of the start signal, the response signal, the end signal, and the acknowledgment signal includes: determining the round-trip time and response time of the initiating base station in the end signal; wherein the round-trip time of the initiating base station is the time interval between the time when the response signal arrives at the initiating base station and the time when the initiating base station sends the start signal, and the response time of the initiating base station is the time interval between the time when the initiating base station sends the end signal and the time when the response signal arrives at the initiating base station; determining the first time when the start signal arrives at the responding base station and the response time of the responding base station in the response signal, and determining the first time when the end signal arrives at the responding base station in the acknowledgment signal. The second moment; wherein, the response time of the response base station is the time interval between the moment when the response base station sends the response signal and the moment when the start signal arrives at the response base station; a first time scale mapping coefficient is constructed based on the round-trip time of the initiating base station, the response time of the initiating base station, and the moment when the device receives the end signal and the start signal respectively; a second time scale mapping coefficient is constructed based on the round-trip time of the initiating base station, the response time of the initiating base station, the first moment, and the second moment; the arrival time difference of the signal from the response base station relative to the signal from the initiating base station arriving at the device is calculated based on the moment when the device receives the end signal, the response signal, the start signal, the response time of the response base station, the response time of the initiating base station, the first time scale mapping coefficient, and the second time scale mapping coefficient.
[0042] Among them, the round-trip time of the initiating base station The response time refers to the time interval between the arrival of the response signal at the initiating base station and the time when the initiating base station sends the start signal; the initiating base station response time. This refers to the time interval between the moment the initiating base station sends the termination signal and the moment the response signal arrives at the initiating base station; the first moment. This refers to the moment when the initial signal arrives at the responding base station; the second moment. This refers to the moment when the termination signal arrives at the responding base station; the response time of the responding base station. The time interval between the time when the responding base station sends out the response signal and the time when the starting signal arrives at the responding base station is called the time scale mapping coefficient. The time scale mapping coefficient is a scaling factor introduced to eliminate the inconsistency between the local clock reference of each base station and the equipment. It is used to map the time interval on the local time axis of a certain base station to the time reference of the initiating base station.
[0043] In practical implementation, to eliminate the local clock differences among base stations, a time-scale mapping coefficient is introduced without relying on global time synchronization. The first time-scale mapping coefficient, also known as the tag-to-master base station time-scale mapping coefficient, can be expressed as: The second time-scale mapping coefficient, which is the time-scale mapping coefficient from the base station to the main base station, can be expressed as: Using the above coefficients, the local time interval between the device and the responding base station is mapped to the time reference of the initiating base station. Therefore, the arrival time difference TDoA of the i-th responding base station relative to the initiating base station can be expressed as: ,in, The moment when the device receives the response signal. The moment when the device receives the end signal. This is the moment when the device receives the start signal.
[0044] S14: Calculate the target position of the device in the plane coordinate system based on the distance difference between the device and the base stations and the relative positions of the base stations in the plane coordinate system; The target position refers to the two-dimensional coordinates of the device in the planar coordinate system at the current moment, which is the final output of the positioning calculation.
[0045] In this step, the device has obtained distance difference observations relative to multiple base stations, as well as the coordinates of each base station in a planar coordinate system. The device constructs a set of positioning equations using the distance difference observations from at least three base stations. Solving this set of equations yields the target position of the device in the planar coordinate system. Specifically, each base station pair provides one distance difference observation, corresponding to a hyperbola with the two base stations as foci. The intersection of multiple hyperbolas corresponding to multiple distance difference observations represents the device's position estimate. The device can solve this set of positioning equations using analytical methods (e.g., the Chan algorithm) or iterative methods (e.g., weighted least squares).
[0046] S15: Determine the positional relationship of the device relative to the active area based on the target location and the boundary of the closed polygon.
[0047] Among them, positional relationship refers to the geometrical affiliation of the target location of the device relative to the closed polygon boundary formed by the base station, whether it is located inside or outside the activity area, and whether it is near the boundary.
[0048] In this step, after obtaining the planar coordinates of the target location on the device, a geometric comparison is made with each edge of the closed polygon boundary to determine whether the relative active area of the device is located inside, outside, or exactly on the boundary. This result can be used for boundary crossing alarms, game logic triggering, or interactive control.
[0049] As can be seen, this step maps the positioning results to the geometric boundary of the activity area, realizing the automatic determination of the state inside and outside the boundary. This enables the system to complete boundary detection and interactive control based on position awareness, improving the game experience and security.
[0050] As a possible implementation, determining the positional relationship of the device relative to the active area based on the target position and the boundary of the closed polygon includes: calculating the directional bias of the target position relative to each side of the closed polygon; wherein the directional bias is used to describe the lateral orientation of the target position relative to the side; if the directional biases of all sides are consistent, it is determined that the target position is located inside the active area; if there are sides with inconsistent directional biases, it is determined that the target position is located outside the active area.
[0051] Among them, directional bias refers to the geometric description of the lateral orientation of the target position relative to a certain side of the closed polygon. It can be characterized by the sign of the two-dimensional cross product formed by the target position and the two endpoints of the side: when the cross product is positive, it means that the target position is located on a fixed side of the side, and when the cross product is negative, it means that it is located on the other side; the side refers to the line segment between two adjacent base stations connected in sequence in the closed polygon.
[0052] In practical implementation, for each edge of the closed polygon Calculate the relationship between the edge vector and the target position. The cross product of the vectors pointing to the origin of an edge gives the direction of that edge. , Let P be the coordinates. for coordinates for The coordinates. If the direction of all edges has the same sign (all positive or all negative), it means that the target position is always on the same side of all edges, that is, inside the polygon; if the direction of any edge is different from the other edges, it means that the target position is on the other side of a certain edge, that is, outside the polygon.
[0053] The positioning method provided in this application allows the device to directly determine the relative positions of multiple base stations in a planar coordinate system based on the distance between them, and arrange the base stations in spatial order to form a closed polygon boundary. This achieves automatic construction of base station positioning and activity area boundaries without relying on external measuring equipment or manual calibration. In the real-time positioning phase, the device receives communication signals sent by different base stations during interaction and records their arrival times. It then calculates its own distance difference relative to different base stations based on the arrival time difference of their communication signals during the same round of interaction. Furthermore, it calculates its target position by combining the relative positions of each base station in the planar coordinate system, and determines its internal / external position relative to the target area based on the target position and the constructed closed polygon boundary. In the above process, the data sources required for base station positioning, boundary construction, and real-time positioning all originate from signal interactions between base stations. The device under positioning only needs to passively receive communication signals to independently complete the entire calculation process. This eliminates the need for manual measurement of base station coordinates or manual configuration of boundary parameters, and avoids centralized position calculations by base stations or servers. This reduces system deployment complexity while enabling the device under positioning to possess independent, real-time spatial positioning and boundary determination capabilities.
[0054] This embodiment further explains and optimizes step S14 described above. For details, please refer to... Figure 5 ,include: S141: Perform a validity check on the distance difference to eliminate distance differences that do not meet the amplitude constraint; wherein, the amplitude constraint is that the absolute value of the distance difference is less than the distance between the corresponding two base stations; Validity verification refers to the process of screening the previously obtained distance difference observations for reasonableness, in order to identify and remove obviously abnormal data. Distance difference refers to the differential distance observations from the device to two base stations. Amplitude constraint refers to the upper limit imposed on the absolute value of the distance difference, and its mathematical form is... ,in Indicates base station The distance between base station 0 and base station 0. The distance between two base stations refers to the straight-line distance in the plane coordinate system between the pair of base stations involved in the distance difference calculation.
[0055] In this step, for each group (base station pair, distance difference) observation, the absolute value of its distance difference is compared with the distance between the two base stations. If the absolute value is not less than the distance between the base stations, the distance difference violates the physical feasibility condition, because the difference in distance from the device to the two base stations cannot exceed the distance between the two base stations themselves. It is determined to be invalid and discarded. The remaining distance differences that pass the verification are retained for subsequent positioning calculations.
[0056] As can be seen, this step filters out physically infeasible abnormal distance differences before the positioning solution by using amplitude constraints, which reduces the possibility of subsequent equation solutions being affected by outliers, thereby improving the stability and reliability of the positioning results.
[0057] S142: Construct a nonlinear positioning equation set using the distance difference between at least three pairs of base stations that have passed verification, transform the nonlinear positioning equation set into a linear positioning equation set, and solve the linear positioning equation set using the least squares method to obtain the first candidate location. Among them, the nonlinear positioning equation system refers to a set of equations consisting of multiple sets of distance differences and base station coordinates, with the device coordinates as unknowns, and exhibiting a hyperbolic (with square root) relationship; the linear positioning equation system refers to a set of linear equations about unknown coordinates obtained by algebraically expanding and subtracting the nonlinear terms and eliminating the quadratic terms; the least squares method is a parameter estimation method that minimizes the sum of squared residuals when the number of observation equations exceeds the number of unknowns; the first candidate position refers to the initial value of the device position obtained through linearized analytical solution.
[0058] In this step, at least three pairs of base station distance differences that have passed amplitude constraint verification are taken. Each pair of distance differences and the coordinates of the corresponding two base stations are substituted into the hyperbolic positioning model to establish a nonlinear positioning equation system. Then, adjacent equations are subtracted, and the quadratic term of the device coordinates is eliminated using the difference of squares formula, transforming the original nonlinear equation system into a linear equation system about the coordinates. The least squares method is used to solve this linear equation system to obtain the first candidate location of the device. .
[0059] S143: Using the reference position as the starting position, and the sum of squared residuals between the verified distance difference and the theoretical distance difference as the objective function, the position estimate is iteratively updated until the convergence condition is met, thus obtaining the second candidate position; wherein, the theoretical distance difference is the distance difference between the current estimated position and different base stations; Here, the reference position refers to the initial guess point used at the start of the iterative search, which can be the historical position at the previous moment, the first candidate position, or the center of the site; the residual sum of squares refers to the sum of the squares of the differences between all the distance differences that pass the verification and the theoretical distance difference calculated based on the current estimated position, which serves as the objective function to measure the quality of the estimation; the theoretical distance difference refers to the differential distance from the device to each base station calculated geometrically based on the coordinates of the current estimated position and the coordinates of each base station; the convergence condition refers to the change in the position estimation or the decrease in the objective function during the iteration process being less than the preset tolerance, or reaching the maximum number of iterations; the second candidate position refers to another position estimate of the device obtained through iterative optimization.
[0060] In this step, starting from the reference position, the theoretical distance difference corresponding to that position is calculated, and the difference between this theoretical distance difference and the measured distance difference is used to obtain a single set of residuals. The sum of the squares of all residuals constitutes the objective function. An iterative algorithm of the Gauss-Newton type or gradient type is used to update the position estimate along the direction that makes the objective function decrease. In each iteration, the theoretical distance difference and the sum of squares of the residuals are recalculated until the position change meets the convergence condition, and the second candidate position is output. .
[0061] S144: When the deviation between the first candidate position and the second candidate position is less than a preset threshold, the consistency verification is passed; Here, deviation refers to the spatial distance (such as Euclidean distance) between the coordinate estimates of the first candidate position and the second candidate position; preset threshold refers to the maximum allowable deviation set in advance to determine whether the two solutions are close enough; consistency verification refers to the process of confirming the credibility of the current positioning result by comparing whether the position solutions obtained by different methods match each other.
[0062] In this step, after obtaining the first and second candidate positions using the linearized analytical method and the iterative method respectively, the Euclidean deviation between the two is calculated. If this deviation is less than a preset threshold... , that is If the two independent methods provide mutually corroborating positions, the current geometric configuration and the observed data are in the reliable convergence region, and the consistency verification is passed. Conversely, if the deviation is too large, it indicates that there may be non-line-of-sight errors or abnormal differences, and the verification is not passed. The solution in this round is discarded or a retest is triggered to avoid divergent solutions caused by non-line-of-sight errors or abnormal differences.
[0063] S145: Take the first or second candidate position that has passed the consistency verification as the current estimated position, perform a first-order Taylor expansion of the nonlinear positioning equations at the current estimated position to linearize the nonlinear positioning equations into a linear equations about the position correction, and solve the linear equations using the least squares method to obtain the position correction. Here, the current estimated position refers to the initial value selected from the first or second candidate positions that have passed the consistency verification as the initial value for fine iterative optimization; the first-order Taylor expansion refers to the first-order approximate expansion of the nonlinear positioning function near the current estimated position; and the position correction amount refers to the small coordinate increment that needs to be applied to the current estimated position in order to make the estimated position closer to the true solution.
[0064] In this step, a candidate position that has passed the consistency verification is selected as the current estimated position, and a residual function is constructed: ,in: These are differential distance observations. This represents the coordinates of the i-th base station. For target position estimation, the nonlinear positioning equations corresponding to each set of distance differences are expanded at that position using the first-order Taylor formula, ignoring second-order and higher-order terms, thus transforming the original nonlinear equations into a linear equations system concerning the position correction. This linear equations system is then solved using the least squares method to obtain the position correction that minimizes the residual.
[0065] S146: If the magnitude of the position correction is less than the preset correction threshold, then the current estimated position is output as the final target position; Among them, the magnitude of the position correction refers to the length of the coordinate increment vector of the position correction (such as the Euclidean norm); the preset correction threshold refers to the maximum allowable correction amount set in advance to determine whether the iteration has fully converged; the final target position refers to the device coordinates that can be output as the positioning result at this moment after fine iterative optimization.
[0066] In this step, after obtaining the position correction amount, its magnitude is calculated. If the magnitude is less than the preset correction threshold, it means that the current estimated position is close enough to the true solution and the improvement brought by continuing the iteration is negligible. Therefore, the current estimated position is confirmed as the final target position and output to the outside world.
[0067] S147: If the magnitude of the position correction is greater than or equal to the preset correction threshold, the current estimated position is updated using the position correction, and the process re-enters the step of performing a first-order Taylor expansion of the nonlinear positioning equations at the current estimated position to linearize the nonlinear positioning equations into a linear equations with respect to the position correction, until the convergence condition is met and the target position at the current moment is determined.
[0068] The convergence condition refers to the correction magnitude being less than the preset correction threshold or reaching the maximum number of iterations. If this condition is met, the iteration is considered to be stable. The target position at the current moment refers to the final planar coordinates of the device at this sampling moment, determined by the real-time positioning in this round.
[0069] In this step, when the magnitude of the position correction is not less than the preset correction threshold, it indicates that the current estimated position has not yet converged sufficiently. Therefore, the current estimated position is superimposed with the position correction to obtain the updated estimated position. The process of first-order Taylor expansion, linearization, and least squares solution of the correction is then performed with the new estimated position as the center. This process is repeated iteratively. After each iteration, the magnitude of the correction is re-evaluated until it is less than the preset correction threshold (meeting the convergence condition) or the maximum number of iterations is reached. The estimated position obtained at this time is the target position at the current moment.
[0070] Based on the above embodiments, as a preferred implementation, after determining the target position at the current moment, the method further includes: calculating the displacement between the target position at the current moment and the historical position at the previous moment; when the displacement is greater than a preset maximum allowable displacement threshold, marking the current moment as an abnormal jump moment and accumulating the number of consecutive abnormal jumps; when the number of consecutive abnormal jumps is less than a preset number threshold, correcting the target position at the current moment to the historical position at the previous moment; when the number of consecutive abnormal jumps is greater than or equal to the preset number threshold, resetting the number of consecutive abnormal jumps to zero; when the displacement is less than or equal to the preset maximum allowable displacement threshold, resetting the number of consecutive abnormal jumps to zero.
[0071] Among them, historical position refers to the target position that the device has determined and output at the previous sampling time; displacement refers to the spatial distance (Euclidean distance) between the target position at the current time and the historical position at the previous time; maximum allowable displacement threshold refers to the maximum value allowed for position change in a single frame, set according to the upper limit of the normal movement speed of the device; abnormal jump moment refers to the moment when the displacement exceeds the maximum allowable displacement threshold and is suspected to be caused by multipath, non-line-of-sight (NLOS) or solution divergence; the number of consecutive abnormal jumps refers to the cumulative number of frames in which the above abnormal jump moments occur consecutively; the preset number threshold refers to the number of times used to distinguish between occasional interference and real large-scale movement.
[0072] In practice, after obtaining the target position at the current moment, the displacement relative to its historical position is calculated. , that is ,in, The target position at the current moment. This is the historical location. If the displacement exceeds the maximum allowable displacement threshold... , that is If the time interval is not specified, the time interval is marked as an abnormal transition and the number of consecutive abnormal transitions is incremented by one. Then, it is determined that: if the number of consecutive transitions is still less than the preset threshold, it is determined to be a short-term interference, and the current target position is corrected to the historical position of the previous time interval to maintain the continuity of the trajectory; if the number of consecutive transitions reaches or exceeds the preset threshold, it is determined that the device has actually moved significantly, the current estimated position is used as the target position at the current time interval, and the number of consecutive abnormal transitions is reset to zero to start counting again; if the displacement does not exceed the maximum allowable displacement threshold, it is considered normal movement, the current estimated position is used as the target position at the current time interval, and the number of consecutive abnormal transitions is reset to zero.
[0073] As can be seen, this implementation method effectively suppresses instantaneous position jumps caused by multipath, non-line-of-sight, and solution divergence by using both displacement threshold and number of consecutive judgments. It maintains the smoothness and continuity of the trajectory while preserving the actual large-scale movement, thus improving the stability of the positioning results in boundary and occlusion environments.
[0074] This embodiment pre-emptively eliminates abnormal distance difference observations by using amplitude constraints to prevent abnormal data from participating in subsequent calculations. Then, it solves the problem using analytical and iterative methods respectively and compares the two solutions using consistency verification. When the deviation exceeds the limit, the current update is discarded, thus effectively avoiding divergent solutions caused by non-line-of-sight errors or abnormal observations. Subsequently, it refines the candidate positions that have passed the consistency verification using nonlinear least squares iteration based on Taylor expansion, so that the positioning results gradually approach the true positions.
[0075] The following describes a positioning device provided in an embodiment of this application. The positioning device described below and the positioning method described above can be referred to each other.
[0076] See Figure 6 A structural diagram of a positioning device according to an exemplary embodiment is shown, such as... Figure 6 As shown, it includes: The first determining module 100 is used to obtain the distance between multiple base stations set at the boundary of the activity area, determine the relative position of the multiple base stations in the plane coordinate system according to the distance between the different base stations, and arrange the multiple base stations in spatial order to form a closed polygon boundary. The recording module 200 is used to receive communication signals sent by different base stations during the interaction process and record the arrival time of the communication signals; The first calculation module 300 is used to calculate the distance difference between the device and different base stations based on the arrival times of the communication signals between different base stations during the same round of interaction. The second calculation module 400 is used to calculate the target position of the device in the plane coordinate system based on the distance difference between the device and different base stations and the relative positions of the different base stations in the plane coordinate system. The second determining module 500 is used to determine the positional relationship of the device end relative to the active area based on the target position and the boundary of the closed polygon.
[0077] The positioning device provided in this application directly determines the relative positions of multiple base stations in a planar coordinate system based on the distance between different base stations, and arranges the multiple base stations in spatial order to form a closed polygon boundary. This achieves automatic construction of base station positioning and activity area boundaries without relying on external measuring equipment or manual calibration. In the real-time positioning phase, the device receives communication signals sent by different base stations during interaction and records their arrival times. It then calculates its own distance difference relative to different base stations based on the arrival time difference of the communication signals during the same round of interaction. Furthermore, it calculates its own target position by combining the relative positions of each base station in the planar coordinate system, and determines its internal and external positional relationship relative to the target area based on the target position and the constructed closed polygon boundary. In the above process, the data sources required for base station positioning, boundary construction, and real-time positioning all originate from the signal interaction between base stations. The device to be positioned only needs to passively receive communication signals to independently complete the entire calculation process. It eliminates the need for manual measurement of base station coordinates or manual configuration of boundary parameters, and avoids relying on base station terminals or servers for centralized position calculation. This reduces system deployment complexity while enabling the device to be positioned to have independent, real-time spatial positioning and boundary determination capabilities.
[0078] Based on the above embodiments, as a preferred implementation, the first determining module 100 is specifically used to: take the first base station as the origin of the coordinate system and the direction where the second base station is located as the positive direction of the horizontal axis, determine the horizontal axis coordinate of the second base station according to the distance between the first base station and the second base station; determine the horizontal axis coordinate and vertical axis coordinate of the third base station in the plane coordinate system according to the distance between the third base station and the first base station, the distance between the third base station and the second base station, and the distance between the first base station and the second base station; wherein, the third base station is any base station other than the first base station and the second base station.
[0079] Based on the above embodiments, as a preferred implementation, the recording module 200 is specifically used to: receive a start signal sent by the initiating base station, a response signal replied by the responding base station, an end signal sent by the initiating base station, and an acknowledgment signal replied by the responding base station, and record the arrival times of the start signal, the response signal, the end signal, and the acknowledgment signal; Accordingly, the first calculation module 300 is specifically used to: determine the arrival time difference between the signal from the responding base station and the signal from the initiating base station at the device end based on the arrival times of the start signal, the response signal, the end signal and the confirmation signal; and calculate the distance difference between the device end and different base stations based on the arrival time difference and the signal propagation speed.
[0080] Based on the above embodiments, as a preferred implementation, the first calculation module 300 is specifically configured to: determine the round-trip time and response time of the initiating base station in the termination signal; wherein, the round-trip time of the initiating base station is the time interval between the time when the response signal arrives at the initiating base station and the time when the initiating base station sends the start signal, and the response time of the initiating base station is the time interval between the time when the initiating base station sends the termination signal and the time when the response signal arrives at the initiating base station; determine the first moment when the start signal arrives at the response base station and the response time of the response base station in the response signal, and determine the second moment when the termination signal arrives at the response base station in the confirmation signal; wherein, the response time of the response base station is the time interval between the time when the response base station sends the termination signal and the time when the response signal arrives at the initiating base station; The time interval between the time of the response signal and the time of the arrival of the starting signal at the response base station is calculated. A first time scale mapping coefficient is constructed based on the round-trip time of the initiating base station, the response time of the initiating base station, and the times when the device receives the ending signal and the starting signal, respectively. A second time scale mapping coefficient is constructed based on the round-trip time of the initiating base station, the response time of the initiating base station, the first time, and the second time. The arrival time difference of the signal from the response base station relative to the signal from the initiating base station at the device is calculated based on the times when the device receives the ending signal, the response signal, the starting signal, the response time of the response base station, the response time of the initiating base station, the first time scale mapping coefficient, and the second time scale mapping coefficient.
[0081] Based on the above embodiments, as a preferred implementation, the second calculation module 400 is specifically used for: validating the distance difference to eliminate distance differences that do not meet the amplitude constraint; wherein, the amplitude constraint is that the absolute value of the distance difference is less than the distance between the corresponding two base stations; constructing a nonlinear positioning equation system based on the valid distance differences of at least three pairs of base stations, transforming the nonlinear positioning equation system into a linear positioning equation system, solving the linear positioning equation system using the least squares method to obtain a first candidate position; using the reference position as the starting position, and using the sum of squared residuals between the valid distance difference and the theoretical distance difference as the objective function, iteratively updating the position estimate until the convergence condition is met to obtain a second candidate position; wherein, the theoretical distance difference is the distance difference between the current estimated position and different base stations; when the deviation between the first candidate position and the second candidate position is small At a preset threshold, consistency verification is performed. The first or second candidate position that passes the consistency verification is taken as the current estimated position. The nonlinear positioning equations are expanded using a first-order Taylor series at the current estimated position to linearize the nonlinear positioning equations into a linear equations with respect to the position correction. The linear equations are solved using the least squares method to obtain the position correction. If the magnitude of the position correction is less than the preset correction threshold, the current estimated position is output as the final target position. If the magnitude of the position correction is greater than or equal to the preset correction threshold, the current estimated position is updated using the position correction, and the process of expanding the nonlinear positioning equations using a first-order Taylor series at the current estimated position to linearize the nonlinear positioning equations into a linear equations with respect to the position correction is repeated until the convergence condition is met, thus determining the target position at the current moment.
[0082] Based on the above embodiments, as a preferred embodiment, it further includes: The correction module is used to calculate the displacement between the target position at the current moment and the historical position at the previous moment; when the displacement is greater than a preset maximum allowable displacement threshold, the current moment is marked as an abnormal jump moment, and the number of consecutive abnormal jumps is accumulated; when the number of consecutive abnormal jumps is less than a preset number threshold, the target position at the current moment is corrected to the historical position at the previous moment; when the number of consecutive abnormal jumps is greater than or equal to the preset number threshold, the number of consecutive abnormal jumps is reset to zero; when the displacement is less than or equal to the preset maximum allowable displacement threshold, the number of consecutive abnormal jumps is reset to zero.
[0083] Based on the above embodiments, as a preferred implementation, the second determining module 500 is specifically used to: calculate the directional deviation of the target position relative to each side of the closed polygon; wherein the directional deviation is used to describe the lateral orientation of the target position relative to the side; if the directional deviations of all sides are consistent, it is determined that the target position is located inside the active area; if there are sides with inconsistent directional deviations, it is determined that the target position is located outside the active area.
[0084] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0085] Based on the hardware implementation of the above program modules, and in order to implement the method of the embodiments of this application, the embodiments of this application also provide an electronic device. Figure 7 This is a structural diagram of an electronic device according to an exemplary embodiment, such as... Figure 7 As shown, the electronic device includes: Communication interface 1 enables information exchange with other devices, such as network devices; Processor 2 is connected to communication interface 1 to enable information interaction with other devices and to execute the positioning method provided by one or more of the above-mentioned technical solutions when running a computer program. The computer program is stored in memory 3.
[0086] Of course, in practical applications, the various components in an electronic device are coupled together through bus system 4. It can be understood that bus system 4 is used to achieve communication and connection between these components. In addition to the data bus, bus system 4 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 7 The general will label all buses as Bus System 4.
[0087] The memory 3 in this embodiment is used to store various types of data to support the operation of the electronic device. Examples of such data include any computer program used to operate on the electronic device.
[0088] It is understood that memory 3 can be volatile memory or non-volatile memory, or both. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), ferromagnetic random access memory (FRAM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD-ROM); magnetic surface memory can be disk storage or magnetic tape storage. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Synchronous Static Random Access Memory (SSRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), SyncLink Dynamic Random Access Memory (SLDRAM), and Direct Rambus Random Access Memory (DRRAM).The memory 3 described in the embodiments of this application is intended to include, but is not limited to, these and any other suitable types of memory.
[0089] The methods disclosed in the embodiments of this application can be applied to processor 2, or implemented by processor 2. Processor 2 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 2 or by instructions in the form of software. The processor 2 may be a general-purpose processor, DSP, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Processor 2 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. The software modules may be located in a storage medium, which is located in memory 3. Processor 2 reads the program in memory 3 and completes the steps of the aforementioned method in combination with its hardware.
[0090] When processor 2 executes the program, it implements the corresponding processes in the various methods of the embodiments of this application. For the sake of brevity, these will not be described in detail here.
[0091] In an exemplary embodiment, this application also provides a storage medium, namely a computer storage medium, specifically a computer-readable storage medium, such as a memory 3 that stores a computer program, which can be executed by a processor 2 to complete the steps described in the aforementioned method. The computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface memory, optical disc, or CD-ROM.
[0092] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, ROM, RAM, magnetic disks, or optical disks.
[0093] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, server, network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, RAM, magnetic disks, or optical disks.
[0094] This application embodiment also provides an interactive system, including multiple base stations disposed at the boundary of an activity area and a device terminal; The base station is used to: determine its own distance from other base stations by communicating with other base stations, and send its own distance from other base stations to the device. Multiple base stations are positioned at the boundaries of the activity area, such as at the four corners of a courtyard or on top of a fence. Each base station has a built-in UWB transceiver chip and a microcontroller unit, and is uniquely numbered. It is used to determine the distance to other base stations through communication. Specifically, base stations automatically obtain the relative distance between each other using UWB bidirectional ranging. Base stations take turns acting as the initiating base station, performing ranging interactions based on bilateral bidirectional ranging to complete bidirectional ranging with full connectivity between base stations, obtaining the relative distance between each pair of base stations, and then sending their own distance to other base stations to the device.
[0095] The device is configured to: determine the relative positions of multiple base stations in a planar coordinate system based on the distance between different base stations; arrange the multiple base stations in spatial order to form a closed polygon boundary; receive communication signals sent by different base stations during interaction and record the arrival time of the communication signals; calculate the distance difference between the device and different base stations based on the arrival times of the communication signals between different base stations in the same round of interaction; calculate the target position of the device in the planar coordinate system based on the distance difference between the device and different base stations and the relative positions of different base stations in the planar coordinate system; and determine the positional relationship of the device relative to the activity area based on the target position and the closed polygon boundary.
[0096] The device is a mobile device that moves with the game participants, such as a mobile robot with a built-in UWB module or a flexible remote control that combines UWB and Bluetooth modules. After acquiring the distances between base stations transmitted by each base station, the device determines the relative positions of multiple base stations in a planar coordinate system based on these distances. Specifically, using the first base station as the origin and the direction of the second base station as the positive horizontal axis, the horizontal coordinate of the second base station is determined based on the distance between the first and second base stations. The horizontal and vertical coordinates of the third base station in the planar coordinate system are determined based on the distances between the third base station and the first base station, the third base station and the second base station, and the first and second base stations. The third base station refers to all base stations other than the first and second base stations. This method restores the relative positional relationships of all base stations in a local two-dimensional coordinate system, providing a base station coordinate reference for subsequent real-time positioning by the device. After determining the coordinates of each base station, the device arranges the multiple base stations sequentially according to their spatial arrangement, connects adjacent base stations in sequence, and connects the last base station to the first base station, forming a closed polygon boundary. This closed polygon boundary defines the physical boundary of the activity area.
[0097] After entering real-time positioning mode, base stations continuously engage in bidirectional communication, continuing the interaction process based on bilateral bidirectional ranging at given time intervals. The device passively receives signals throughout the interaction, including the initiating base station's start signal, the responding base station's response signal, the initiating base station's end signal, and the responding base station's acknowledgment signal, recording the arrival time of each type of communication signal. Based on the arrival times of the communication signals from different base stations in the same round of interaction, the device determines the arrival time difference between the signal from the responding base station and the signal from the initiating base station, and calculates the distance difference between the device and different base stations based on this arrival time difference and the signal propagation speed. In calculating the arrival time difference, the device obtains the round-trip time and response time of the initiating base station from the end signal, the first arrival time of the start signal and the response time of the responding base station from the response signal, and the second arrival time of the end signal from the acknowledgment signal. Based on these, a time-scale mapping coefficient is constructed to eliminate the influence of inconsistencies between the local clock references of each base station and the device, thereby calculating the arrival time difference.
[0098] After obtaining the distance differences between itself and different base stations, the device calculates its target position in the planar coordinate system by combining the relative positions of each base station. Specifically, the device first verifies the validity of the distance differences, eliminating those that do not meet the amplitude constraint, where the absolute value of the distance difference is less than the distance between the corresponding two base stations. A nonlinear positioning equation system is constructed using the verified distance differences of at least three pairs of base stations. The first and second candidate positions are obtained by solving the equations analytically and iteratively, respectively. When the deviation between the two is less than a preset threshold, the consistency verification is passed. The candidate positions that pass the consistency verification are used as the current estimated position. A first-order Taylor expansion is performed on the nonlinear positioning equation system, and the position correction is iteratively solved until the magnitude of the correction satisfies the convergence condition, thus determining the target position at the current moment.
[0099] After calculating the target position, the device determines its position relative to the active region based on the target position and the boundary of the closed polygon. Specifically, the device calculates the directional bias of the target position relative to each edge of the closed polygon. The directional bias is represented by the two-dimensional cross product of the target position and the two endpoints of the edge. If all edges have the same directional bias, the target position is determined to be inside the active region; if there are edges with inconsistent directional biases, the target position is determined to be outside the active region.
[0100] The device executes interactive control operations based on the determined positional relationships. When the target location is determined to be within the activity area, it indicates that the game participant is within a safe activity range, and the device executes game logic trigger operations. When the target location is determined to be outside the activity area, it indicates that the game participant has left the preset safe activity range, and the device executes boundary crossing alarm operations. Since the device can independently complete all calculations and interactive control by passively receiving communication signals between base stations throughout the entire process, without relying on base stations or servers for centralized calculations, a complete closed loop of positioning, boundary determination, and interactive control is achieved.
[0101] Based on the above embodiments, as a preferred implementation, after determining the target position at the current moment, the device also calculates the displacement between the target position at the current moment and the historical position at the previous moment. When the displacement is greater than a preset maximum allowable displacement threshold, the current moment is marked as an abnormal jump moment, and the number of consecutive abnormal jumps is accumulated; when the number of consecutive abnormal jumps is less than a preset number threshold, the target position at the current moment is corrected to the historical position at the previous moment, so as to suppress the impact of instantaneous position jumps caused by multipath, non-line-of-sight, or solution divergence on interactive control and maintain the continuity and stability of interactive logic.
[0102] It should be noted that the specific process of the two-way ranging interaction between base stations, the detailed steps of the device side to calculate the time difference of arrival and the distance difference, the iterative calculation process of the device side to calculate the target position, and the method of calculating the direction bias of the device side to determine the position relationship have all been described in detail in the above-mentioned device positioning method embodiments, and will not be repeated in this embodiment.
[0103] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A positioning method, characterized in that, Applied to the device side, the method includes: Obtain the distance between multiple base stations set at the boundary of the activity area, determine the relative positions of the multiple base stations in the plane coordinate system based on the distance between the different base stations, and arrange the multiple base stations in spatial order to form a closed polygon boundary; Receive communication signals sent by different base stations during the interaction process, and record the arrival time of the communication signals; The distance difference between the device and the different base stations is calculated based on the arrival times of the communication signals from the different base stations during the same round of interaction. Based on the distance difference between the device and the different base stations and the relative positions of the different base stations in the plane coordinate system, calculate the target position of the device in the plane coordinate system; The positional relationship of the device relative to the active area is determined based on the target location and the boundary of the closed polygon.
2. The positioning method according to claim 1, characterized in that, Determining the relative positions of multiple base stations in a planar coordinate system based on the distance between different base stations includes: Using the first base station as the origin of the coordinate system and the direction of the second base station as the positive direction of the horizontal axis, the horizontal axis coordinate of the second base station is determined based on the distance between the first base station and the second base station. Based on the distance between the third base station and the first base station, the distance between the third base station and the second base station, and the distance between the first base station and the second base station, the horizontal and vertical coordinates of the third base station in the plane coordinate system are determined; wherein, the third base station refers to all base stations other than the first and second base stations.
3. The positioning method according to claim 1, characterized in that, The step of receiving communication signals sent by different base stations during the interaction process and recording the arrival time of the communication signals includes: Receive a start signal sent by the initiating base station, a response signal replied by the responding base station, an end signal sent by the initiating base station, and an acknowledgment signal replied by the responding base station, and record the arrival times of the start signal, the response signal, the end signal, and the acknowledgment signal; Accordingly, calculating the distance difference between the device and different base stations based on the arrival times of communication signals from different base stations during the same round of interaction includes: Based on the arrival times of the start signal, the response signal, the end signal, and the confirmation signal, the arrival time difference between the signal from the response base station and the signal from the initiating base station at the device is determined. The distance difference between the device and different base stations is calculated based on the arrival time difference and the signal propagation speed.
4. The positioning method according to claim 3, characterized in that, Determining the arrival time difference between the signal from the responding base station and the signal from the initiating base station at the device based on the arrival times of the start signal, the response signal, the end signal, and the acknowledgment signal includes: The round-trip time and response time of the initiating base station are determined in the termination signal; wherein, the round-trip time of the initiating base station is the time interval between the time when the response signal arrives at the initiating base station and the time when the initiating base station sends the start signal, and the response time of the initiating base station is the time interval between the time when the initiating base station sends the termination signal and the time when the response signal arrives at the initiating base station; The response signal determines the first moment when the start signal arrives at the response base station and the response time of the response base station, and the confirmation signal determines the second moment when the end signal arrives at the response base station; wherein, the response time of the response base station is the time interval between the moment when the response base station sends the response signal and the moment when the start signal arrives at the response base station; A first time-scale mapping coefficient is constructed based on the round-trip time of the initiating base station, the response time of the initiating base station, and the time when the device receives the end signal and the start signal, respectively. A second time-scale mapping coefficient is constructed based on the round-trip time of the initiating base station, the response time of the initiating base station, the first time, and the second time. Based on the times when the device receives the end signal, the response signal, and the start signal, the response time of the response base station, the response time of the initiating base station, the first time scale mapping coefficient, and the second time scale mapping coefficient, the arrival time difference of the signal from the response base station relative to the signal from the initiating base station to the device is calculated.
5. The positioning method according to claim 1, characterized in that, The step of calculating the target position of the device in the planar coordinate system based on the distance difference between the device and different base stations and the relative positions of the different base stations in the planar coordinate system includes: The distance difference is validated to eliminate distance differences that do not meet the amplitude constraint; wherein, the amplitude constraint is that the absolute value of the distance difference is less than the distance between the corresponding two base stations. A nonlinear positioning equation set is constructed using the distance difference between at least three pairs of base stations that have passed verification. The nonlinear positioning equation set is then transformed into a linear positioning equation set. The linear positioning equation set is solved using the least squares method to obtain the first candidate location. Using the reference location as the starting location, and the sum of squared residuals between the verified distance difference and the theoretical distance difference as the objective function, the location estimate is iteratively updated until the convergence condition is met, thus obtaining the second candidate location; wherein, the theoretical distance difference is the distance difference between the current estimated location and different base stations; When the deviation between the first candidate position and the second candidate position is less than a preset threshold, the consistency verification is passed. The first or second candidate position that has passed the consistency verification is taken as the current estimated position. The nonlinear positioning equations are expanded in first order Taylor at the current estimated position to linearize the nonlinear positioning equations into a linear equations about the position correction. The least squares method is used to solve the linear equations to obtain the position correction. If the magnitude of the position correction is less than the preset correction threshold, then the current estimated position is output as the final target position; If the magnitude of the position correction is greater than or equal to the preset correction threshold, the current estimated position is updated using the position correction, and the process re-enters the step of performing a first-order Taylor expansion of the nonlinear positioning equations at the current estimated position to linearize the nonlinear positioning equations into a linear equations with respect to the position correction, until the convergence condition is met and the target position at the current moment is determined.
6. The positioning method according to claim 5, characterized in that, After determining the target position at the current moment, the process also includes: Calculate the displacement between the current target position and the historical position at the previous time; When the displacement exceeds the preset maximum allowable displacement threshold, the current moment is marked as an abnormal jump moment, and the number of consecutive abnormal jumps is accumulated. When the number of consecutive abnormal jumps is less than a preset threshold, the target position at the current moment is corrected to the historical position at the previous moment. When the number of consecutive abnormal jumps is greater than or equal to the preset number threshold, the number of consecutive abnormal jumps is reset to zero. When the displacement is less than or equal to the preset maximum allowable displacement threshold, the number of consecutive abnormal jumps is reset to zero.
7. The positioning method according to claim 1, characterized in that, Determining the positional relationship of the device relative to the active area based on the target location and the boundary of the closed polygon includes: Calculate the directional bias of the target position relative to each edge of the closed polygon; wherein the directional bias is used to describe the lateral orientation of the target position relative to the edge; If all edges are oriented in the same direction, then the target location is determined to be inside the activity area; If there are edges with inconsistent directional deviations, the target location is determined to be outside the activity area.
8. A positioning device, characterized in that, Applied to the device side, the device includes: The first determining module is used to obtain the distance between multiple base stations set at the boundary of the activity area, determine the relative position of the multiple base stations in the plane coordinate system according to the distance between the different base stations, and arrange the multiple base stations in spatial order to form a closed polygon boundary. A recording module is used to receive communication signals sent by different base stations during the interaction process and record the arrival time of the communication signals; The first calculation module is used to calculate the distance difference between the device and different base stations based on the arrival times of the communication signals between different base stations during the same round of interaction. The second calculation module is used to calculate the target position of the device in the plane coordinate system based on the distance difference between the device and the different base stations and the relative positions of the different base stations in the plane coordinate system. The second determining module is used to determine the positional relationship of the device relative to the active area based on the target location and the boundary of the closed polygon.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the positioning method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed, implements the steps of the positioning method as described in any one of claims 1 to 7.
11. An interactive system, characterized in that, This includes multiple base stations and equipment located at the boundaries of the activity area; The base station is used to: determine its own distance from other base stations by communicating with other base stations, and send its own distance from other base stations to the device. The device is used to: determine the relative positions of multiple base stations in a planar coordinate system based on the distance between different base stations, and arrange the multiple base stations in spatial order to form a closed polygon boundary; receive communication signals sent by different base stations during the interaction process, and record the arrival time of the communication signals; and calculate the distance difference between the device and different base stations based on the arrival times of the communication signals between different base stations in the same round of interaction. Based on the distance difference between the device and the different base stations and the relative positions of the different base stations in the plane coordinate system, calculate the target position of the device in the plane coordinate system; The positional relationship of the device relative to the active area is determined based on the target location and the boundary of the closed polygon.