Robot positioning method and device, equipment, storage medium and product
Through the online map and coordinate conversion formula method, the positioning universality problem of intelligent robots from different manufacturers in the same scenario is solved, and more efficient deployment and reuse is achieved.
Patent Information
- Application Number
- CN202411821690.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-03-11
AI Technical Summary
In the prior art, the map positioning of intelligent robots from different manufacturers in the same scenario is poor, resulting in the inability to achieve cross-vendor reuse in the same scenario, which affects the deployment efficiency of robots.
By drawing an online map of the area where the robot is located, and obtaining the relative position coordinates of the robot on the online map, determining at least three candidate sites and their site coordinates, generating coordinate conversion formulas, updating the current position coordinates of the robot, and realizing real-time position display.
It effectively reduces the coordinate differentiation problem of positioning of different manufacturers, improves the universality and deployment efficiency of robot map positioning, and avoids the obstacles of cross-vendor reuse.
Smart Images

Figure CN119594984A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent robots, and in particular to a robot positioning method, device, equipment, storage medium and product. Background Art
[0002] With the development of intelligent technology, more and more places are beginning to use intelligent robots to replace manual work. However, intelligent robots from different manufacturers have poor versatility in the same scenario due to their different scanning algorithms, map scales, and map modeling, which affects their normal use.
[0003] For example, in a hotel scenario, the actual locations of sites in the same room are basically the same, but the location coordinates of mobile robots from different manufacturers are different. The same situation also exists in the electronic fence scenario, which results in the sites and electronic fences set up in the scenario being unable to be reused across manufacturers, affecting the deployment efficiency of the robot.
[0004] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0005] The main purpose of the present invention is to provide a robot positioning method, device, equipment, storage medium and product, aiming to solve the technical problem of poor universality of robot map positioning of different manufacturers in the same scene in the prior art.
[0006] To achieve the above object, the present invention provides a robot positioning method, which comprises the following steps:
[0007] Draw an online map of the area where the robot is located, and obtain the relative position coordinates of the robot on the online map;
[0008] Determine at least three candidate sites in the online map and site coordinates of each candidate site;
[0009] Generate a coordinate conversion formula according to the relative position coordinates and the site coordinates of each candidate site;
[0010] Updating the current position coordinates of the robot according to the coordinate conversion formula;
[0011] The real-time position of the robot is displayed on the online map based on the current position coordinates.
[0012] Optionally, generating a coordinate conversion formula according to the relative position coordinates and the site coordinates of each candidate site includes:
[0013] Selecting any two target sites from the at least three candidate sites;
[0014] Determine the first mask coordinates of the robot, and determine the second mask coordinates of the two target sites according to the site coordinates of the target site;
[0015] Generate a first vector between the robot and one of the target sites and a second vector between the robot and another target site in an online map according to the first mask coordinates and the second mask coordinates;
[0016] Calculating a vector angle between the first vector and the second vector;
[0017] Generating three rotational body coordinates of the robot on the online map according to the vector angle;
[0018] Sorting the coordinates of the three rotating bodies to obtain a coordinate difference ratio;
[0019] A coordinate conversion formula is generated according to the coordinate difference ratio and the relative position coordinates.
[0020] Optionally, the ordering of the three rotating body coordinates to obtain a coordinate difference ratio includes:
[0021] Extracting first direction axis coordinates and second direction axis coordinates of the three rotating body coordinates, wherein the first direction axis and the second direction axis are perpendicular;
[0022] Calculate the first direction axis coordinate difference ratio of the corresponding first direction axis coordinates according to the first direction axis coordinates of the three rotating body coordinates;
[0023] Calculate the corresponding second direction axis coordinate difference ratio according to the second direction axis coordinates of the three rotating body coordinates;
[0024] The first direction axis coordinate difference ratio and the second direction axis coordinate difference ratio are recorded as a coordinate difference ratio.
[0025] Optionally, after sorting the three rotating body coordinates to obtain the coordinate difference ratio, the method further includes:
[0026] Determine a first absolute value corresponding to the first direction axis coordinate difference ratio and a second absolute value corresponding to the second direction axis coordinate difference ratio;
[0027] When both the first absolute value and the second absolute value are greater than or equal to a preset ratio threshold, the step of generating a coordinate conversion formula according to the coordinate difference ratio and the relative position coordinates is performed.
[0028] Optionally, generating a coordinate conversion formula according to the coordinate difference ratio and the relative position coordinates includes:
[0029] Obtaining an XY axis inversion relationship of the robot on the online map;
[0030] A coordinate conversion formula is generated according to a scale calculation formula corresponding to the XY axis inversion relationship.
[0031] Optionally, the robot positioning method further includes:
[0032] Obtain at least one test point and corresponding test point coordinates;
[0033] Calculate the mask coordinates corresponding to the test point coordinates in the online map;
[0034] Creating a test icon in the online map according to the mask coordinates;
[0035] Detecting the overlap of the test icons in the online map;
[0036] The coordinate conversion formula is tested for accuracy according to the coincidence degree and the precision index, wherein the precision index includes at least a first absolute value and a second absolute value.
[0037] In addition, to achieve the above-mentioned purpose, the present invention further proposes a robot positioning device, the robot positioning device comprising:
[0038] A drawing module, used to draw an online map of the area where the robot is located, and obtain the relative position coordinates of the robot on the online map;
[0039] A determination module, used to determine at least three candidate sites in the online map and the site coordinates of each candidate site;
[0040] A generating module, used for generating a coordinate conversion formula according to the relative position coordinates and the site coordinates of each candidate site;
[0041] An updating module, used for updating the current position coordinates of the robot according to the coordinate conversion formula;
[0042] A display module is used to display the real-time position of the robot on the online map based on the current position coordinates.
[0043] In addition, to achieve the above-mentioned purpose, the present invention also proposes a robot positioning device, which includes: a memory, a processor, and a robot positioning program stored in the memory and executable on the processor, and the robot positioning program is configured to implement the steps of the robot positioning method described above.
[0044] In addition, to achieve the above-mentioned purpose, the present invention further proposes a storage medium, on which a robot positioning program is stored, and when the robot positioning program is executed by a processor, the steps of the robot positioning method described above are implemented.
[0045] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the robot positioning method described above are implemented.
[0046] One or more technical solutions proposed in the present invention have at least the following technical effects: The present invention discloses a robot positioning method, which includes: drawing an online map of the area where the robot is located, and obtaining the relative position coordinates of the robot on the online map; determining at least three candidate sites in the online map and the site coordinates of each candidate site; generating a coordinate conversion formula according to the relative position coordinates and the site coordinates of each candidate site; updating the current position coordinates of the robot according to the coordinate conversion formula; and displaying the real-time position of the robot on the online map based on the current position coordinates. Compared with the prior art, the present invention draws an online map of the area where the robot is located and the relative position coordinates of the robot on the online map, and selects at least three candidate sites on the online map, so as to reduce the coordinate differentiation problem of positioning by different manufacturers according to the positional relationship between the robot and each candidate site, and generates a coordinate conversion formula according to the relative position coordinates of the robot and the site coordinates of each candidate site, so as to update the current position coordinates of the robot based on the coordinate conversion formula, thereby avoiding the technical problem of poor universality of map positioning of robots of different manufacturers in the same scene in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0048] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0049] Figure 1 It is a schematic diagram of the flow chart of the first embodiment of the robot positioning method of the present invention;
[0050] Figure 2 It is a schematic flow chart of a second embodiment of the robot positioning method of the present invention;
[0051] Figure 3 A schematic diagram of coordinates on a map, body coordinates and XY axis inversion of an embodiment of a robot positioning method of the present invention;
[0052] Figure 4 is a structural block diagram of a first embodiment of a robot positioning device of the present invention;
[0053] Figure 5 It is a structural schematic diagram of a robot positioning device in a hardware operating environment involved in an embodiment of the present invention.
[0054] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0055] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0056] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0057] Based on this, an embodiment of the present invention provides a robot positioning method, referring to Figure 1 , Figure 1 The figure is a flow chart of a first embodiment of a robot positioning method according to the present invention.
[0058] In this embodiment, the robot positioning method includes:
[0059] Step S10: Draw an online map of the area where the robot is located, and obtain the relative position coordinates of the robot on the online map
[0060] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a cloud server, etc. The following takes the cloud server as an example to illustrate this embodiment and the following embodiments.
[0061] It should be noted that the mobile robot moves to the specified position and realizes automatic obstacle avoidance. The widely used navigation technologies are visual navigation and laser navigation, with laser navigation being the mainstream. Its core technology is the SLAM (Simultaneous Localization and Mapping) algorithm. The robot is equipped with several laser transceivers, which emit laser ranging in multiple directions while moving. Two-dimensional mapping or three-dimensional modeling is performed based on the robot's moving distance, laser ranging distance and angle, and the position of the sweeping robot in the map is determined at the same time. The laser radar collects data on the surrounding environment and presents accurate points, called point clouds. The robot's self-built map is composed of dense point clouds. Therefore, the map obtained through the robot's main body interface is often full of various scattered points and lines, which is difficult to intuitively reflect the actual indoor form and is not convenient to be directly provided to users as an indoor map.
[0062] In actual scenarios, robots and robot operators have an urgent need to view the real-time position of the robot on the indoor map and the display of other locations. Taking the typical scenario of a delivery robot as an example, after the user triggers the delivery task, he hopes to view the real-time position of the robot and the target location on the indoor map to understand the progress of the delivery. The operator needs to view the real-time position of the robot, especially when the robot fails. In addition, the operator also needs to set up an electronic fence. When the real-time position of the robot is obtained beyond the range of the electronic fence, the system sends an alarm to the operator to prevent the robot from exceeding a certain operating range.
[0063] However, the X-value and Y-value unit scales of mobile robots from different manufacturers are different. Even for the same robot, the X-value and Y-value representing the target point position and the X-value and Y-value representing the robot's real-time position are also different, which makes it difficult to form a unified position calculation formula. In addition, the X-axis / Y-axis pointing angles of the robot are inconsistent. The X-axis / Y-axis pointing angles of the robot's position orthogonal coordinate system are related to the orientation angle of the robot during initial positioning. In practice, it is difficult to make them coincide with the X-axis / Y-axis of the indoor map, and they are also inconsistent between mobile robots from different manufacturers.
[0064] However, in actual scenarios of mobile robots, the configured sites and the actual locations of the sites are often the same for mobile robots from different manufacturers. For example, in a hotel scenario, the actual locations of the sites in the same room are basically the same, but the location coordinates of mobile robots from different manufacturers are different. This means that if multiple robots are used for operation and maintenance in the same scenario, the management efficiency of the robots will be affected, and even worse, user complaints will be received.
[0065] Based on this, this embodiment draws an online map of the area where the robot is located and the relative position coordinates of the robot on the online map, and selects at least three candidate sites on the online map to reduce the coordinate differentiation problem of positioning by different manufacturers based on the positional relationship between the robot and each candidate site. A coordinate conversion formula is generated based on the relative position coordinates of the robot and the site coordinates of each candidate site, and the current position coordinates of the robot are updated based on the coordinate conversion formula, thereby avoiding the technical problem of poor universality of map positioning of robots from different manufacturers in the same scene in the prior art.
[0066] The online map of the area where the robot is located can be drawn based on a proportional CAD drawing of a building fire protection blueprint or a three-dimensional map of the scene pre-stored in a database, and this embodiment does not impose any specific restrictions on this.
[0067] Specifically, after increasing the transparency of the building fire protection CAD drawing or the robot laser scanning map, it is overlapped and placed at the bottom of the drawing layer to ensure that the drawn indoor map is accurately scaled and each layer of the map at the spatial height is positioned separately, that is, the map positioning in this embodiment and subsequent embodiments is based on a two-dimensional plane map, not a three-dimensional plane map.
[0068] The user accesses the indoor map positioning page in a browser, obtains the robot list and indoor floor list when the page is loaded, and after the user selects the robot and floor to be set, uploads the drawn indoor map image and saves the correspondence between the image, the robot, and the floor.
[0069] The relative position coordinates of the robot on the online map are based on the coordinate values of the map stored inside each robot. However, due to factors such as map modeling or radar parameters of each manufacturer, there are differences between the position coordinates stored locally on the robot and the coordinates of the robot on the online map in the cloud server. Therefore, the relative position coordinates need to be converted to obtain the precise coordinates of the robot in the online map.
[0070] Step S20: Determine at least three candidate sites in the online map and the site coordinates of each candidate site.
[0071] In this embodiment, the at least three candidate sites are used to locate the precise position of the robot, and the at least three candidate sites are not in the same straight line, and are respectively located in at least three directions of the online map, as far away as possible to avoid interference from sites that are too close. In addition, the candidate sites can be pre-set fixed locations in the area. For example, for a hotel, each room is regarded as a site. When determining the site on the online map, since the location of each site is fixed, when determining the site coordinates, the coordinates of the site can be directly read from the database or map based on the specific identification of each site. The site list can also be obtained by using the robot body interface to confirm that the XY values of the position coordinates of each point can be obtained. This embodiment does not impose specific restrictions on this.
[0072] It should be noted that in this embodiment, the reason for using at least three candidate sites is that if one point is selected, it is impossible to determine the robot body coordinate value corresponding to the vertex in the upper left corner of the map, the scale between the coordinate value on the map and the robot body coordinate value, and the rotation angle; and if two points are selected, it is difficult to determine the relationship between the coordinate top value / left value in the map and the robot body coordinate X value / Y value, and it is difficult to obtain the accuracy index. Selecting three points on a straight line, or three points with equal distances between each other, also has the same problem, so three points that are not on the same straight line and can form an unequal triangle are required.
[0073] The reason for preventing the candidate sites from being too close is that when the mask icon of the online map is subsequently established, the positioning error on the map will be magnified, which will have an adverse effect on the final calculation accuracy.
[0074] Furthermore, after step S20, the method further includes:
[0075] Performing index testing on the at least three candidate points;
[0076] After the index test is passed, a step of generating a coordinate conversion formula according to the relative position coordinates and the site coordinates of each candidate site is performed.
[0077] In a specific implementation, the indicator test includes at least: point concentration test, point straight line test and point distance proximity test. The point concentration test refers to taking the left and top values of three points on the map. If the maximum top value minus the minimum top value divided by the map pixel height is less than 0.1 or the maximum left value minus the minimum left value divided by the map pixel width is less than 0.1, then it is considered that the point distribution is too concentrated and the points need to be evacuated.
[0078] In this embodiment and subsequent embodiments, the top value is the top distance value of the site icon DOM element relative to the upper left corner of the mask DOM element in the online map and the percentage of the height of the mask DOM element, and the left value is the left distance value of the site icon DOM element relative to the upper left corner of the mask DOM element and the percentage of the width of the mask DOM element.
[0079] Point linearity refers to the slope method used to calculate the slope between three stations. If the slope of the straight line between any two points is within the preset safety interval, the point straightness test fails. For example, assume that the coordinates of the three points on the graph are (x1, y1), (x2, y2), and (x3, y3). Calculate the value of ((y2-y1) / (x2-x1)) / ((y3-y1) / (x3-x1)). If it is between 0.9 and 1.1, it is considered that the point distribution is too close to a straight line and the point needs to be reselected.
[0080] The point distance proximity test refers to calculating the modulus of the vector between every two points. If the modulus of the vector between any two points is within the preset modulus threshold range, the point distance proximity test fails and the point needs to be reselected. For example, if the ratio of two moduli is greater than 0.9 and less than 1.1, it is considered that the distance between the two sides is too close and the point needs to be reselected.
[0081] Step S30: generating a coordinate conversion formula according to the relative position coordinates and the site coordinates of each candidate site.
[0082] It should be understood that the coordinate conversion formula is used to convert the coordinates of the robot in the original map dimension, that is, the relative position coordinates, into the absolute position coordinates in the online map stored in the cloud server.
[0083] Step S40: updating the current position coordinates of the robot according to the coordinate conversion formula.
[0084] Step S50: Displaying the real-time position of the robot on the online map based on the current position coordinates.
[0085] When the real-time position of the robot needs to be updated, the real-time position coordinate value of the robot can be obtained and brought into the real-time position coordinate conversion formula of the robot to calculate the percentage ratio of the position relative to the upper left corner of the indoor map and the length and width of the map, and display it in the HTML element of the upper overlay layer of the map to show the real-time position of the robot.
[0086] Furthermore, after step 50, the method further includes:
[0087] Obtaining the area range of the electronic fence in the online map;
[0088] Detecting whether the real-time position of the robot exceeds the area range of the electronic fence based on the current position coordinates;
[0089] If so, a warning message is generated.
[0090] In the specific implementation, in order to prevent the robot from moving to a distant location, causing patrol difficulties and causing economic losses, this embodiment will monitor the robot's location in real time to see if it exceeds the pre-defined electronic fence area. If the robot exceeds the electronic fence area, it will trigger a system alarm to remind the staff to recover it in time to avoid further losses.
[0091] Among them, the electronic fence can be understood as a closed polygon composed of multiple points. On the upper layer of the indoor map image DOM element, a canvas DOM element with the same width and height is created to draw the polygon. In order to simplify the canvas drawing operation, the open source canvas drawing tool library fabricJS can be used. The mouse click event is listened to on the canvas element to draw the polygon vertices, and then the vertices drawn in sequence are connected with straight lines. In order to avoid the recurrence of line overlap, the new line and the line-by-line are calculated by the vector cross multiplication method to see if they intersect. The specific steps include: assuming two line segments AB and CD, calculate the cross product results of vectors AC and AD with vector AB. If the results of AC×AB and AD×AB have different signs, it means that C and D are on both sides of the straight line AB respectively. The same method is used to prove that A and B are on both sides of the straight line CD. If both are satisfied at the same time, the line segments AB and CD intersect. If the lines intersect, the new vertex is invalid. The mouse double-click event is listened to on the canvas element, the first vertex is connected to the last vertex, and it is determined whether there is a line segment intersection. If not, the ploygon method of fabricJS is called to render a polygon in the vertex to obtain the electronic fence.
[0092] Before drawing the electronic fence, the mobile robot is required to upload the indoor map on the floor and have completed the positioning and display of the mobile robot's real-time position on the indoor map, because the subsequent calculation of the mobile robot's position coordinates corresponding to the electronic fence vertex needs to rely on the robot's real-time position coordinate conversion calculation formula with set parameters.
[0093] The area defined by the electronic fence can be calculated by using the coordinate conversion formula mentioned above to obtain the coordinates of each vertex of the electronic fence. The calculation of whether the robot exceeds the electronic fence can be performed by sending a ray in any direction from a given point and calculating the number of intersections between the ray and the polygon boundary. If the number of intersections is an odd number, the point is inside the polygon; if the number of intersections is an even number, the point is not inside the polygon, thereby judging whether the robot is within the defined electronic fence polygon.
[0094] This embodiment draws an online map of the area where the robot is located and the relative position coordinates of the robot on the online map, and selects at least three candidate sites on the online map to reduce the coordinate differentiation problem of positioning by different manufacturers according to the positional relationship between the robot and each candidate site. A coordinate conversion formula is generated according to the relative position coordinates of the robot and the site coordinates of each candidate site, and the current position coordinates of the robot are updated based on the coordinate conversion formula, thereby avoiding the technical problem of poor universality of map positioning of robots of different manufacturers in the same scene in the prior art.
[0095] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 2 , step S30, comprising:
[0096] Step S301: Select any two target sites from the at least three candidate sites.
[0097] Step S302: Determine the first mask coordinates of the robot, and determine the second mask coordinates of the two target sites according to the site coordinates of the target sites.
[0098] Step S303: Generate a first vector between the robot and one of the target sites and a second vector between the robot and another target site in an online map according to the first mask coordinates and the second mask coordinates.
[0099] Step S304: Calculate the vector angle between the first vector and the second vector.
[0100] Step S305: generating three rotational body coordinates of the robot on the online map according to the vector angle.
[0101] Step S306: sorting the three rotating body coordinates to obtain a coordinate difference ratio.
[0102] Step S307: generating a coordinate conversion formula according to the coordinate difference ratio and the relative position coordinates.
[0103] It should be noted that, as mentioned above, the online map in this embodiment is a two-dimensional plane map. According to traditional positioning theory, the coordinates of any two points with known positioning can achieve the effect of determining the coordinate positioning of the third point. On this basis, this embodiment can determine the exact position of the robot by selecting any two sites from the three candidate sites as the basis for positioning.
[0104] In this embodiment, the mask coordinates refer to (left, top) or (top, left), which is specifically manifested as creating a mask DOM element of equal width and height on the uploaded indoor map image, setting the transparency to 100%, and using HTML5's dragapi to listen to the drag event. When the created icon DOM element is dragged onto the mask DOM element, the position of the icon DOM element relative to the upper left corner of the mask DOM element is obtained, the top value is the top distance value of the icon DOM element relative to the upper left corner of the mask DOM element and the percentage of the height of the mask DOM element, and the left value is the left distance value of the icon DOM element relative to the upper left corner of the mask DOM element and the percentage of the width of the mask DOM element. Whether it is the first mask coordinate given by the robot or the second mask coordinate corresponding to the selected target site, it can be obtained in this way.
[0105] In the specific implementation, two of the three points mentioned above are selected, and the vector based on the coordinates on the map and the vector of the robot's body coordinates of the line connecting the two points are calculated. It is assumed that the left value of the mask coordinate corresponds to the X value of the body coordinate, and the top value of the mask coordinate in the map corresponds to the Y value of the body coordinate. It is assumed that the vector based on the coordinates on the map is (x1, y1), where x1 is the left value of the coordinate in the map multiplied by the width of the map image, and y1 is the top value of the coordinate in the map multiplied by the height of the map image. The vector of the robot's body coordinates is (x2, y2).
[0106] The direction of the unified vector is positive, and x1, y1, x2, and y2 are assigned their own absolute values.
[0107] By normalizing the vector mag1 = Math.hypot(x1, y1); mag2 = Math.hypot(x2, y2)
[0108] Let x1 / =mag1, x1 / =mag1, x2 / =mag2, y2 / =mag2, and then use the cross product to calculate the normal vector:
[0109] cross=x1*y2-y1*x2
[0110] Use the inverse sine function to calculate the angle in radians, that is, to calculate the vector angle between the first vector and the second vector:
[0111] angle = Math.asin(cross)
[0112] Similarly, the above assumes that the left value of the mask coordinate corresponds to the X value of the body coordinate, and the top value of the mask coordinate in the figure corresponds to the Y value of the body coordinate. If it is assumed that the left value of the coordinate in the figure corresponds to the Y value of the body coordinate, and the top value of the coordinate in the figure corresponds to the X value of the body coordinate, then relative to the above assumption, it is equivalent to rotating the triangle composed of the three-point body coordinates around the origin 90 degrees, and then taking a symmetrical mirror image relative to a coordinate axis. By reversing the corresponding relationship, the left value of the coordinate in the figure corresponds to the Y value of the body coordinate, and the top value of the coordinate in the figure corresponds to the X value of the body coordinate, that is, the vector of the robot body coordinate is (y2, x2). For the convenience of expression, this situation is called XY axis reversal, represented by the Boolean variable isReverseXY. isReverseXY is true, indicating XY axis reversal.
[0113] After determining the vector angle, rotate the three points around the origin of the robot body coordinate system to find the new robot body coordinate position. Assuming that the original coordinates of a point are (x, y), and the rotated coordinates are (X, Y), the calculation formula is:
[0114] X=x*Math.cos(angle)-y*Math.sin(angle)
[0115] Y=x*Math.sin(angle)+y*Math.cos(angle)
[0116] Among them, xy is the horizontal coordinate and vertical coordinate of the original coordinate, and XY is the horizontal coordinate and vertical coordinate of the rotated coordinate.
[0117] Furthermore, the ordering of the three rotating body coordinates to obtain the coordinate difference ratio includes:
[0118] Extracting first direction axis coordinates and second direction axis coordinates of the three rotating body coordinates, wherein the first direction axis and the second direction axis are perpendicular;
[0119] Calculate the first direction axis coordinate difference ratio of the corresponding first direction axis coordinates according to the first direction axis coordinates of the three rotating body coordinates;
[0120] Calculate the corresponding second direction axis coordinate difference ratio according to the second direction axis coordinates of the three rotating body coordinates;
[0121] The first direction axis coordinate difference ratio and the second direction axis coordinate difference ratio are recorded as a coordinate difference ratio.
[0122] In the specific implementation, when sorting the three rotated body coordinates, the three points in the figure can be sorted from small to large according to the top value, namely point1, point2, and point3, and the top value difference ratio of the coordinates on the figure is calculated (point2.top-point1.top) / (point3.top-point1.top). This value is referred to as the coordinate difference on the figure. According to the value of the switch corresponding to the coordinate axis, if the XY axis is reversed, the ratio of (point2.X-point1.X) / (point3.X-point1.X) is calculated; otherwise, the ratio of (point2.Y-point1.Y) / (point3.Y-point1.Y) is calculated. This value is referred to as the body coordinate difference. The coordinate difference on the figure / body coordinate difference is calculated to obtain the top difference ratio.
[0123] Sort the three points in the graph from small to large according to the left value, namely point1, point2, and point3, and calculate the ratio of the left value difference of the coordinates on the graph (point2.left-point1.left) / (point3.left-point1.left). This value is referred to as the coordinate difference on the graph. According to the value of the switch corresponding to the coordinate axis, if the XY axis is reversed, calculate the ratio of (point2.Y-point1.Y) / (point3.Y-point1.Y); otherwise, calculate the ratio of (point2.X-point1.X) / (point3.X-point1.X). This value is referred to as the body coordinate difference. Calculate the coordinate difference on the graph / body coordinate difference to get the left difference ratio.
[0124] Furthermore, after sorting the coordinates of the three rotating bodies to obtain the coordinate difference ratio, the method further includes:
[0125] Determine a first absolute value corresponding to the first direction axis coordinate difference ratio and a second absolute value corresponding to the second direction axis coordinate difference ratio;
[0126] When both the first absolute value and the second absolute value are greater than or equal to a preset ratio threshold, the step of generating a coordinate conversion formula according to the coordinate difference ratio and the relative position coordinates is performed.
[0127] It is understandable that the coordinate difference ratio can also be used to evaluate the accuracy of the coordinate conversion formula. Specifically, the preset ratio threshold is 0.9 as an example, and the absolute value of the top difference ratio and the left difference ratio is calculated as the accuracy indicator. If both values are greater than or equal to 0.9, the positioning accuracy is considered to be good and can be used for positioning display. The closer the value is to 1, the higher the accuracy. If the value is less than 0.9, it prompts that the point map positioning and the actual coordinates are inconsistent. Please adjust the positioning or switch the coordinate axis correspondence.
[0128] Further, generating a coordinate conversion formula according to the coordinate difference ratio and the relative position coordinates includes:
[0129] Obtaining an XY axis inversion relationship of the robot on the online map;
[0130] A coordinate conversion formula is generated according to a scale calculation formula corresponding to the XY axis inversion relationship.
[0131] In the specific implementation, if the XY axis is not reversed, the top value scale (topScale) = (point1.top-point3.top) / (point1.Y-point3.Y), the left value scale (leftScale) = (point1.left-point3.left) / (point1.X-point3.X), among which the coordinate value of the upper left corner of the map relative to the rotated body coordinate (topLeftVertex) = {X:point1.X-point1.left / leftScale; Y:point1.Y-point1.top / leftScale}.
[0132] When the XY axis is reversed, the top value scale (topScale) = (point1.top-point3.top) / (point1.X-point3.X), the left value scale (leftScale) = (point1.left-point3.left) / (point1.Y-point3.Y), and the coordinate value of the upper left vertex of the map relative to the rotated body coordinates (topLeftVertex) = {X: point1.X-point1.top / topScale, Y: point1.Y-point1.left / leftScale}.
[0133] Specifically, refer to Figure 3 , Figure 3This is a schematic diagram of the coordinates on the figure, the coordinates of the body, and the XY axis inversion in this embodiment, where the red triangle represents the coordinates of the three points on the figure, the value of the x-axis represents the left value of the coordinate on the figure, and the value of the y-axis represents the top value of the coordinate on the figure. The coordinates of the three points are (0,0), (0,1), and (1,2). The purple-red triangle represents the coordinates of the three points on the body. It is assumed here that the left value of the coordinate in the figure corresponds to the X value of the coordinate of the body, and the top value of the coordinate in the figure corresponds to the Y value of the coordinate of the body. The coordinates of the three points are (2,1), (4,1), and (6,3). The black triangle represents the coordinates of the three points on the body after the XY axis inversion. The blue triangle is formed by rotating the purple triangle 90 degrees to the left around the origin, and it is symmetrical with the black triangle relative to the Y axis.
[0134] The robot's body coordinate X after rotation = the robot's body coordinate x*Math.cos(angle) at that point - the robot's body coordinate y*Math.sin(angle) at that point; the robot's body coordinate Y after rotation = the robot's body coordinate x*Math.sin(angle) at that point + the robot's body coordinate y*Math.cos(angle) at that point; the robot's top value = (isReverseXY?X-topLeftVertex.X:Y-topLeftVertex.Y)*topScale; the robot's left value = (isReverseXY?Y-topLeftVertex.Y:X-topLeftVertex.X)*leftScale.
[0135] Furthermore, the robot positioning method further includes:
[0136] Obtain at least one test point and corresponding test point coordinates;
[0137] Calculate the mask coordinates corresponding to the test point coordinates in the online map;
[0138] Creating a test icon in the online map according to the mask coordinates;
[0139] Detecting the overlap of the test icons in the online map;
[0140] The coordinate conversion formula is tested for accuracy according to the coincidence degree and the precision index, wherein the precision index includes at least a first absolute value and a second absolute value.
[0141] In order to improve the accuracy of the coordinate conversion formula, this embodiment also selects a test point before calculating the actual position coordinates of the robot, obtains the x and y values of the robot body coordinates at this point, obtains the temporarily stored scale, the vertex coordinates of the indoor map, and the rotation angle parameters, and brings them into the above calculation formula to calculate the top value (relative to the percentage of the image height) and the left value (relative to the percentage of the image width) of the point on the indoor map, and creates an icon DOM element in the indoor map mask DOM element, and sets the position value of the DOM element to absolute, the top value, and the left value to the above top value and left value. According to whether the icon position coincides with the actual position, and combined with the accuracy index, the three points used to obtain the point coordinate conversion calculation formula are fine-tuned by the mouse or keyboard to make the test point as accurate as possible, and then several test points are selected for testing. After the test passes, the scale of the robot on the floor, the vertex coordinates of the indoor map, and the rotation angle parameters are uploaded and saved to correct the coordinate conversion formula multiple times to improve the accuracy of the formula.
[0142] This embodiment selects any two target sites from the at least three candidate sites; determines the first mask coordinates of the robot, and determines the second mask coordinates of the two target sites according to the site coordinates of the target sites; generates a first vector between the robot and one of the target sites and a second vector between the robot and the other target site in an online map according to the first mask coordinates and the second mask coordinates; calculates the vector angle between the first vector and the second vector; generates three rotating body coordinates of the robot on the online map according to the vector angle; sorts the three rotating body coordinates to obtain a coordinate difference ratio; generates a coordinate conversion formula according to the coordinate difference ratio and the relative position coordinates, and constructs a coordinate conversion formula based on the determined site coordinates through the mapping relationship between the mask coordinates and the relative position coordinates on the online map, thereby reducing the influence of local maps of robots from different manufacturers.
[0143] This application also provides a robot positioning device, please refer to Figure 4 , the robot positioning device comprises:
[0144] The drawing module 10 is used to draw an online map of the area where the robot is located, and obtain the relative position coordinates of the robot on the online map.
[0145] The determination module 20 is used to determine at least three candidate sites in the online map and the site coordinates of each candidate site.
[0146] The generating module 30 is used to generate a coordinate conversion formula according to the relative position coordinates and the site coordinates of each candidate site.
[0147] The updating module 40 is used to update the current position coordinates of the robot according to the coordinate conversion formula.
[0148] The display module 50 is used to display the real-time position of the robot on the online map based on the current position coordinates.
[0149] This embodiment draws an online map of the area where the robot is located and the relative position coordinates of the robot on the online map, and selects at least three candidate sites on the online map to reduce the coordinate differentiation problem of positioning by different manufacturers according to the positional relationship between the robot and each candidate site. A coordinate conversion formula is generated according to the relative position coordinates of the robot and the site coordinates of each candidate site, and the current position coordinates of the robot are updated based on the coordinate conversion formula, thereby avoiding the technical problem of poor universality of map positioning of robots of different manufacturers in the same scene in the prior art.
[0150] In one embodiment, the generation module 30 is further used to select any two target sites from the at least three candidate sites; determine the first mask coordinates of the robot, and determine the second mask coordinates of the two target sites based on the site coordinates of the target sites; generate a first vector between the robot and one of the target sites and a second vector between the robot and the other target site in the online map based on the first mask coordinates and the second mask coordinates; calculate the vector angle between the first vector and the second vector; generate three rotating body coordinates of the robot on the online map based on the vector angle; sort the three rotating body coordinates to obtain a coordinate difference ratio; and generate a coordinate conversion formula based on the coordinate difference ratio and the relative position coordinates.
[0151] In one embodiment, the generation module 30 is also used to extract the first direction axis coordinates and the second direction axis coordinates of the three rotating body coordinates, the first direction axis and the second direction axis are perpendicular; calculate the corresponding first direction axis coordinate difference ratio according to the first direction axis coordinates of the three rotating body coordinates; calculate the corresponding second direction axis coordinate difference ratio according to the second direction axis coordinates of the three rotating body coordinates; and record the first direction axis coordinate difference ratio and the second direction axis coordinate difference ratio as the coordinate difference ratio.
[0152] In one embodiment, the generation module 30 is also used to determine a first absolute value corresponding to the first direction axis coordinate difference ratio and a second absolute value corresponding to the second direction axis coordinate difference ratio; when the first absolute value and the second absolute value are both greater than or equal to a preset ratio threshold, the step of generating a coordinate conversion formula based on the coordinate difference ratio and the relative position coordinates is executed.
[0153] In one embodiment, the generating module 30 is further used to obtain an XY axis inversion relationship of the robot on the online map; and generate a coordinate conversion formula according to a scale calculation formula corresponding to the XY axis inversion relationship.
[0154] In one embodiment, the generation module 30 is further used to obtain at least one test point and corresponding test point coordinates; calculate the mask coordinates corresponding to the test point coordinates in the online map; create a test icon in the online map according to the mask coordinates; detect the overlap of the test icon in the online map; and perform an accuracy test on the coordinate conversion formula according to the overlap and an accuracy index, wherein the accuracy index includes at least a first absolute value and a second absolute value.
[0155] The present application provides a robot positioning device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the robot positioning method in the above-mentioned embodiment one.
[0156] Reference below Figure 5 , which shows a schematic diagram of the structure of a robot positioning device suitable for implementing the embodiment of the present application. The robot positioning device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The robot positioning device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0157] like Figure 5As shown, the robot positioning device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the robot positioning device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the robot positioning device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a robot positioning device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0158] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0159] The robot positioning device provided by the present application adopts the robot positioning method in the above embodiment to solve the technical problem of robot positioning. Compared with the prior art, the beneficial effects of the robot positioning device provided by the present application are the same as the beneficial effects of the robot positioning method provided by the above embodiment, and the other technical features in the robot positioning device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0160] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0161] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0162] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, wherein the computer-readable program instructions are used to execute the robot positioning method in the above-mentioned embodiment.
[0163] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0164] The computer-readable storage medium may be included in the robot positioning device; or may exist independently without being assembled into the robot positioning device.
[0165] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the robot positioning device, the robot positioning device performs robot positioning.
[0166] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0167] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0168] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0169] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned robot positioning method, and can solve the technical problem of robot positioning. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the robot positioning method provided by the above-mentioned embodiment, and will not be repeated here.
[0170] The present application also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the robot positioning method as described above are implemented.
[0171] The computer program product provided by the present application can solve the technical problem of robot positioning. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the robot positioning method provided by the above embodiment, which will not be repeated here.
[0172] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A robot positioning method, characterized in that: The robot positioning method comprises: Draw an online map of the area where the robot is located, and obtain the relative position coordinates of the robot on the online map; Determine at least three candidate sites in the online map and site coordinates of each candidate site; Generate a coordinate conversion formula according to the relative position coordinates and the site coordinates of each candidate site; Updating the current position coordinates of the robot according to the coordinate conversion formula; The real-time position of the robot is displayed on the online map based on the current position coordinates.
2. The robot positioning method according to claim 1, characterized in that: The generating a coordinate conversion formula according to the relative position coordinates and the site coordinates of each candidate site includes: Selecting any two target sites from the at least three candidate sites; Determine the first mask coordinates of the robot, and determine the second mask coordinates of the two target sites according to the site coordinates of the target site; Generate a first vector between the robot and one of the target sites and a second vector between the robot and another target site in an online map according to the first mask coordinates and the second mask coordinates; Calculating a vector angle between the first vector and the second vector; Generating three rotational body coordinates of the robot on the online map according to the vector angle; Sorting the coordinates of the three rotating bodies to obtain a coordinate difference ratio; A coordinate conversion formula is generated according to the coordinate difference ratio and the relative position coordinates.
3. The robot positioning method according to claim 2, characterized in that: The step of sorting the three rotating body coordinates to obtain a coordinate difference ratio includes: Extracting first direction axis coordinates and second direction axis coordinates of the three rotating body coordinates, wherein the first direction axis and the second direction axis are perpendicular; Calculate the first direction axis coordinate difference ratio of the corresponding first direction axis coordinates according to the first direction axis coordinates of the three rotating body coordinates; Calculate the corresponding second direction axis coordinate difference ratio according to the second direction axis coordinates of the three rotating body coordinates; The first direction axis coordinate difference ratio and the second direction axis coordinate difference ratio are recorded as a coordinate difference ratio.
4. The robot positioning method according to claim 3, characterized in that: After the three rotating body coordinates are sorted to obtain the coordinate difference ratio, the method further includes: Determine a first absolute value corresponding to the first direction axis coordinate difference ratio and a second absolute value corresponding to the second direction axis coordinate difference ratio; When both the first absolute value and the second absolute value are greater than or equal to a preset ratio threshold, the step of generating a coordinate conversion formula according to the coordinate difference ratio and the relative position coordinates is performed.
5. The robot positioning method according to claim 2, characterized in that: The generating a coordinate conversion formula according to the coordinate difference ratio and the relative position coordinates includes: Obtaining an XY axis inversion relationship of the robot on the online map; A coordinate conversion formula is generated according to a scale calculation formula corresponding to the XY axis inversion relationship.
6. The robot positioning method according to claim 5, characterized in that: The robot positioning method further includes: Obtain at least one test point and corresponding test point coordinates; Calculate the mask coordinates corresponding to the test point coordinates in the online map; Creating a test icon in the online map according to the mask coordinates; Detecting the overlap of the test icons in the online map; The coordinate conversion formula is tested for accuracy according to the coincidence degree and the precision index, wherein the precision index includes at least a first absolute value and a second absolute value.
7. A robot positioning device, characterized in that: The robot positioning device comprises: A drawing module, used to draw an online map of the area where the robot is located, and obtain the relative position coordinates of the robot on the online map; A determination module, used to determine at least three candidate sites in the online map and site coordinates of each candidate site; A generating module, used for generating a coordinate conversion formula according to the relative position coordinates and the site coordinates of each candidate site; An updating module, used for updating the current position coordinates of the robot according to the coordinate conversion formula; A display module is used to display the real-time position of the robot on the online map based on the current position coordinates.
8. A robot positioning device, characterized in that: The robot positioning device comprises: a memory, a processor, and a robot positioning program stored in the memory and executable on the processor, wherein the robot positioning program is configured to implement the robot positioning method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium stores a robot positioning program, and when the robot positioning program is executed by the processor, the robot positioning method according to any one of claims 1 to 6 is implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the robot positioning method according to any one of claims 1 to 6 are implemented.