Positioning loss detection method and apparatus, robot, and storage medium
By dynamically constructing and fusing grid maps, environmental change feature points are identified, solving the problem of misjudgment in robot localization loss detection and improving the reliability and stability of localization detection.
Patent Information
- Application Number
- CN202611284946.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-21
- Publication Date
- 2026-11-20
AI Technical Summary
When existing industrial robots experience localized environmental changes, relying on nearest neighbor matching between static point cloud maps and laser point clouds can easily lead to misjudgments in positioning, resulting in insufficient reliability of positioning loss detection.
By acquiring environmental change feature points of the robot's environment, a dynamic grid map is dynamically constructed and fused with a static point cloud map to generate a global grid map. The global similarity score is then calculated to determine if the localization has been lost.
It achieves decoupled identification of dynamic environmental changes and location anomalies, avoids misjudgment, and improves the reliability and stability of location detection.
Smart Images

Figure CN123129140A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of robot control technology, and in particular to a method, device, robot, and storage medium for detecting positioning loss. Background Technology
[0002] Currently, industrial robots generally use 2D single-line LiDAR for positioning. However, when the environment changes locally, relying solely on the nearest neighbor matching between the static point cloud map and the LiDAR point cloud can easily lead to misjudgment: the error distance fluctuation cannot distinguish between real environmental changes and positioning anomalies, resulting in insufficient reliability of positioning loss detection. Summary of the Invention
[0003] In view of this, embodiments of this application provide a method, apparatus, robot, and computer-readable storage medium for detecting positioning loss, which can achieve accurate detection of robot positioning loss.
[0004] In a first aspect, embodiments of this application provide a location loss detection method, including: Obtain environmental change feature points of the robot's environment, and dynamically construct a dynamic grid map based on the environmental change feature points; In the static point cloud map, perform nearest neighbor search for each laser point cloud in the current frame, calculate the first spatial distance corresponding to each laser point cloud in the current frame, and determine the mean error distance based on all the first spatial distances; In response to the mean error distance being greater than a first preset threshold, the dynamic raster map and the static point cloud map are fused to generate a global raster map; Based on the global grid map, calculate the global similarity score between the current frame laser point cloud and the global grid map; Based on the comparison result between the global similarity score and the second preset threshold, it is determined whether the robot has lost its localization.
[0005] Secondly, embodiments of this application provide a location loss detection device, comprising: The dynamic grid map construction module is used to acquire environmental change feature points of the robot's environment and dynamically construct a dynamic grid map based on the environmental change feature points. The error distance mean determination module is used to perform nearest neighbor search for each laser point cloud in the current frame laser point cloud in the static point cloud map, calculate the first spatial distance corresponding to each laser point cloud in the current frame, and determine the error distance mean based on all the first spatial distances; A global raster map generation module is used to generate a global raster map by probabilistically fusing the dynamic raster map and the static point cloud map in response to the mean error distance being greater than a first preset threshold. A global similarity score calculation module is used to calculate the global similarity score between the current frame laser point cloud and the global grid map based on the global grid map; The positioning loss judgment module is used to determine whether the robot has lost its positioning based on the comparison result between the global similarity score and the second preset threshold.
[0006] Thirdly, embodiments of this application provide a robot, which includes a processor and a memory, the memory storing a computer program, and the processor being used to execute the above-described location loss detection method.
[0007] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed on a processor, implements the aforementioned location loss detection method.
[0008] The embodiments of this application have the following beneficial effects: This application acquires environmental change feature points of the robot's environment and constructs a dynamic grid map; performs nearest neighbor search on the current frame laser point cloud in the static point cloud map to calculate a first spatial distance, and determines the average error distance based on all the first spatial distances; in response to the average value being greater than a first preset threshold, merges the dynamic grid map and the static point cloud map to generate a global grid map; calculates the global similarity score between the current frame laser point cloud and the map based on the global grid map; and determines positioning loss based on the comparison result of the score and a second preset threshold. This method can achieve decoupled identification of dynamic environmental changes and positioning anomalies, avoiding misjudgments caused by map local update lag or dynamic interference; through a two-layer judgment mechanism, it improves detection reliability while ensuring real-time performance, enabling the robot to stably and accurately identify its own positioning status in real industrial scenarios. Attached Figure Description
[0009] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0010] Figure 1 This paper shows a schematic diagram of the architecture of a location loss detection system according to an embodiment of the present application; Figure 2 A schematic diagram of the software structure of the robot according to an embodiment of this application is shown; Figure 3 This paper illustrates a first flowchart of a location loss detection method according to an embodiment of the present application. Figure 4This paper illustrates a second flowchart of the location loss detection method according to an embodiment of the present application. Figure 5 A schematic diagram of the third process of the location loss detection method according to an embodiment of this application is shown; Figure 6 The fourth flowchart of the location loss detection method according to an embodiment of this application is shown; Figure 7 A schematic diagram of a grid map according to an embodiment of this application is shown; Figure 8 The fifth flowchart of the location loss detection method according to an embodiment of this application is shown. Detailed Implementation
[0011] The technical solutions in 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.
[0012] The components of the embodiments of this application described and illustrated in the accompanying drawings can be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of this application provided in the drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0013] In the following text, the terms "comprising," "having," and their cognates, which may be used in various embodiments of this application, are intended only to indicate a particular feature, number, step, operation, element, component, or combination thereof, and should not be construed as primarily excluding the presence of one or more other features, numbers, steps, operations, elements, components, or combinations thereof, or adding the possibility of one or more combinations thereof. Furthermore, the terms "first," "second," "third," etc., are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance.
[0014] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of this application pertain. Terms (such as those defined in commonly used dictionaries) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be construed as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of this application.
[0015] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0016] See Figure 1 , Figure 1 This is a schematic diagram of the architecture of the robot positioning loss detection system provided in this application embodiment. To support the positioning loss detection of a robot, this system includes a robot 300 and a server 100. The robot 300 and the server 100 are connected to the server 100 via a network 200, which can be a wide area network (WAN), a local area network (LAN), or a combination of both. In this embodiment, the robot 300 integrates a lidar, a positioning module, and a main control unit, responsible for real-time acquisition of sensor data, execution of the core detection algorithm, and output of positioning status determination results. The server device can optionally provide enhanced functions such as remote mapping, map version management, and multi-machine collaborative positioning monitoring, but the core positioning loss detection method of this application embodiment can be completed independently on the terminal device.
[0017] The server 100 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The terminal and server can be connected directly or indirectly via wired or wireless communication, which is not limited in this embodiment.
[0018] See Figure 2 , Figure 2 This is a structural schematic diagram of the robot 300 provided in an embodiment of this application. Figure 2 The robot 300 shown includes: at least one processor 310, a memory 350, at least one network interface 320, and a user interface 330. The processor 310 executes a computer program stored in the memory to implement the positioning loss detection method described in this embodiment; the memory 350 stores the computer program and temporary data generated during its operation; the network interface 320 enables data interaction between the robot and external devices; and the user interface 330 includes output and input devices for human-machine interaction and status feedback.
[0019] The various components in robot 300 are coupled together via bus system 340. It is understood that bus system 340 is used to enable communication between these components. In addition to a data bus, bus system 340 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 2 The general labeled all buses as Bus System 340.
[0020] Processor 310 can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including at least one of a Central Processing Unit (CPU), Graphics Processing Unit (GPU), Network Processor (NP), Digital Signal Processor (DSP), Application-Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application.
[0021] User interface 330 includes one or more output devices 331 that enable the presentation of media content, including one or more speakers and / or one or more visual displays. User interface 330 also includes one or more input devices 332, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0022] The memory 350 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 350 may optionally include one or more storage devices physically located away from the processor 310.
[0023] The memory 350 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc. The memory is used to store computer programs, and the processor can execute the computer programs accordingly after receiving execution instructions.
[0024] In some embodiments, memory 350 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.
[0025] Operating system 351 includes system programs for handling various basic system services and performing hardware-related tasks, such as framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks; network communication module 352 for reaching other electronic devices via one or more (wired or wireless) network interfaces 320, exemplary network interfaces 320 including: Bluetooth, WiFi, and Universal Serial Bus (USB), etc.; presentation module 353 for enabling the presentation of information (e.g., user interface for operating peripheral devices and displaying content and information) via one or more output devices 331 associated with user interface 330 (e.g., display screen, speaker, etc.); input processing module 354 for detecting and translating one or more user inputs or interactions from one or more input devices 332.
[0026] In some embodiments, the location loss detection device provided in this application can be implemented in software. Figure 2 The diagram shows a location loss detection device 355, a dynamic grid map construction module 3551, an error distance mean determination module 3552, a global grid map generation module 3553, a global similarity score calculation module 3554, and a location loss judgment module 3555, all stored in the memory 350.
[0027] It should be noted that the above modules are only logical divisions, and their physical implementation can be centralized on a single processor or distributed across multiple coprocessors; data transfer between modules is accomplished through memory sharing or message queues, which does not constitute a limitation on the scope of protection.
[0028] The positioning loss detection method provided in this application embodiment is executed by a robot; in some implementation scenarios, the server device can also be used as the execution subject to receive laser point cloud and pose data uploaded by the robot and return the positioning loss judgment result; regardless of the execution subject, the technical steps, processing logic and judgment rules included in the method remain consistent.
[0029] The positioning loss detection method of this application is for robots equipped with two-dimensional single-line LiDAR and is applicable to long-term autonomous operation scenarios in structured indoor environments. It aims to solve the problem of misjudgment of positioning status caused by interference from dynamic objects, changes in environmental layout, or map boundary effects, thereby improving the reliability of positioning diagnosis.
[0030] Figure 3 A schematic flowchart of a location loss detection method according to an embodiment of this application is shown. Exemplarily, the location loss detection method includes steps S100-S500: Step S100: Obtain environmental change feature points of the robot's environment, and dynamically construct a dynamic grid map based on the environmental change feature points.
[0031] Among them, environmental change feature points refer to laser observation points that reflect structural changes in the real environment, identified during robot operation by comparing the spatial geometric consistency between the current keyframe laser point cloud and the static point cloud map. These points are caused by, but are not limited to: dynamic obstacles such as personnel or transportation equipment entering the scanning area, displacement of existing fixed facilities, changes in the stacking pattern of goods, and newly appearing obstacle structures in areas not covered by the map. These points are not measurement noise or anomalous flying points, but rather effective geometric representations of the evolution of the environmental state, possessing clear physical interpretability and spatial positioning accuracy.
[0032] After identifying the characteristic points of environmental change, the specific spatial location and extent of structural changes occurring in the environment at the current moment are determined. Subsequently, using these points as observation basis, the system combines the geometric imaging model of the laser sensor and the probabilistic raster update mechanism to generate a dynamic raster map with the same resolution and coordinate system as the static raster map. This map is stored independently in the system map file, serving as the basic data unit for subsequent environmental prior updates. The dynamic raster map does not replace the original static point cloud map, but rather works in conjunction with it to form a bimodal representation of environmental cognition: the static point cloud map maintains long-term structural memory, while the dynamic raster map carries short-term change information. In subsequent steps, the two are probabilistically fused to generate the latest global raster map.
[0033] In some implementations, such as Figure 4 As shown, the process of obtaining environmental change feature points includes steps S110-S140: Step S110: Obtain the robot's current pose and keyframe laser point cloud.
[0034] In this step, the robot's current pose can be output in real time by the localization module. This pose includes, but is not limited to, the robot's horizontal coordinate, vertical coordinate, and orientation angle in a two-dimensional plane, which are used to characterize the robot's spatial position and attitude relative to the map coordinate system.
[0035] For keyframe laser point clouds, keyframes that meet set conditions must first be identified from the continuously acquired laser data stream. In this embodiment, keyframes are determined based on two dimensions: time interval and displacement distance. A keyframe is confirmed if either dimension is satisfied.
[0036] In terms of time dimension, if the robot's running time interval is greater than or equal to a preset time interval since the acquisition time of the previous key frame, the currently acquired laser frame is determined as a key frame. The preset time interval is set according to the system's real-time requirements and computational load balancing, and its value range can be from 8 seconds to 15 seconds. In a specific embodiment, if the preset time interval is set to 10 seconds, that is, when the time elapsed since the acquisition of the previous key frame reaches or exceeds 10 seconds, the current laser frame is determined as a key frame.
[0037] Regarding displacement criteria, if the robot's displacement distance in the map coordinate system exceeds a preset distance from the robot's pose corresponding to the previous keyframe, the currently acquired laser frame is determined as a keyframe. The preset distance is set according to the effective sensing range of the lidar, the grid map resolution, and the positioning stability requirements, and can range from 25 cm to 35 cm. In a specific embodiment, if the preset distance is set to 30 cm, that is, when the Euclidean distance between the robot's current position and the pose corresponding to the previous keyframe is greater than 30 cm, the current laser frame is determined as a keyframe.
[0038] Once the keyframes are determined, the system extracts complete single-line laser point cloud data from them. Each frame includes multiple two-dimensional laser points, each expressed with the coordinate system of the lidar sensor as the origin. Subsequent steps will transform the point cloud as a whole to the static point cloud map coordinate system based on the robot's current pose, serving as the basic input for spatial matching and dynamic feature recognition.
[0039] Step S120: Transform the keyframe laser point cloud to the static point cloud map coordinate system based on the current pose.
[0040] Among them, the static point cloud map refers to the collection of point clouds that the robot builds and maintains by continuously scanning the environment with LiDAR during the mapping phase, representing the long-term stable structure of the environment; the point cloud map uses the global map coordinate system as a reference, and all points are represented by two-dimensional coordinates; its point cloud data is processed by voxelization downsampling and organized into an ikdtree spatial index structure to support subsequent efficient nearest neighbor queries.
[0041] In this step, the system performs coordinate transformation on each laser point in the keyframe laser point cloud based on the robot's current pose obtained in step S110: the horizontal and vertical coordinates of the point in the lidar sensor coordinate system are converted into the horizontal and vertical coordinates in the static point cloud map coordinate system according to the rotation angle and translation amount corresponding to the current pose; all the laser points obtained after the transformation together constitute the expression of the keyframe in the static point cloud map coordinate system.
[0042] Step S130: Based on the spatial index structure, perform a nearest neighbor search on each point of the keyframe laser point cloud in the static point cloud map to obtain the second spatial distance corresponding to each laser point of the keyframe.
[0043] In this step, the system calls the ikdtree that has been built and continuously maintained, and performs a nearest neighbor search with K equal to 1 on each laser point after the transformation in step S120 in the static point cloud map to obtain the nearest point of the laser point in the static point cloud map; then calculates the Euclidean distance between the laser point and its nearest point, which is the second spatial distance; it should be noted that each laser point corresponds to a second spatial distance.
[0044] Among them, ikdtree (Incremental KD Tree) is a K-dimensional spatial index tree, which is an efficient data structure. In this embodiment, ikdtree is used to organize and manage all points in the static point cloud map. During the construction and update process, it automatically performs voxel-level downsampling to remove duplicate or redundant points in the same small spatial area, and triggers the reconstruction of the corresponding subtree when the tree structure becomes locally unbalanced, thereby maintaining stable query performance. This ikdtree only serves the static point cloud map and is not used for the generation or updating of dynamic raster maps.
[0045] Step S140: The laser point of the key frame that meets any of the following conditions is determined as the environmental change feature point: no nearest neighbor point is found within the preset search radius, or the nearest neighbor point is found but the corresponding second spatial distance is greater than the preset distance threshold.
[0046] It is understandable that if no nearest neighbor is found within the preset search radius, it means that there is no known geometric structure in the static point cloud map at the spatial location corresponding to the laser point. This phenomenon may be caused by the addition of obstacles in the environment, the removal of existing obstacles, or the robot moving to an area outside the map coverage boundary, reflecting a substantial loss or expansion of the local structure of the environment. If a nearest neighbor is found but the corresponding second spatial distance is greater than the preset distance threshold, it means that there is a significant spatial offset between the laser point and its nearest neighbor in the static point cloud map. This offset exceeds the normal mapping error and positioning jitter range that the static map can accommodate. It usually means that the object at this location has undergone physical displacement, deformation, or a change in occlusion, which is reliable observational evidence of structural changes in the real environment.
[0047] The preset search radius can be set according to the LiDAR ranging accuracy, static point cloud map resolution, and the minimum resolvable scale of the environmental structure. For example, it can be set to 0.5m; that is, if no point is found in the static point cloud map within the 0.5m search radius set for the current LiDAR point, then the LiDAR point is determined to be an environmental change feature point. The preset distance threshold can be set according to the robot positioning system error, static point cloud map point density, and common dynamic interference scales. For example, it can be set to 0.2m; that is, when the second spatial distance between the LiDAR point and the nearest neighbor point found in the static point cloud map is greater than 0.2m, the LiDAR point is determined to be an environmental change feature point.
[0048] In some implementations, such as Figure 5 As shown, a dynamic raster map is dynamically constructed based on environmental change feature points, including steps S150-S180: Step S150: Using the origin of the laser sensor as the starting point of the ray and each environmental change feature point as the ending point of the ray, generate multiple observation rays and determine all grids that each observation ray passes through.
[0049] In this step, for each identified environmental change feature point, the system constructs a straight line segment pointing from the center of the laser sensor to that feature point, serving as an observation ray. Then, the Bresenham algorithm is used to discretize this ray, calculating and determining each grid cell it passes through in the two-dimensional grid map. The Bresenham algorithm determines the index of each traversed grid cell on the path using integer incremental iterations based on the integer grid coordinates of the ray's start and end points, without relying on floating-point operations, ensuring efficient computation and no omissions. All traversed grid cells constitute the spatial coverage set of the observation ray, used for subsequent state marking and probability updates.
[0050] Step S160: For each observation ray, mark all grids from the starting point to the ending point of the observation ray, except for the grid where the ending point of the observation ray is located, as idle, and determine the initial occupancy probability of the grids corresponding to the idle state as the first occupancy probability.
[0051] The first occupancy probability corresponds to the prior confidence that a grid is in an idle state, such as being set to 0.4; that is, for all grids on the ray path except the endpoint, before performing the probability update, their occupancy probability is initialized to 0.4, indicating that the area is currently considered to be highly likely to be free of obstacles.
[0052] Step S170: Mark the grid where the endpoint of the observed ray is located as occupied, and determine the initial occupancy probability of the grid corresponding to the occupied state as the second occupancy probability.
[0053] The second occupancy probability corresponds to the prior confidence that the grid is in an occupied state, which can be set to 0.65; that is, for each grid where the endpoint of the observed ray is located, before performing the probability update, its occupancy probability is initialized to 0.65, indicating that the location is currently considered to have a high probability of having an obstacle.
[0054] Step S180: Based on the logarithmic probability model, the occupancy probability of the grid corresponding to the idle state and the grid corresponding to the occupied state is iteratively updated by combining laser observation information, and the updated occupancy probability is limited to a preset probability range, thereby obtaining a dynamic grid map.
[0055] Specifically, the occupancy probability p of each grid cell can first be calculated using the formula... Converted to logarithmic probability L, the initial logarithmic probability L0 of all grids is 0; when a grid is located at the endpoint of the observation ray (i.e., hit by the laser beam), the probability is set according to the radar characteristics. Value, of which, 0,1 The larger the value, the higher the radar's confidence in detecting the presence of an obstacle at that location. You can set it to 0.85, and then you can use the formula. Update the logarithmic probability of the grid; when a grid is located on the observation ray path but not at the endpoint (i.e., the laser beam passes through the grid but does not hit it), adjust the settings according to the radar characteristics. value, 0,1 Furthermore, the smaller the value, the higher the radar's confidence in detecting no obstacles at that location; for example, it can be set to 0.15. That is, according to the formula... Update the logarithmic probability of this raster; after the update is complete, The range is limited to -5 to +5; values outside this range are truncated to either -5 or +5. Finally, the truncated logarithmic probability is... Through formula Converting back to the occupancy probability p, the resulting p value is the updated occupancy probability of the grid. After the above processing is completed for all observation rays corresponding to all environmental change feature points, the occupancy probabilities of all grids together constitute a dynamic grid map. This map has the same resolution and coordinate system as the static grid map and is saved to the system map file.
[0056] Step S200: Perform nearest neighbor search on each laser point cloud in the current frame of the static point cloud map, calculate the first spatial distance corresponding to each laser point cloud in the current frame, and determine the mean error distance based on all the first spatial distances.
[0057] In this step, the system uses the robot's current pose as a reference to transform the currently acquired frame of laser point cloud to the coordinate system of a static point cloud map. Then, it calls the pre-built and continuously maintained ikdtree spatial index structure to perform a nearest neighbor search (K=1) on each transformed laser point in the static point cloud map, obtaining the nearest neighbor point of that laser point in the static point cloud map. Next, it calculates the Euclidean distance between the laser point and its nearest neighbor, which is the first spatial distance. The arithmetic mean of the first spatial distances corresponding to all laser points in the current frame is then calculated, and the result is the mean error distance. This mean is used to characterize the overall geometric matching degree between the current frame's observation data and the static point cloud map, serving as the trigger for whether to initiate global similarity score fine-tuning.
[0058] In some implementations, such as Figure 6 As shown, step S200 specifically includes steps S210-S230: Step S210: Transform the current frame laser point cloud to the static point cloud map coordinate system according to the robot's current pose.
[0059] In this step, the system performs rigid body coordinate transformation on the currently acquired frame of laser point cloud based on the robot's current pose obtained in step S110: the horizontal and vertical coordinates of each laser point in the frame in the lidar sensor coordinate system are uniformly converted into the horizontal and vertical coordinates in the static point cloud map coordinate system according to the rotation angle and translation amount corresponding to the current pose; all the laser points obtained after the transformation together constitute the expression form of the frame in the static point cloud map coordinate system.
[0060] Step S220: Based on the spatial index structure, perform a nearest neighbor search on each transformed laser point in the static point cloud map to obtain the first spatial distance between each laser point and its corresponding nearest neighbor.
[0061] In this step, the system calls the same ikdtree structure to perform a nearest neighbor search with K equal to 1 on each laser point after the transformation in step S210 in the static point cloud map to obtain the nearest point of the laser point in the static point cloud map; then calculate the Euclidean distance between the laser point and its nearest point, which is the first spatial distance; each laser point corresponds to a first spatial distance, which constitutes the basic dataset for the calculation in step S230.
[0062] Step S230: Perform a numerical average calculation on all the first spatial distances to obtain the average error distance.
[0063] In this step, the system adds up all the first spatial distances obtained in step S220, and then divides them by the total number of laser points in the frame. The resulting quotient is the average error distance. This average is a single scalar, which does not produce systematic deviations with changes in point cloud density or frame length. It can stably reflect the overall matching level between the current frame observation and the static point cloud map.
[0064] In step S300, in response to the mean error distance being greater than a first preset threshold, the dynamic raster map and the static point cloud map are fused to generate a global raster map.
[0065] The first preset threshold can be set comprehensively based on the ranging accuracy of the lidar, the pose drift range of the robot positioning system under typical working conditions, and the geometric fidelity of the static point cloud map. For example, it can be set to 0.15m: when the average error distance does not exceed the first preset threshold, it indicates that the current observation is consistent with the static point cloud map as a whole, and the positioning status is reliable; when it exceeds the first preset threshold, it indicates that the environmental structure has changed significantly or the robot pose estimation has deviated abnormally, and more refined criteria need to be activated for secondary confirmation.
[0066] It is understandable that in this step, if the average error distance is less than or equal to the first preset threshold, the robot's positioning status is directly determined to be normal, and the process terminates; if the average error distance is greater than the first preset threshold, the system performs a map fusion operation: first, the static point cloud map is converted into a static raster map. This conversion process uses the same resolution and coordinate system as the dynamic raster map, and maps each point in the static point cloud to the corresponding raster using voxel projection. Then, the dynamic raster map generated in step S180 is fused with the static raster map grid by grid to obtain a global raster map (e.g., ...). Figure 7 As shown, Figure 7 In the diagram, 'a' represents a dynamic raster map, 'b' represents a static raster map, and 'c' represents a global raster map.
[0067] It should be noted that the fusion can be performed using a probabilistic fusion method. That is, when converting the static point cloud map into a static raster map, each point in the static point cloud is mapped to the corresponding raster using voxel projection, and the occupancy probability of each raster is initialized with a logarithmic probability model, with an initial value of 0.5. Subsequently, the dynamic raster map generated in step S180 is updated to the static raster map to generate a global raster map. This update means that for rasters with an occupancy probability greater than 0.65 in the dynamic raster map, their occupancy probability is increased to a higher level in the global raster map; for rasters with an occupancy probability less than 0.4 in the dynamic raster map, their occupancy probability is decreased to a lower level in the global raster map; and for rasters with an occupancy probability between 0.4 and 0.65 in the dynamic raster map, their original occupancy probability is maintained unchanged in the global raster map. The raster map obtained after this update operation is the global raster map. The global raster map constructed in this way completely retains the static structural memory and overlays the latest dynamic information reflected by environmental change feature points.
[0068] Step S400: Based on the global grid map, calculate the global similarity score between the laser point cloud in the current frame and the global grid map.
[0069] In this step, the system uses the global grid map as a benchmark to perform high-confidence local matching on the laser point cloud of the current frame. In this embodiment, instead of relying on the rigid distance minimization from one point to another, it combines the historical observation statistical characteristics accumulated by each candidate obstacle grid to evaluate the rationality of the current laser point falling within the distribution range of that grid. The spatial fit is characterized by Mahalanobis distance and normalized by Gaussian function nonlinear mapping. Finally, the arithmetic mean of the scores of all laser points is used to characterize the overall matching quality. The global similarity score ranges from 0 to 1. The closer the value is to 1, the more self-consistent the current observation is with the environmental structure and historical distribution pattern expressed by the global grid map, and the more reliable the positioning status is.
[0070] Specifically, such as Figure 8 As shown, step S400 specifically includes steps S410-S450: Step S410: Transform the current frame laser point cloud to the coordinate system of the global grid map according to the robot's current pose.
[0071] In this step, based on the robot's current pose obtained in step S110, a rigid body coordinate transformation is performed on the currently acquired frame of laser point cloud: the horizontal and vertical coordinates of each laser point in the frame in the lidar sensor coordinate system are uniformly converted into the horizontal and vertical coordinates in the global grid map coordinate system according to the rotation angle and translation amount corresponding to the current pose; all the laser points obtained after the transformation together constitute the expression form of the frame in the global grid map coordinate system, which serves as the input data for subsequent local matching.
[0072] Step S420: Map each of the currently transformed laser point clouds to a preset size neighborhood centered on the reference grid obtained from the global grid map to determine multiple candidate obstacle grids.
[0073] In this step, the preset size neighborhood can be a 3×3 neighborhood. Specifically, the reference grid index (i,j) of the current laser point can be calculated first by rounding down based on the floating-point coordinates (x,y) of the current laser point in the global grid map coordinate system. Then, taking the reference grid (i,j) as the center, the laser point and its eight surrounding grids (up, down, left, and right) are included, for a total of nine candidate grids. These nine candidate grids constitute the local search range of the current laser point, used to find the location of obstacles that may correspond to its observation. All candidate grids must satisfy the requirement that their occupancy probability in the global grid map is greater than 0.65; otherwise, they are considered non-obstacle areas and do not participate in subsequent matching.
[0074] Step S430: For each candidate obstacle grid, calculate the spatial fit between the current laser point cloud and each historical laser point cloud dataset based on the spatial distribution characteristics of the historical laser point cloud dataset corresponding to the candidate obstacle grid, and take the candidate obstacle grid with the best spatial fit as the matching result.
[0075] In this step, for each candidate obstacle grid determined in step S420, the historical laser point cloud dataset stored within it is retrieved; this historical laser point cloud dataset consists of laser points that fell into the grid in all past keyframes; assuming this set contains N laser points, it can be represented as... Where j = 1,2,...,N; First, according to the formula Calculate the arithmetic mean of the x and y coordinates of all laser points in the point set to obtain the reference center position. Then according to the formula Calculate the average of the sum of the outer products of the deviation vectors of each laser point in the point set relative to the reference center position to obtain the covariance characterization quantity cov. Then, for the current laser point... Calculate its position relative to the reference center. The deviation vector is obtained, and the deviation is normalized using the covariance characteristic cov to obtain the scalar representation of the residual vector. ,Right now It should be noted that... The variable is a non-negative real number. The smaller the value, the more the current laser point conforms to the historical distribution pattern of the candidate obstacle grid, and the higher the spatial fit. The above calculation is performed on all nine candidate obstacle grids, and then... The smallest value is used as the matching result for the current laser point.
[0076] Step S440: Solve the matching result of each laser point using the Gaussian function to obtain the matching quality score.
[0077] In this step, the result obtained in step S430 Substituting the values into a Gaussian function and mapping them, we obtain the matching quality score of the current laser point. ,Right now The score ranges from 0 to 1. The closer the value is to 1, the more consistent the current laser point is with the historical distribution of the matched obstacle grid, and the higher the matching quality.
[0078] Step S450: Calculate the arithmetic mean of all matching quality scores to obtain the global similarity score.
[0079] In this step, assuming the total number of laser points in the current frame is K, the matching quality scores corresponding to each of the K laser points are calculated. Add them together, then divide by K, and the quotient is the global similarity score. .
[0080] Step S500: Based on the comparison result between the global similarity score and the second preset threshold, determine whether the robot has lost its localization.
[0081] In this step, the obtained global similarity score is compared with the second preset threshold. If the global similarity score is greater than the second preset threshold, it means that the current frame laser point cloud is self-consistent under the environmental structure and historical obstacle distribution patterns expressed by the global grid map, the observation data is highly matched with the map prior, the robot pose estimation is reliable, and it is judged as normal localization. If the global similarity score is less than or equal to the second preset threshold, it means that there are a large number of observation points in the current frame laser point cloud that cannot be reasonably explained by the historical distribution of any candidate obstacle grid in the global grid map, and therefore it is judged as localization loss.
[0082] It should be noted that the second preset threshold can be comprehensively set based on the distribution characteristics of the global similarity score in the application scenario, the positioning loss rate, the false alarm rate and the engineering of the system.
[0083] This application's embodiments effectively improve the reliability and adaptability of location loss detection by introducing a dynamic grid map update mechanism and a two-layer scoring judgment logic. The dynamic grid map, driven by environmental change feature points and combined with ray casting and logarithmic probability updates, can distinguish between real-world environmental changes and dynamic interference, avoiding misjudging normal changes such as personnel movement and cargo handling as location anomalies. The mean error distance serves as the first-layer criterion, with the second-layer fine-tuning only initiated when the overall deviation between the observation and the static map is significant, reducing unnecessary computational overhead. The global similarity score is based on the distribution characteristics of the historical laser point cloud dataset of candidate obstacle grids, using Mahalanobis distance and Gaussian mapping to evaluate the consistency between the current observation and the environmental prior, ensuring that the criterion reflects not only the degree of geometric matching but also the conformity to statistical distribution patterns. This method enables robots to cope with various complex conditions such as outdated maps, boundary scanning, and dynamic object interference, providing reliable location status monitoring data for autonomous robot navigation.
[0084] The location loss detection device provided in the embodiments of this application will be described below. Exemplarily, the location loss detection device includes: The dynamic grid map construction module 3551 is used to acquire environmental change feature points of the robot's environment and dynamically construct a dynamic grid map based on these feature points.
[0085] The error distance mean determination module 3552 is used to perform nearest neighbor search for each laser point cloud in the current frame of the static point cloud map, calculate the first spatial distance corresponding to each laser point cloud in the current frame, and determine the error distance mean based on all the first spatial distances.
[0086] The global raster map generation module 3553 is used to generate a global raster map by probabilistically fusing the dynamic raster map and the static point cloud map in response to the error distance mean being greater than a first preset threshold.
[0087] The global similarity score calculation module 3554 is used to calculate the global similarity score between the laser point cloud of the current frame and the global grid map based on the global grid map.
[0088] The positioning loss judgment module 3555 is used to determine whether the robot has lost its positioning based on the comparison result between the global similarity score and the second preset threshold.
[0089] In some implementations, the process of acquiring environmental change feature points includes: acquiring the robot's current pose and keyframe laser point cloud; transforming the keyframe laser point cloud to a static point cloud map coordinate system based on the current pose; performing a nearest neighbor search on each point of the keyframe laser point cloud in the static point cloud map according to the spatial index structure to obtain the second spatial distance corresponding to each laser point of the keyframe; and determining the laser point of the keyframe that meets any of the following conditions as an environmental change feature point: no nearest neighbor point is found within a preset search radius, or a nearest neighbor point is found but the corresponding second spatial distance is greater than a preset distance threshold.
[0090] In some implementations, a dynamic grid map is dynamically constructed based on environmental change feature points, including: generating multiple observation rays with the origin of the laser sensor as the ray starting point and each environmental change feature point as the ray ending point, and determining all grids traversed by each observation ray; for each observation ray, marking all grids from the ray starting point to the ray ending point, except for the grid where the ray ending point is located, as idle, and determining the initial occupancy probability of the grids corresponding to the idle state as the first occupancy probability; marking the grid where the ray ending point is located as occupied, and determining the initial occupancy probability of the grids corresponding to the occupied state as the second occupancy probability; iteratively updating the occupancy probabilities of the grids corresponding to the idle state and the grids corresponding to the occupied state based on a logarithmic probability model and combined with laser observation information, and limiting the updated occupancy probabilities to within a preset probability range, thereby obtaining a dynamic grid map.
[0091] In some implementations, a nearest neighbor search is performed on each laser point cloud in the current frame of the static point cloud map to calculate a first spatial distance corresponding to each laser point cloud in the current frame, and an average error distance is determined based on all first spatial distances. This includes: transforming the laser point cloud of the current frame to the coordinate system of the static point cloud map according to the robot's current pose; performing a nearest neighbor search on each transformed laser point in the static point cloud map according to the spatial index structure to obtain a first spatial distance between each laser point and its corresponding nearest neighbor; and averaging all the first spatial distances to obtain the average error distance.
[0092] In some implementations, based on a global grid map, the global similarity score between the current frame's laser point cloud and the global grid map is calculated, including: transforming the current frame's laser point cloud to the coordinate system of the global grid map according to the robot's current pose; determining multiple candidate obstacle grids within a preset-size neighborhood centered on the reference grid obtained by mapping each transformed laser point cloud to the global grid map; for each candidate obstacle grid, calculating the spatial fit between the current laser point cloud and each historical laser point cloud dataset based on the spatial distribution characteristics of the historical laser point cloud dataset corresponding to the candidate obstacle grid, and taking the candidate obstacle grid with the best spatial fit as the matching result; obtaining a matching quality score by solving the matching result of each laser point using a Gaussian function; and obtaining the global similarity score by calculating the arithmetic mean of all matching quality scores.
[0093] In some implementations, the determination of keyframes includes: using the acquisition time of the previous keyframe as a reference, if the robot's running time interval is greater than or equal to a preset time interval, then the corresponding laser frame is taken as a keyframe; using the robot pose corresponding to the previous keyframe as a reference, if the robot's displacement distance exceeds a preset distance, then the corresponding laser frame is taken as a keyframe.
[0094] In some implementations, the spatial fit between the current laser point and each historical laser point cloud dataset is calculated, and the candidate obstacle grid with the best spatial fit is taken as the matching result. This includes: extracting the historical laser point cloud dataset for each candidate obstacle grid; determining the reference center position of the corresponding candidate obstacle grid based on the historical laser point cloud dataset, and calculating the covariance representation of the spatial distribution dispersion of the historical laser point cloud dataset; determining the residual vector based on the offset vector between the current laser point and the reference center position and the covariance representation; performing norm operation on the residual vector to obtain a scalar value representing the spatial fit; and taking the candidate obstacle grid with the smallest scalar value as the matching result for the current laser point.
[0095] It is understood that the device in this embodiment corresponds to the location loss detection method in the above embodiments, and the options in the above embodiments are also applicable to this embodiment, so they will not be described again here.
[0096] This application also provides a computer-readable storage medium for storing the computer program used in the robot described above. For example, the computer-readable storage medium may include, but is not limited to, various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0097] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that, in alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0098] In addition, the functional modules or units in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0099] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, 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 a computer device (which may be a smartphone, personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.
[0100] 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 method for detecting location loss, characterized in that, include: Obtain environmental change feature points of the robot's environment, and dynamically construct a dynamic grid map based on the environmental change feature points; In the static point cloud map, perform nearest neighbor search for each laser point cloud in the current frame, calculate the first spatial distance corresponding to each laser point cloud in the current frame, and determine the mean error distance based on all the first spatial distances; In response to the mean error distance being greater than a first preset threshold, the dynamic raster map and the static point cloud map are fused to generate a global raster map; Based on the global grid map, calculate the global similarity score between the current frame laser point cloud and the global grid map; Based on the comparison result between the global similarity score and the second preset threshold, it is determined whether the robot has lost its localization.
2. The location loss detection method according to claim 1, characterized in that, The process of acquiring the environmental change feature points includes: Obtain the robot's current pose and keyframe laser point cloud; Based on the current pose, the keyframe laser point cloud is transformed to a static point cloud map coordinate system; Based on the spatial index structure, a nearest neighbor search is performed on each point of the key frame laser point cloud in the static point cloud map to obtain the second spatial distance corresponding to each laser point of the key frame. The laser points of the keyframes that meet any of the following conditions are identified as environmental change feature points: If no nearest neighbor is found within the preset search radius, or if a nearest neighbor is found but the corresponding second spatial distance is greater than the preset distance threshold.
3. The location loss detection method according to claim 2, characterized in that, The step of dynamically constructing a dynamic raster map based on the environmental change feature points includes: Multiple observation rays are generated with the origin of the laser sensor as the starting point of the ray and each environmental change feature point as the ending point of the ray, and the entire grid through which each observation ray passes is determined. For each observation ray, all grids from the starting point of the observation ray to the ending point of the observation ray, except for the grid where the ending point of the observation ray is located, are marked as idle, and the initial occupancy probability of the grids corresponding to the idle state is determined as the first occupancy probability; The grid cell where the endpoint of the observed ray is located is marked as occupied, and the initial occupancy probability of the grid cell corresponding to the occupied state is determined as the second occupancy probability; Based on the logarithmic probability model, the occupancy probability of the grid corresponding to the idle state and the grid corresponding to the occupied state is iteratively updated by combining laser observation information, and the updated occupancy probability is limited to a preset probability range, thereby obtaining the dynamic grid map.
4. The location loss detection method according to claim 1, characterized in that, The step of performing a nearest neighbor search on each laser point cloud in the current frame of the static point cloud map, calculating the first spatial distance corresponding to each laser point cloud in the current frame, and determining the mean error distance based on all the first spatial distances includes: Transform the current frame of laser point cloud to the static point cloud map coordinate system according to the robot's current pose; Based on the spatial index structure, a nearest neighbor search is performed on each transformed laser point in the static point cloud map to obtain the first spatial distance between each laser point and its corresponding nearest neighbor. The average error distance is obtained by averaging all the first spatial distances.
5. The location loss detection method according to claim 1, characterized in that, The step of calculating the global similarity score between the current frame laser point cloud and the global raster map based on the global raster map includes: Transform the current frame's laser point cloud to the coordinate system of the global grid map according to the robot's current pose; Multiple candidate obstacle grids are determined by mapping each transformed laser point cloud to a reference grid centered on the global grid map and then to a neighborhood of a preset size. For each candidate obstacle grid, based on the spatial distribution characteristics of the historical laser point cloud dataset corresponding to the candidate obstacle grid, the spatial fit between the current laser point cloud and each historical laser point cloud dataset is calculated, and the candidate obstacle grid with the best spatial fit is taken as the matching result. The matching result for each laser point is solved using a Gaussian function to obtain a matching quality score. The global similarity score is obtained by taking the arithmetic mean of all the matching quality scores.
6. The location loss detection method according to claim 1, characterized in that, The determination of the keyframe includes: Based on the acquisition time of the previous key frame, if the robot's running time interval is greater than or equal to the preset time interval, then the corresponding laser frame is taken as the key frame. Based on the robot pose corresponding to the previous keyframe, if the robot's displacement distance exceeds a preset distance, then the corresponding laser frame is used as the keyframe.
7. The location loss detection method according to claim 5, characterized in that, The calculation of the spatial fit between the current laser point and each of the historical laser point cloud datasets, and the selection of the candidate obstacle grid with the best spatial fit as the matching result, includes: Extract the historical laser point cloud dataset for each of the candidate obstacle grids; Based on the historical laser point cloud dataset, the reference center position of the corresponding candidate obstacle grid is determined, and the covariance characterization quantity, which characterizes the spatial distribution dispersion of the historical laser point cloud dataset, is calculated. The residual vector is determined based on the offset vector between the current laser point and the reference center position, and the covariance characterization. Perform norm operations on the residual vector to obtain a scalar value characterizing the spatial fitness. The candidate obstacle grid with the smallest scalar value is used as the matching result for the current laser point.
8. A location loss detection device, characterized in that, include: The dynamic grid map construction module is used to acquire environmental change feature points of the robot's environment and dynamically construct a dynamic grid map based on the environmental change feature points. The error distance mean determination module is used to perform nearest neighbor search for each laser point cloud in the current frame laser point cloud in the static point cloud map, calculate the first spatial distance corresponding to each laser point cloud in the current frame, and determine the error distance mean based on all the first spatial distances; A global raster map generation module is used to generate a global raster map by probabilistically fusing the dynamic raster map and the static point cloud map in response to the mean error distance being greater than a first preset threshold. The global similarity score calculation module is used to calculate the global similarity score between the current frame laser point cloud and the global grid map based on the global grid map; The positioning loss judgment module is used to determine whether the robot has lost its positioning based on the comparison result between the global similarity score and the second preset threshold.
9. A robot, characterized in that, The robot includes a processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement the location loss detection method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, It stores a computer program, which, when executed on a processor, implements the location loss detection method according to any one of claims 1-7.
