Fitting line segment correction method for grid map, robot and chip
By equipping the robot with a ranging sensor and using a rotation-fitting line segment method, the problem of obstacle angle offset caused by laser sensor sampling error and point cloud fitting error was solved, and more accurate map construction was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- AMICRO SEMICONDUCTOR CO LTD
- Filing Date
- 2022-03-23
- Publication Date
- 2026-06-09
AI Technical Summary
In a home environment, mobile robots equipped with laser sensors may experience angular offsets due to sampling errors of the laser sensors and errors in point cloud fitting calculations. This can lead to misalignment between the fitted line segments and obstacles in the actual environment, affecting the accuracy of map construction.
The robot is equipped with a ranging sensor, which performs linear fitting on the point cloud using a preset straight-line fitting rule. It selects the fitted line segment that meets the straightness feature and controls its rotation to be parallel to the reference line. At the same time, it updates the coordinates of the robot's current position, clears the old grid map information, and re-marks the coordinate information of the rotated fitted line segment and position point.
By rotating the fitted line segments and updating the position points, sampling and calculation errors are compensated for, ensuring that the fitted line segments are aligned with the actual obstacles, thereby improving the accuracy of map construction and visualization.
Smart Images

Figure CN116841284B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of line segment fitting, and in particular to a method for correcting line segments of a grid map constructed by a robot, as well as the robot and chip. Background Technology
[0002] In a home environment, mobile robots equipped with laser sensors (including 360-degree rotating LiDAR and fixed LiDAR) mark obstacles in the surrounding environment onto a map. Generally, fitted line segments are used to represent straight obstacles in the map. Straight obstacles include long and narrow obstacles (such as cabinets, stool legs, etc.) and straight obstacles (such as walls located at indoor boundary points). However, laser sensors carry noise errors during the point cloud acquisition process, and line segment fitting also has calculation errors. The combination of these two factors makes it difficult for the fitted line segments to align with long and narrow or straight obstacles in the actual environment, resulting in a small-angle offset. Consequently, the line segments marked during the subsequent map construction process will also deviate from the actual obstacles at an angle. Summary of the Invention
[0003] To overcome the sampling errors of laser sensors and the computational errors carried over during the process of fitting line segments from point clouds in existing technologies, this invention discloses a method for correcting fitted line segments of grid maps, a robot, and a chip. The specific technical solutions are as follows:
[0004] Regarding the method for correcting fitted line segments in a grid map, the robot is equipped with a ranging sensor, which is used to collect point clouds reflecting the areas occupied by obstacles. Both the robot's current position and the collected point clouds are converted into a grid map constructed by the robot, and environmental information is marked within the corresponding grid cells. The robot performs linear fitting on the point cloud using a preset straight-line fitting rule, and then selects a fitted line segment that conforms to the straightness characteristic from the fitted line segments, configuring this fitted line segment as the fitted line segment to be corrected. The fitted line segment correction method includes step 1: the robot controls the fitted line segment to be corrected to rotate until the rotated fitted line segment is parallel to the reference straight line direction; and the robot's current position is controlled to rotate so that the robot's current position... The relative position between the previous position point and the fitted line segment to be corrected remains unchanged before and after rotation; then the fitted line segment to be corrected after rotation is configured as the standard fitted line segment, and the coordinate information of the standard fitted line segment and the coordinate information of the current position point of the robot after rotation are saved; Step 2: Based on the coordinate information of the standard fitted line segment saved in Step 1, the robot marks all the grids that the standard fitted line segment passes through in the grid map as obstacle grids, and updates the coordinate information of the current position point of the robot after rotation saved in Step 1 to the coordinate information of the current position point of the robot; wherein, the coordinate information of the fitted line segment to be corrected before and after rotation, as well as the coordinate information of the current position point of the robot before and after rotation, are all coordinate information under the coordinate system of the grid map.
[0005] Furthermore, between step 1 and step 2, the method further includes: clearing all grid marker environmental information from the grid map constructed by the robot, so that the grid map described in step 2 is a cleared grid map.
[0006] Further, step 2 includes: in step 2, the robot marks all the grids that the standard fitted line segment passes through in the cleared grid map as obstacle grids; at the same time, according to the coordinate information of the current position point of the rotated robot, the robot marks the grid where the current position point of the rotated robot is located in the cleared grid map, so that the robot can start building a map at the latest grid where it is located.
[0007] Further, in step 1, the angle of rotation of the fitted line segment to be corrected and the angle of rotation of the robot's current position are both correction angles; the correction angle is the angle of offset of the fitted line segment to be corrected relative to the reference straight line direction, used to represent the degree of offset of the fitted line segment to be corrected relative to the straight obstacle; wherein, the reference straight line direction is the positive direction of the horizontal axis, the negative direction of the horizontal axis, the positive direction of the vertical axis, and the negative direction of the vertical axis of the grid map coordinate system, so that the obstacle grid marked in step 2 is distributed along the coordinate axis direction of the coordinate system.
[0008] Further, in step 1, the method for controlling the rotation of the fitted line segment to be corrected includes: controlling the fitted line segment to be corrected to rotate around the origin of the grid map's coordinate system by the correction angle in a preset rotation direction to obtain a standard fitted line segment, such that the rotated fitted line segment to be corrected is parallel to the reference line direction; wherein, the coordinate information of the points constituting the fitted line segment to be corrected is correspondingly transformed into the coordinate information of the points constituting the standard fitted line segment after rotation; in step 1, the method for controlling the rotation of the robot's current position point includes: controlling the robot's current position point to rotate around the origin of the grid map's coordinate system by the correction angle in a preset rotation direction to obtain the rotated robot's current position point; wherein, the relative position of the robot's current position point and the fitted line segment to be corrected is equivalent to: the relative position of the rotated robot's current position point and the standard fitted line segment; wherein, the preset rotation direction is clockwise or counterclockwise.
[0009] Furthermore, the method for controlling the rotation of the fitted line segment to be corrected includes controlling both endpoints of the fitted line segment to be corrected to rotate around the origin of the coordinate system of the grid map by the correction angle in a preset rotation direction, and then connecting the two endpoints after rotation to obtain a standard fitted line segment, such that the fitted line segment to be corrected after rotation is parallel to the direction of the reference line; wherein, the origin of the coordinate system of the grid map is the rotation center.
[0010] Furthermore, the obstacle grid marked in step 2 is used to describe straight obstacles in the actual physical environment, such that the outline of the straight obstacle in a specific direction is represented in the grid map by the projection of the fitted line segment to be corrected in the direction of the reference straight line.
[0011] Furthermore, the angle between a straight obstacle and the horizontal direction in the actual physical environment is equal to: the angle between the standard fitted line segment and the positive direction of the horizontal axis in the grid map, or the angle between the standard fitted line segment and the negative direction of the horizontal axis in the grid map; the angle between a straight obstacle and the vertical direction in the actual physical environment is equal to: the angle between the standard fitted line segment and the positive direction of the vertical axis in the grid map, or the angle between the standard fitted line segment and the negative direction of the vertical axis in the grid map.
[0012] Furthermore, when the straight obstacle is a wall in the indoor environment, the straight obstacle is parallel to or perpendicular to the robot's travel plane; when the straight obstacle is not a wall, the straight obstacle is located at a position parallel to or perpendicular to the wall of the indoor environment.
[0013] Further, in step 2, the method by which the robot marks all grids traversed by the standard fitted line segment in the grid map as obstacle grids based on the saved coordinate information of the standard fitted line segment includes the robot marking two points in the grid map cleared in step S2 after obtaining the coordinate information of the first and last endpoints of the standard fitted line segment saved in step 1, and marking all grids traversed by the line connecting the two points as obstacle grids; wherein, the coordinate information of the standard fitted line segment includes the coordinate information of the first and last endpoints of the standard fitted line segment, and the coordinate information includes the horizontal coordinate and the vertical coordinate.
[0014] Furthermore, when the ranging sensor is a laser sensor, when the laser sensor scans the surface of the obstacle, it obtains the sampling points fed back by the obstacle, and then controls the coordinate transformation of the sampling points into positioning points in the grid map. Among them, the points that form the standard fitted line segment or the points that form the fitted line segment to be corrected are positioning points; among them, the set of multiple sampling points is the point cloud; when each positioning point is located on the edge of the corresponding grid or inside the corresponding grid, the corresponding grid is configured as the grid where the positioning point is located.
[0015] Furthermore, in the grid map, the environmental information marked by the grid includes free state, occupied state, and unknown state. When the positioning point is a point that makes up the standard fitted line segment, the environmental information marked in the grid where the positioning point is located is updated to occupied state. Among them, the grid in the free state represents the location area not occupied by obstacles, and there are positioning points that support robot passage; the grid in the occupied state represents the location area occupied by obstacles, which constitute the occupied area of obstacles in the actual environment mapped to the map; the grid in the unknown state represents the location area that has not been scanned in the grid map constructed by the robot.
[0016] A robot includes a ranging sensor, an inertial sensor, and at least one processor and a computer program stored in the processor. The ranging sensor and the inertial sensor are both electrically connected to the processor. When the processor executes the computer program, it implements the fitted line segment correction method.
[0017] A chip storing a computer program, which is executed by a processor to implement the fitted line segment correction method.
[0018] This invention controls the fitted line segment to be corrected and the robot's current position point to rotate together. Without changing the relative positional relationship between the fitted line segment to be corrected and the robot's current position point, the rotated fitted line segment to be corrected is made parallel to the reference line direction. Then, all the grids that the rotated fitted line segment to be corrected passes through in the map coordinate system are marked as obstacle grids.
[0019] This invention corrects the original fitted line segments selected by the robot that were parallel to the coordinate axes in the grid map (corresponding to the vertical or horizontal directions in the actual environment) into standard fitted line segments that are parallel to the coordinate axes in the grid map. This compensates for related fitting calculation errors and sampling errors. Furthermore, the relative positional relationship between the fitted line segments to be corrected and the robot's current position remains unchanged before and after the rotation, thereby ensuring the accuracy of the robot's map construction. It also enables the use of straight fitted line segments to represent straight obstacles in the actual environment, reducing the offset angle error of the fitted line segments used to fit walls relative to the walls in the actual environment. Attached Figure Description
[0020] Figure 1 This is a flowchart of a method for correcting line segments in a raster map, as disclosed in an embodiment of the present invention. Detailed Implementation
[0021] The technical solutions of the present invention will now be described in detail with reference to the accompanying drawings.
[0022] This invention provides a method for fitting line segments to a grid map that can be applied to robots equipped with ranging sensors, especially mobile robots operating in indoor environments, such as sweeping robots, window cleaning robots, inspection robots, and unmanned sampling robots. The mobile robot includes a robot body, sensors, a controller, and a locomotion mechanism. The robot body is the main structure of the robot and can be selected according to the robot's actual needs, using appropriate shapes, structures, and manufacturing materials (such as rigid plastics or metals like aluminum and iron). For example, it can be a relatively flat cylindrical shape commonly found in sweeping robots. The locomotion mechanism, located on the robot body, is a structural device that provides the mobile robot with mobility. This locomotion mechanism can be implemented using any type of mobile device, such as rollers or tracks. The ranging sensor scans the external environment and obtains depth information of the surrounding environment (e.g., a two-dimensional point cloud map of the robot's surroundings) based on information fed back from the surface of external obstacles. The ranging sensor can be any type of existing depth information acquisition device, including but not limited to laser sensors and depth cameras. One or more ranging sensors can be used to meet an omnidirectional detection range of 0 to 360 degrees.
[0023] Taking a robotic vacuum cleaner as an example, the main body of the robotic vacuum cleaner includes a front part and a rear part, with an approximately circular shape (both front and rear are circular), but it can also have other shapes, including but not limited to an approximately D-shaped shape with a circular front and rear, or a rectangular or square shape with a circular front and rear. A controller is installed inside the robotic vacuum cleaner's body, and a drive wheel is installed on each of the left and right sides. A laser sensor is installed on the top of the robotic vacuum cleaner's body as a ranging sensor. This can be a 360-degree rotating LiDAR or a fixed LiDAR, or a triangulation laser sensor or a TOF laser sensor, serving as a sampling device for the robot to build maps and locate itself. The controller is electrically connected to the drive wheels and the laser sensor. The controller controls the movement of the drive wheels; the controller controls the 360-degree rotating LiDAR to scan a circle, or the robot drives the fixed LiDAR to rotate, to measure the distance between the robot and obstacles, generating a point cloud reflecting the contours of the area occupied by the obstacles; the controller reads the LiDAR data and generates an indoor map using a SLAM algorithm, i.e., constructing a grid map.
[0024] In this embodiment, the controller is integrated into the electronic computing core of the robot body and is used to execute the fitted line segment correction method to achieve intelligent control of the robot. The controller is connected to a ranging sensor to collect point clouds reflecting the contours of the area occupied by obstacles. Then, based on the principle of triangulation or other positioning algorithms or the fitted line segments obtained from the point cloud, the current position of the robot is calculated. A preset algorithm is executed to construct a map to obtain a map image. The controller controls the current position of the robot and the collected point cloud to be converted into a grid map constructed by the robot, and environmental information is marked in the corresponding grid.
[0025] It should be noted that the sensors are used to perceive the external environment and obtain the robot's own coordinate and angle information to form the robot's pose information. The sensors can be any type of existing information acquisition device, including but not limited to odometers for measuring walking distance, gyroscopes for measuring the robot's rotation angle, infrared sensors for distance measurement, or visual sensors for distance measurement. The robot converts the information fed back from these sensors into position information and marks it on a real-time constructed map. One or more sensors can be used to meet the detection range of multiple angles.
[0026] It should be noted that the environment map formed by point clouds needs to be divided according to a pre-defined grid size to obtain a raster map, which consists of multiple grids. For example, dividing the environment map into 0.2*0.2m squares will result in a raster map with a grid size of 0.2*0.2m.
[0027] Before the robot executes the fitted line segment correction method, the robot performs linear fitting on the point cloud using preset straight line fitting rules, then selects a fitted line segment that conforms to the straightness feature from the fitted line segments, and configures this fitted line segment as the fitted line segment to be corrected. Optionally, after obtaining one of the fitted line segments to be corrected, the robot starts executing the fitted line segment correction method to correct the fitted line segment. The fitted line segment that conforms to the straightness feature is, without considering sampling error and fitting calculation error, a horizontal or vertical fitted line. However, due to sampling noise from the ranging sensor and calculation errors in the actual implementation, the fitted line segment that conforms to the straightness feature may deviate angularly from the vertical, horizontal, or other specific straight line directions in the actual environment, requiring correction to avoid affecting the map's visualization effect.
[0028] For point clouds or pixels collected by ranging sensors, the robot can perform linear fitting (equivalent to straight line fitting) on them using preset straight line fitting rules, fitting multiple fitted line segments. For example, preset straight line fitting rules include, but are not limited to, the Random Access Scale (RANSAC) algorithm, the Hough Transform, and the least squares method. By finding point clouds or pixels that are approximately on a straight line and defining the first and last points, the robot can obtain fitted line segments. The first and last points correspond to the first and last pixels of the fitted line segment. The fitted line segment can be regarded as a set of line segment points, which can be marked on a map or exist in the form of three-dimensional spatial points.
[0029] In some implementations, if the robot uses a laser sensor for ranging, including a 360-degree rotating lidar and a fixed lidar, the laser data points in each batch of point clouds collected by the laser sensor can be linearly fitted using a line segment. This allows for the extraction of obstacle geometric features needed for the environmental map and can also serve as a reference line segment to assist in calculating the robot's actual position information. Specifically, the N fitted line segments obtained using the aforementioned preset straight line fitting rules can be, but are not limited to, straight lines fitted using only the optimal data calculated from the mean of the laser point cloud data combined with the least squares method, or straight lines fitted using all laser point cloud data from a specified group combined with the least squares method, where N is an integer greater than or equal to 1. The optimal data in the laser point cloud data refers to laser point cloud data that conforms to the preset optimal selection rules. The preset optimal selection rules can be, but are not limited to, rules used to select laser point cloud data that fit smoother, straighter fitted line segments. The optimal selection rules can be adjusted according to the actual application scenario or the actual robot model.
[0030] The specific method for selecting the most straight line segment from the fitted line segments includes:
[0031] Step A1: After the robot fits N fitted line segments using the preset straight line fitting rules, it selects one of the fitted line segments as the current reference edge and obtains the length ln of the current reference edge, and then proceeds to step A2.
[0032] Step A2: Project the remaining N-1 fitted line segments onto the extension direction of the current reference edge to obtain N-1 first projection values corresponding to the remaining N-1 fitted line segments; then project the remaining N-1 fitted line segments onto the direction at a 90-degree angle to the current reference edge to obtain N-1 second projection values corresponding to the remaining N-1 fitted line segments, and then proceed to step A3.
[0033] Step A3: Take the larger of the first and second projection values corresponding to the same fitted line segment and multiply it by the first preset parameter as the third projection value of the fitted line segment. Obtain the N-1 third projection values corresponding to the remaining N-1 fitted line segments, and then proceed to step A4. The first preset parameter is an adjustable parameter based on the actual environment and the actual robot model.
[0034] Step A4: Calculate the sum of the current reference edge length and the N-1 third projection values corresponding to the remaining N-1 fitted line segments, and take the sum of the current reference edge length and the N-1 third projection values corresponding to the remaining N-1 fitted line segments as the total length of the fitted line segment corresponding to the current reference edge. Then, determine the total length of the fitted line segment corresponding to a fitted line segment; then proceed to step A5.
[0035] Step A5: Determine whether the total length of the N fitted line segments corresponding to the N fitted line segments has been obtained. If yes, proceed to step A6; otherwise, return to step A1.
[0036] Step A6: Select the fitting line segment corresponding to the maximum value among the N fitting line segments as the fitting line segment that meets the straightness characteristic, that is, the fitting line segment that is most likely to be parallel to the wall, that is, the fitting line segment that makes the angle with the wall in the actual environment closest to 0 degrees or 180 degrees.
[0037] Specifically, in the process of selecting the fitting line segment with the most straight characteristics, the first preset parameter used in step A3 and the fitting line segment corresponding to the maximum value among the total lengths of N fitting line segments selected in step A6 can be adjusted according to the actual application scenario and the actual robot model. For example, the value of the first preset parameter can be modified, or the minimum or median value among the total lengths of N fitting line segments can be selected to flexibly adapt to various scenarios and needs.
[0038] It is worth noting that during the sampling of point clouds by the ranging sensor, due to factors such as bumps during robot movement or errors in the sensor's observation perspective, the sampled raw points will contain a considerable amount of noise. This noise will interfere with the true value, resulting in a lower accuracy of the fitted line. In addition, sudden events such as environmental changes, occlusion, and positioning deviations can affect the linear fitting calculation of the laser point cloud data. Therefore, in this embodiment, the fitted line segment that meets the straightness characteristic selected in step A6 is configured as the fitted line segment to be corrected, and then the fitted line segment correction method is executed.
[0039] As one example, see Figure 1 It can be seen that the fitting line segment correction method includes:
[0040] Step S1: The robot controls the line segment to be corrected to rotate until the rotated line segment is parallel to the reference line; and controls the robot's current position to rotate so that the relative position between the line segment to be corrected and the robot's current position remains unchanged before and after the rotation; then, the rotated line segment to be corrected is configured as the standard line segment, and the coordinate information of the standard line segment and the coordinate information of the rotated robot's current position are saved; it should be noted that the line segment to be corrected and the robot's current position can rotate synchronously or sequentially, but both choose the same rotation center and rotate in the same direction by the same angle. In the process, the fitted line segment to be corrected is rotated until it is parallel to the direction of the reference line. When the relative position between the robot's current position and the fitted line segment to be corrected is configured as a preset relative position, the rotation of the robot's current position is maintained until the relative position between the robot's current position and the standard fitted line segment after rotation is the preset relative position. This ensures that the relative position between the robot's current position and the fitted line segment to be corrected remains unchanged before and after rotation. In other words, the relative position relationship between the fitted line segment to be corrected before rotation and the robot's current position before rotation is equivalent to the relative position relationship between the fitted line segment to be corrected after rotation according to the correction angle and the robot's current position after rotation according to the correction angle.
[0041] It is worth noting that the coordinates of the standard fitted line segment and the coordinates of the robot's current position after rotation are saved in the robot's internal storage space, but this is different from the storage space for the grid map built by the robot. The storage space storing the coordinates of the standard fitted line segment and the robot's current position after rotation is different from the storage space storing the map built by the robot in real-time; their read, write, and refresh operations can be independent. When the map built by the robot in real-time is cleared and updated, the coordinates of the standard fitted line segment and the robot's current position after rotation are not modified. The robot's internal storage space includes, but is not limited to, hard drives, flash memory, and random access memory.
[0042] After the robot performs step S1, it marks all the grids traversed by the standard fitted line segment in the grid map as obstacle grids, based on the coordinate information of the standard fitted line segment saved in step S1. It also updates the coordinate information of the robot's current position after rotation. The coordinate information of the fitted line segment to be corrected before and after rotation, as well as the coordinate information of the robot's current position before and after rotation, all belong to the coordinate system of the grid map. The coordinate information is preferably the horizontal and vertical coordinates, and also preferably the horizontal coordinate, vertical coordinate, and deflection angle (the deviation angle relative to a specific coordinate axis). In this embodiment, the grid map used for grid marking can be a map with cleared marking information or a grid map that retains the original environmental information. To improve the visualization effect of the map and reduce the interference of noise information, it is necessary to re-mark the grids on a grid map with cleared marking information, thus proceeding from step S1 to step S2. The marking information includes environmental information.
[0043] Step S2: Clear the environmental information of all grid markers in the grid map constructed by the robot; then proceed to step S3. It should be noted that in the grid map, the environmental information of grid markers includes free state, occupied state, and unknown state; free state grids represent location areas not occupied by obstacles, containing positioning points that allow robot passage; occupied state grids represent location areas occupied by obstacles, forming the occupied areas mapped from the actual environment to the map; unknown state grids represent location areas not scanned in the grid map constructed by the robot. In some embodiments, the environmental information of grid markers also includes pose information carried by the point cloud falling into the grid, including distance and angle information of the corresponding points, representing the position information that can be updated to the corresponding grid in the grid map, used to match the robot's real-time pose information.
[0044] Step S3: Based on the coordinate information of the standard fitted line segment saved in step S1, including the coordinate information or angle information of the points that make up the standard fitted line segment (the tilt angle information of the standard fitted line segment), the robot marks all the grids that the standard fitted line segment passes through in the grid map cleared in step S2 as obstacle grids. Correspondingly, the grids in the grid map where the points that make up the standard fitted line segment are located are marked as obstacle grids. The coordinate information of the standard fitted line segment or the points that make up the standard fitted line segment are read from the storage space, and then the grids in the grid map where the points with the same coordinate information are located are forcibly marked according to the read coordinate information, and the corresponding grids are marked as obstacle grids. Simultaneously, the coordinate information of the robot's current position after rotation, saved in step S1, is updated to the coordinate information of the robot's current position. The grid where the robot is located on the grid map cleared in step S2 is marked. Specifically, the coordinate information of the robot's current position after rotation is read from the corresponding storage space. Then, according to the read coordinate information, the grid where the point with the same coordinate information is located in the grid map is forcibly marked and updated to the grid position currently occupied by the robot. The coordinate information of the corresponding grid is updated to the coordinate information of the robot's current position. Under the premise of keeping the relative position with the fitted line segment to be corrected before and after rotation unchanged, the map is built at the latest grid where the robot is located. This makes the subsequent map building subject to the constraints of these newly marked obstacle grids, so that the straight obstacles described by the map can be straight.
[0045] It should be noted that the coordinate information of the fitted line segment to be corrected before and after rotation, as well as the coordinate information of the robot's current position before and after rotation, both belong to the coordinate system of the grid map. Therefore, the points that make up the standard fitted line segment and the robot's current position after rotation can both be coordinate points with the same coordinate information in the grid map. The robot's current position after rotation is the position point defined by the robot's body center point, and thus can be represented by a single grid.
[0046] Combining steps S1 to S3 above, the robot's fitted line segment to be corrected and the robot's current position point are rotated together. Without changing the relative positional relationship between the fitted line segment to be corrected and the robot's current position point, the rotated fitted line segment to be corrected is made parallel to the reference straight line direction. Then, all the grids that the rotated fitted line segment to be corrected passes through in the map coordinate system are marked as obstacle grids. Thus, the obstacle grids marked on the grid map can be distributed along the straight line direction, realizing the description of straight obstacles in the actual environment with straight fitted line segments, compensating for the sampling error of the laser sensor in the prior art and the calculation error carried in the process of fitting line segments from point clouds.
[0047] In one embodiment, in step S1, the rotation angle of the fitted line segment to be corrected and the rotation angle of the robot's current position are both correction angles. The correction angle is the angle of offset of the fitted line segment to be corrected relative to the reference straight line direction, used to represent the degree of offset of the fitted line segment to be corrected relative to the straight obstacle. It can also represent the degree of offset of the fitted line segment to be corrected relative to the contour of the straight obstacle. This offset may be introduced by the shaking or swaying of the ranging sensor mounted on the robot. In some embodiments, the reference straight line direction is the positive direction of the horizontal axis, the negative direction of the horizontal axis, the positive direction of the vertical axis, and the negative direction of the vertical axis of the grid map's coordinate system. The grid map's coordinate system can be a planar coordinate system, so the fitted line segment to be corrected and the robot's current position can be synchronously rotated and corrected within the same map plane according to the correction angle. Therefore, in this embodiment, the straight obstacle is set vertically or horizontally in an indoor environment, and the standard fitted line segment can coincide with or be parallel to the coordinate axes, so that the obstacle grid marked in step S3 is distributed along the coordinate axis direction of the coordinate system, which can characterize the straightness of the map constructed by the robot.
[0048] As one embodiment, in step S1, the method of controlling the rotation of the fitted line segment to be corrected includes: controlling the fitted line segment to be corrected to rotate around the origin of the coordinate system of the grid map and in a preset rotation direction by the correction angle to obtain a standard fitted line segment, wherein the origin of the coordinate system of the grid map is the rotation center, the fitted line segment to be corrected is rotated around the origin of the coordinate system of the grid map and in a preset rotation direction by the correction angle to become a standard fitted line segment, and the fitted line segment to be corrected after rotation is parallel to the direction of the reference line; the coordinate information of the points that make up the fitted line segment to be corrected is correspondingly transformed into the coordinate information of the points that make up the standard fitted line segment after rotation, and the angular offset generated by the angular information of each point is equal to the correction angle. In step S1, the method for controlling the rotation of the robot's current position includes controlling the robot's current position to rotate around the origin of the grid map's coordinate system by the correction angle in a preset rotation direction to obtain the rotated robot's current position. Here, the origin of the grid map's coordinate system is the rotation center. After rotating around the origin of the grid map's coordinate system by the correction angle in the preset rotation direction, the robot's current position becomes a new position. The relative position of this new position relative to the standard fitted line segment is equivalent to the relative position between the robot's current position and the fitted line segment to be corrected, including relative distance information and relative angle information. It should be noted that the preset rotation direction is essentially a clockwise direction, which can be either clockwise or counterclockwise.
[0049] As one embodiment, the method for controlling the rotation of the fitted line segment to be corrected includes: controlling the two endpoints of the fitted line segment to be corrected to rotate around the origin of the grid map's coordinate system in the grid map by the correction angle in a preset rotation direction, so that the two endpoints of the fitted line segment to be corrected become the two endpoints of the standard fitted line segment after rotation, and then connecting the two endpoints after rotation to form the standard fitted line segment, thereby correcting the fitted line segment to be corrected into the standard fitted line segment, so that the fitted line segment to be corrected after rotation is parallel to the direction of the reference line. In this way, the robot only needs to control the coordinate information of the two endpoints of the fitted line segment to be corrected to be transformed into the coordinate information of the two endpoints of the standard fitted line segment after rotation, reducing the amount of computation.
[0050] As one embodiment, in step S3, the method by which the robot marks all grids traversed by the standard fitted line segment in the grid map as obstacle grids based on the saved coordinate information of the standard fitted line segment includes: after obtaining the coordinate information of the first and last endpoints of the standard fitted line segment saved in step S1, the robot only reads the coordinate information of these two endpoints from the corresponding storage space, marks two points with the same coordinate information in the grid map cleared in step S2 based on the read coordinate information, connects these two points to form a line segment, and marks all grids traversed by the line connecting the two points as obstacle grids; it should be noted that the coordinate information of the standard fitted line segment saved in step S1 includes the coordinate information of the first and last endpoints of the standard fitted line segment, and the coordinate information includes the horizontal coordinate and the vertical coordinate, which is suitable for marking and identifying all grids traversed by the standard fitted line segment on the planar coordinate system of the grid map. Thus, only the coordinate information of the first and last endpoints is needed to determine all grids traversed by the standard fitted line segment in the grid map and mark their environmental information, reducing computational overhead and introducing computational errors.
[0051] As one embodiment, the obstacle grid marked in step S3 is used to describe the outline of straight obstacles in the actual physical environment in the grid map, such that the outline of the straight obstacle in a specific direction is represented in the grid map by the projection of the fitted line segment to be corrected in the direction of the reference line. The projected line segment of the fitted line segment to be corrected in the direction of the reference line is equivalent to the standard fitted line segment. Straight obstacles include elongated obstacles (such as cabinets, stool legs, etc.) and straight obstacles (such as walls located at boundary points indoors). The obstacle grid is the outline boundary grid of the obstacle, filled with a certain gray value; for example, a gray value of 0 indicates that the corresponding position is marked as occupied by an obstacle and belongs to the edge of the obstacle. This embodiment uses fitted line segments parallel to the coordinate axes in the grid map to describe straight obstacles, enabling straight obstacles to serve as positioning references and improving the flatness of the map constructed by the robot.
[0052] Specifically, the angle formed by a straight obstacle or its outline relative to the horizontal direction in the actual physical environment is equal to: the angle between the standard fitted line segment and the positive direction of the horizontal axis in the grid map, or the angle between the line connecting the points constituting the standard fitted line segment and the positive direction of the horizontal axis in the grid map; the angle between the standard fitted line segment and the negative direction of the horizontal axis in the grid map, or the angle between the line connecting the points constituting the standard fitted line segment and the negative direction of the horizontal axis in the grid map. In some embodiments, the standard fitted line segment is not described in the grid map, but is marked in the grid map as a set of points. Similarly, the angle between a straight obstacle or its outline and the vertical direction in the actual physical environment is equal to: the angle between the standard fitted line segment and the positive direction of the vertical axis in the grid map, or the angle between the line connecting the points that make up the standard fitted line segment and the positive direction of the vertical axis in the grid map; the angle between the standard fitted line segment and the negative direction of the vertical axis in the grid map, or the angle between the line connecting the points that make up the standard fitted line segment and the negative direction of the vertical axis in the grid map. In some embodiments, the standard fitted line segment is not described in the grid map, but is marked in the grid map as a set of points.
[0053] Preferably, when the straight obstacle is a wall in the indoor environment, the straight obstacle is parallel to or perpendicular to the robot's travel plane; when the straight obstacle is not a wall, the straight obstacle is located parallel to or perpendicular to the wall in the indoor environment, including straight obstacles such as cabinets, table legs, and stool legs. Therefore, in some embodiments, a planar coordinate system can be established with the axial direction of the obstacle outline as the horizontal axis and the radial direction of the obstacle outline as the vertical axis, which is equivalent to the coordinate system of a grid map.
[0054] In summary, during the process of fitting line segments representing obstacle contours from point clouds collected by ranging sensors, the robot rotates these line segments to be parallel to the coordinate axes, obtaining horizontal or vertical fitted line segments. The robot then updates its current position using the same transformation relationship to improve map flatness and facilitate accurate identification of wall lines within the grid map. In some embodiments, wall lines are equivalent to the lines connecting the points forming the standard fitted line segments in the grid map. In this embodiment, these wall lines reflect the positions of various walls in the indoor environment. The parallelism of the wall lines marked in the grid map to the horizontal or vertical directions reflects the flatness of the obstacle description in the grid map, and the parallelism of each wall line in the grid map to the coordinate axes reflects the flatness of the map constructed by the robot.
[0055] As one embodiment, when the ranging sensor is a laser sensor, it includes a fixed laser sensor and a rotatable lidar. When the laser sensor scans the surface of an obstacle, it acquires each sampling point fed back by the obstacle, and then controls the coordinate transformation of the sampling point to a positioning point in the grid map. Each positioning point is located on the edge of the corresponding grid or inside the grid to reflect the position information of the scanned obstacle, that is, the position of the feature point reflected from the surface of the scanned object is converted into coordinate information in the grid map; wherein, the grid is the grid where the positioning point is located or the grid where the positioning point is located; in this embodiment, the points that make up the standard fitted line segment or the points that make up the fitted line segment to be corrected are positioning points.
[0056] The collection of multiple sampling points is the point cloud. Specifically, the laser sensor uses a laser beam to scan the obstacle by angle. Each angle corresponds to a laser point, and the laser points of all the angles used are added together to form a point cloud frame.
[0057] The sampling points obtained by the robot from different sensing angle ranges can all undergo coordinate transformation (from the laser coordinate system to the grid map coordinate system) to be uniformly transformed into a map coordinate system, thereby describing the scanned obstacles in the grid map. This ensures that each fitted line segment can reflect the corresponding coordinate information in the grid map and is represented by a specific set of positioning points.
[0058] Preferably, in the coordinate system of the grid map, the coordinates of each grid cell are represented by the coordinates of its lower left corner. The coordinates of the lower left corner of the grid cell represent its row and column numbers in the grid map, with the horizontal coordinate equal to the column number and the vertical coordinate equal to the row number. In some embodiments, the grid is traversed from left to right along the horizontal axis, with the column number increasing progressively; and from bottom to top along the vertical axis, the grid is traversed with the row number increasing progressively. This ensures that the grid areas of the straight obstacles marked by connecting each grid cell within the grid map are straight and continuous.
[0059] As one embodiment, in the grid map, the environmental information marked by the grid includes free state, occupied state, and unknown state. When the positioning point is a point that makes up the standard fitted line segment, that is, the coordinate information of the standard fitted line segment includes the coordinate information of the positioning point, the environmental information marked in the grid where the positioning point is located is updated to occupied state. If the grid where the positioning point is located originally marked with environmental information, it is forcibly updated to occupied state, becoming an obstacle grid and part of the straight obstacle. In the subsequent mapping and positioning, the point cloud of straight obstacles such as walls will match or move closer to the grid of this type of obstacle, thereby compensating for the acquisition error and fitting calculation error when fitting the straight line.
[0060] It should be noted that free-state grids represent areas not occupied by obstacles, containing location points that allow the robot to pass; occupied grids represent areas occupied by obstacles, forming the occupied areas mapped from the actual environment to the map; unknown grids represent areas not scanned in the grid map constructed by the robot. Based on this, the previously constructed grid map can be updated in a timely manner, including updating the coordinate position information, angle information, and obstacle occupancy probability information of relevant grids. This reflects the straight obstacles actually detected by the robot in a more linear way, making wall outlines appear straighter on the map and improving the map's visualization.
[0061] It should be noted that for a fixed obstacle being scanned, the laser sensor can be moved to acquire as much surface point information as possible. When a laser beam illuminates the surface of the scanned object, the reflected laser information carries information such as orientation and distance. Combining laser measurement and photogrammetry principles, a point cloud is obtained, including coordinates (XY), laser reflection intensity, and color information (RGB). Specifically, after acquiring the spatial coordinates of each sampling point on the surface of the scanned object, the laser sensor obtains a set of points, called a point cloud, making the point cloud a massive collection of points representing the surface characteristics of the target.
[0062] It should be noted that the laser information reflected from the scanned object, collected by the laser sensor, is converted into coordinate points on the grid map. These laser points are laser scanning points or laser sampling points, reflecting positional information (including the detection distance and angle to the surface of the scanned object) and laser reflection intensity. Specifically, if the laser sensor scans the object with a laser beam along a certain trajectory, it records the reflected laser point information while scanning. Due to the extremely fine scanning, a large number of laser points can be obtained, thus forming a laser point cloud. The laser sensor is generally a lidar that supports 360-degree rotation scanning, equipped with a laser emitting probe and a receiving probe. Specifically, the laser information reflected from the scanned object collected by the laser sensor includes lidar data packets, which contain several frames of laser point cloud data. Each frame of laser point cloud data includes several laser points, and each laser point contains an angle (counter-clockwise is the positive direction) and a distance. Therefore, the pose information carried by the positioning point is used to update the position information of its grid. The pose information carried by the positioning point, including angle and distance information, originates from the sampling points.
[0063] This invention discloses a robot, including a ranging sensor, an inertial sensor, and at least one processor and a computer program stored in the processor. The ranging sensor and the inertial sensor are both electrically connected to the processor. When the processor executes the computer program, it implements the fitting line segment correction method described in any of the preceding embodiments, thereby ensuring the accuracy of the robot's map construction and enabling the use of straight fitting line segments to represent straight obstacles in the actual environment, reducing the offset angle error of the fitting line segments used to fit walls relative to the walls in the actual environment.
[0064] Inertial sensors are devices that respond to physical motion, such as linear displacement or angular rotation, and convert this response into electrical signals, which are then amplified and processed by electronic circuits. Inertial sensors include encoders, accelerometers, and gyroscopes; accelerometers are sensors that sense axial acceleration and convert it into a usable output signal; gyroscopes are sensors that sense the angular velocity of a moving body relative to inertial space. The encoder, accelerometer, and gyroscope together form an inertial navigation system, enabling autonomous navigation that does not rely on external information or radiate energy externally. However, in this embodiment, point cloud information sampled from an external source by a ranging sensor is required. This information can be converted to the same navigation coordinate system to assist in map construction.
[0065] In some embodiments, collision sensors and proximity sensors are disposed on the forward part of the robot's main body, cliff sensors are disposed on the lower part of the robot body, and sensors such as controllers, magnetometers, accelerometers, gyroscopes, odographs (ODOs) installed inside the drive wheels, and drop sensors installed in slots connecting the left and right drive wheels to the chassis of the robot body are disposed inside the robot body. These sensors are used to provide the processor with various position and motion state information of the robot. The processor can manipulate the robot to traverse different types of terrain based on drive commands with distance and angle information (e.g., x, y, and z components). The processor includes a drive wheel module that can simultaneously control the left and right drive wheels. For more precise control of the robot's movement, preferably, the drive wheel module includes a left drive wheel module and a right drive wheel module, which are symmetrically arranged along a lateral axis defined by the robot body. To enable the robot to move more stably or with greater mobility on the ground, the robot may include one or more driven wheels, including but not limited to omnidirectional wheels for changing direction. The drive wheel module includes a drive wheel, a drive motor, and a control circuit for controlling the drive motor. The drive wheel module can also be connected to a circuit for measuring the drive current, an odometer, and a gyroscope to enable continuous map building.
[0066] This invention also discloses a chip storing a computer program. When the computer program is run by a processor, it implements the fitting line segment correction method described in any of the foregoing embodiments. This method corrects the fitting line segments selected by the robot that were originally parallel to the coordinate axis directions in the grid map (corresponding to the vertical or horizontal directions in the actual environment) to standard fitting line segments parallel to the coordinate axis directions in the grid map. This compensates for related fitting calculation errors and sampling errors. Furthermore, the relative positional relationship between the fitting line segments to be corrected and the robot's current position remains unchanged before and after the rotation, thereby ensuring the accuracy of the robot's map construction. It also enables the use of straight fitting line segments to represent straight obstacles in the actual environment, reducing the offset angle error of the fitting line segments used to fit walls relative to the walls in the actual environment.
[0067] The chip is located on the circuit board inside the robot's body and includes a computing processor, such as a central processing unit or application processor, that communicates with non-transitory memory, such as a hard disk, flash memory, or random access memory. The application processor executes a mapping algorithm, such as Simultaneous Localization and Mapping (SLAM), based on obstacle information fed back by the laser sensor and the corrected standard fitted line segments, to draw a real-time map of the robot's environment and mark the locations of obstacles.
[0068] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0069] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0070] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device 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 terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
Claims
1. Regarding the method for fitting line segments to correct grid maps, the robot is equipped with a ranging sensor, which is used to collect point clouds reflecting the areas occupied by obstacles; among which, The robot's current location and the collected point cloud are converted into a grid map constructed by the robot, and environmental information is marked in the corresponding grid. The robot uses a preset straight line fitting rule to perform linear fitting on the point cloud, then selects the fitting line segment that meets the straightness feature from the fitted line segments, and configures the fitted line segment as the fitting line segment to be corrected. The method for correcting the fitted line segment is characterized by comprising: Step 1: The robot controls the fitted line segment to be corrected to rotate until the rotated fitted line segment is parallel to the reference line direction; and controls the robot's current position point to rotate so that the relative position between the robot's current position point and the fitted line segment to be corrected remains unchanged before and after the rotation; then configure the fitted line segment to be corrected after rotation as the standard fitted line segment, and save the coordinate information of the standard fitted line segment and the coordinate information of the robot's current position point after rotation. Step 2: Based on the coordinate information of the standard fitted line segment saved in Step 1, the robot marks all the grids that the standard fitted line segment passes through in the grid map as obstacle grids, and updates the coordinate information of the robot's current position after rotation saved in Step 1 to the coordinate information of the robot's current position. Among them, the coordinate information of the fitted line segment to be corrected before and after rotation, as well as the coordinate information of the robot's current position before and after rotation, all belong to the coordinate information under the grid map coordinate system.
2. The fitting line segment correction method according to claim 1, characterized in that, Between step 1 and step 2, the method further includes: clearing all environmental information of grid markers in the grid map constructed by the robot, so that the grid map described in step 2 is a cleared grid map.
3. The fitting line segment correction method according to claim 2, characterized in that, Step 2 includes: in step 2, the robot marks all the grids that the standard fitted line segment passes through in the cleared grid map as obstacle grids; at the same time, according to the coordinate information of the robot's current position after rotation, the robot marks the grid where the robot's current position is located in the cleared grid map, so that the robot can start building a map at the latest grid where it is located.
4. The fitting line segment correction method according to claim 1, characterized in that, In step 1, the angle of rotation of the fitted line segment to be corrected and the angle of rotation of the robot's current position are both correction angles; The correction angle is the angle by which the fitted line segment to be corrected deviates from the direction of the reference straight line, and is used to indicate the degree of deviation of the fitted line segment to be corrected relative to the straight obstacle. The reference straight line direction is the positive direction of the horizontal axis, the negative direction of the horizontal axis, the positive direction of the vertical axis, and the negative direction of the vertical axis of the coordinate system of the grid map, so that the obstacle grid marked in step 2 is distributed along the coordinate axis direction of the coordinate system.
5. The fitting line segment correction method according to claim 4, characterized in that, In step 1, the method of controlling the rotation of the fitted line segment to be corrected includes: controlling the fitted line segment to be corrected to rotate around the origin of the coordinate system of the raster map by the correction angle in a preset rotation direction to obtain a standard fitted line segment, so that the fitted line segment to be corrected after rotation is parallel to the direction of the reference line; wherein, the coordinate information of the points that make up the fitted line segment to be corrected is transformed into the coordinate information of the points that make up the standard fitted line segment after rotation. In step 1, the method of controlling the robot's current position point to rotate includes: controlling the robot's current position point to rotate around the origin of the grid map's coordinate system by the correction angle in a preset rotation direction to obtain the rotated robot's current position point; The relative position of the robot's current position and the fitted line segment to be corrected is equivalent to the relative position of the robot's current position and the standard fitted line segment after rotation. The preset rotation direction is either clockwise or counterclockwise.
6. The fitting line segment correction method according to claim 5, characterized in that, The method for controlling the rotation of the fitted line segment to be corrected includes: The two endpoints of the fitted line segment to be corrected are rotated around the origin of the coordinate system of the grid map by the correction angle in the preset rotation direction. Then the two endpoints after rotation are connected to obtain the standard fitted line segment, so that the fitted line segment to be corrected after rotation is parallel to the reference line direction. In this case, the origin of the coordinate system of the raster map is the center of rotation.
7. The fitting line segment correction method according to claim 4, characterized in that, The obstacle grid marked in step 2 is used to describe straight obstacles in the actual physical environment, such that the outline of the straight obstacle in a specific direction is represented in the grid map by the projection of the fitted line segment to be corrected in the direction of the reference straight line.
8. The fitting line segment correction method according to claim 7, characterized in that, The angle between a straight obstacle and the horizontal direction in the actual physical environment is equal to: the angle between the standard fitted line segment and the positive direction of the horizontal axis in the grid map, or the angle between the standard fitted line segment and the negative direction of the horizontal axis in the grid map. The angle between a straight obstacle and the vertical direction in the actual physical environment is equal to: the angle between the standard fitted line segment and the positive direction of the vertical axis in the grid map, or the angle between the standard fitted line segment and the negative direction of the vertical axis in the grid map.
9. The fitting line segment correction method according to claim 7, characterized in that, When the straight obstacle is a wall in an indoor environment, the straight obstacle is either parallel to or perpendicular to the robot's travel plane. When a straight obstacle is not a wall, it is located parallel or perpendicular to the walls of the interior environment.
10. The fitting line segment correction method according to claim 1, characterized in that, In step 2, the method by which the robot marks all the grids traversed by the standard fitted line segment in the grid map as obstacle grids based on the saved coordinate information of the standard fitted line segment includes: After obtaining the coordinate information of the first and last two endpoints of the standard fitted line segment saved in step 1, the robot marks two points in the grid map cleared in step S2, and marks all the grids through which the line connecting the two points passes as obstacle grids. The coordinate information of the standard fitted line segment includes the coordinate information of the first and last endpoints of the standard fitted line segment, and the coordinate information includes the horizontal coordinate and the vertical coordinate.
11. The fitting line segment correction method according to claim 1, characterized in that, When the ranging sensor is a laser sensor, when the laser sensor scans the surface of the obstacle, it obtains the sampling points fed back by the obstacle, and then controls the transformation of the coordinates of the sampling points into the positioning points in the grid map. Among them, the points that form the standard fitting line segment or the points that form the fitting line segment to be corrected are the positioning points; and the set of multiple sampling points is the point cloud. When a location point is located on the edge of a corresponding grid or inside a corresponding grid, the corresponding grid is configured as the grid in which the location point is located.
12. The fitting line segment correction method according to claim 11, characterized in that, In the grid map, the environmental information of the grid markers includes free state, occupied state, and unknown state; when the location point is a point that makes up the standard fitted line segment, the environmental information of the markers in the grid where the location point is located is updated to occupied state. Among them, the free state grid represents the location area not occupied by obstacles, and there are positioning points that support the robot's passage; the occupied state grid represents the location area occupied by obstacles, which constitute the occupied area of obstacles in the actual environment mapped to the map; the unknown state grid represents the location area that has not been scanned in the grid map constructed by the robot.
13. A robot comprising a ranging sensor, an inertial sensor, and at least one processor and a computer program stored in the processor, wherein the ranging sensor and the inertial sensor are both electrically connected to the processor, characterized in that, When the processor executes the computer program, it implements the fitting line segment correction method as described in any one of claims 1 to 12.
14. A chip, characterized in that, The chip stores a computer program, which, when executed by a processor, implements the fitting line segment correction method as described in any one of claims 1 to 12.