Map response method and autonomous mobile robot
The map area is divided through the target tree structure and the target leaf nodes are quickly indexed, which solves the problem of slow map response speed and improves the rendering frame rate and user experience.
Patent Information
- Application Number
- CN202411216628.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-12-13
AI Technical Summary
In the prior art, with the increase of map elements, the computing amount of computer equipment when determining that the user clicks on elements is large, resulting in slow map response speed, affecting the rendering frame rate and user experience.
The map is divided into multiple regions using the target tree structure, and each region corresponds to a leaf node. The target leaf nodes are quickly indexed by detecting the coordinates of the operation, so as to query the target elements in the region, reducing unnecessary query volume and reducing CPU load. .
Improve map response speed, stabilize rendering frame rate, improve user experience, and reduce calculation amount by quickly filtering invalid areas and elements.
Smart Images

Figure CN119126790A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of robotics technology, and in particular to a map response method and an autonomous mobile robot. Background Art
[0002] With the continuous development of science and technology, indoor robots have gradually been applied to various industries, such as food delivery robots, hotel / hospital delivery robots, etc. Before the robot works, it needs to scan the map, edit the map and other mapping processes so that the robot can walk according to the map. The map includes multiple elements, such as target points, path points, label points and other elements.
[0003] In the related art, during the map editing stage, a user can operate elements in the map. Specifically, the user clicks on the map, and the computer device determines the element clicked by the user and performs a corresponding operation accordingly.
[0004] However, under the prior art, as the number of elements in a map continues to increase, after a user clicks on the map, the amount of calculation required by a computer device to determine the element clicked by the user will be relatively large. Summary of the invention
[0005] The present application provides a map response method and an autonomous mobile robot, which can reduce the amount of calculation and improve the map response speed. The technical solution is as follows:
[0006] In a first aspect, a map response method is provided, which is applied to an autonomous mobile robot, wherein the autonomous mobile robot includes a touch screen, and the method includes: displaying a map on the touch screen, the map including one or more elements, the map corresponding to a target tree, the target tree including at least one branch node and multiple leaf nodes, the multiple leaf nodes corresponding one-to-one to multiple areas in the map, each of the multiple leaf nodes including element information of an element in a corresponding area, each of the at least one branch node including a coordinate range of an area corresponding to a subordinate node, and the element information of the element including an element identifier and a coordinate range of the element; if a first operation acting on the map is detected, determining a first coordinate of the first operation in a map coordinate system of the map; determining a target leaf node indexed by the first coordinate in the target tree, the first coordinate being within the coordinate range of the area corresponding to the target leaf node; querying a target element from elements in the area corresponding to the target leaf node according to the first coordinate and the element information of the element in the target leaf node; if the target element is queried, executing a response logic corresponding to the target element.
[0007] In the present application, the autonomous mobile robot indexes the target leaf node in the target tree according to the first coordinate, and can quickly filter out the area where the first operation does not work from multiple areas in the map. After indexing the target leaf node, the target element can be directly queried in the elements in the area corresponding to the target leaf node, without having to query the target element in the elements in the areas corresponding to other leaf nodes. In this way, the number of elements required to be queried can be greatly reduced, the amount of calculation can be reduced, and the CPU load can be reduced, thereby not only improving the map response speed, but also ensuring the stability of the rendering frame rate to a certain extent, improving the smoothness of the map display, and thus improving the user experience.
[0008] In a second aspect, a map response device is provided, which is applied to an autonomous mobile robot, wherein the autonomous mobile robot includes a touch screen, and the device includes:
[0009] A display module, used for displaying a map on the touch screen, the map including one or more elements, the map corresponding to a target tree, the target tree including at least one branch node and multiple leaf nodes, the multiple leaf nodes corresponding one-to-one to multiple areas in the map, each of the multiple leaf nodes including element information of an element in a corresponding area, each of the at least one branch node including a coordinate range of an area corresponding to a subordinate node, and the element information of the element including an element identifier and a coordinate range of the element;
[0010] A first determining module, configured to determine a first coordinate of the first operation in a map coordinate system of the map if a first operation acting on the map is detected;
[0011] A second determination module is used to determine a target leaf node indexed by the first coordinate in the target tree, wherein the first coordinate is within a coordinate range of an area corresponding to the target leaf node;
[0012] A query module, used to query a target element from elements in an area corresponding to the target leaf node according to the first coordinates and element information of the element in the target leaf node;
[0013] The execution module is used to execute the response logic corresponding to the target element if the target element is found.
[0014] In a third aspect, an autonomous mobile robot is provided, comprising a touch screen, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the map response method described in the first aspect.
[0015] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the map response method described in the first aspect is implemented.
[0016] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the steps of the map response method described in the first aspect.
[0017] It can be understood that the beneficial effects of the second, third, fourth and fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0019] Figure 1 is a structural schematic diagram of an autonomous mobile robot provided in an embodiment of the present application;
[0020] Figure 2 It is a schematic diagram of editing a map provided in an embodiment of the present application;
[0021] Figure 3 is a schematic diagram of another map editing method provided in an embodiment of the present application;
[0022] Figure 4 is a schematic diagram of another map editing method provided in an embodiment of the present application;
[0023] Figure 5 is a schematic diagram of another map editing method provided in an embodiment of the present application;
[0024] Figure 6 It is a schematic diagram of a graphic type provided in an embodiment of the present application;
[0025] Figure 7 is a flow chart of a map response method provided in an embodiment of the present application;
[0026] Figure 8 It is a schematic diagram of area division and target tree in a map provided in an embodiment of the present application;
[0027] Fig. 9 is a schematic diagram of a viewport provided in an embodiment of the present application;
[0028] Fig.10is a schematic diagram of a target tree provided in an embodiment of the present application;
[0029] Fig.11 is a schematic diagram of an element bounding box provided in an embodiment of the present application;
[0030] Fig.12 is a schematic diagram of a triangular element provided in an embodiment of the present application;
[0031] Fig.13 is a schematic diagram of a second n-gon element provided in an embodiment of the present application;
[0032] Fig.14 is a schematic diagram of a line segment element provided in an embodiment of the present application;
[0033] Fig.15 is a structural schematic diagram of a map response device provided in an embodiment of the present application;
[0034] Fig.16 It is a structural schematic diagram of an autonomous mobile robot provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0036] It should be understood that the "multiple" mentioned in this application refers to two or more. In the description of this application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in order to facilitate the clear description of the technical solution of this application, the words "first" and "second" are used to distinguish between the same items or similar items with basically the same functions and effects. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not limit them to be different.
[0037] The phrases such as "one embodiment" or "some embodiments" described in the present application mean that the specific features, structures or characteristics described in the embodiment are included in one or more embodiments of the present application. Therefore, the phrases such as "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments" that appear in the differences in the present application do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. In addition, the terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0038] The autonomous mobile robot provided in the embodiments of the present application is described below.
[0039] The autonomous mobile robot can be applied to the goods delivery scene, such as the room delivery service in the hotel scene. Among them, the delivery scene can include airports or hotels, etc. The delivery task can be a task to provide users with delivery of goods. The first delivery area refers to a pre-designated area in the delivery scene. The autonomous mobile robot can move to the first delivery area and notify the user, and then wait for the goods to be picked up. For example, the first delivery area can be a specific location in the delivery scene, such as the door of a room in a hotel. The second delivery area is the specific address that the delivery task requires to be delivered. For example, the delivery task is to provide express delivery service for Room B in Area A. The autonomous mobile robot can move to the second delivery area, that is, the door of Room B in Area A, and call the fixed telephone in the room to notify the user to pick up the goods at the door; for another example, the delivery task is to provide food delivery service for Door D of Hotel C. The autonomous mobile robot can move to the second delivery area, that is, Door D of Hotel C, and call the phone in the door to notify the user to pick up the food at the door.
[0040] For example, assuming that the distribution scene is a hotel, the autonomous mobile robot can be a delivery robot of the hotel, and each delivery robot has identification information, such as an identity document (ID), which is used to identify the identity of the robot. The delivery area of the delivery robot of the hotel includes the room door area inside the hotel. After checking in to the hotel, the user can use the hotel's service system to order food or daily necessities, wherein the service system can be a telephone order or a mobile phone application (application, APP) order. For example, when ordering food, the user can reserve food and beverage in the APP in the mobile phone and enter the room number of the user. The APP sends the reserved food and beverage information entered by the user to the platform system of the hotel, and the platform system can generate a target delivery task according to the room number of the user and the reserved food and beverage information of the user and send it to the delivery robot in the hotel. After the delivery robot obtains the user's reserved food and beverage from the hotel staff, it moves to the target delivery area, and the target delivery area can be the area in front of the room where the user stays.
[0041] The delivery robot can send a pickup prompt to the APP in the user's mobile phone, prompting the user to move to the target delivery area to pick up the item. After the user learns of the pickup prompt from the delivery robot, he can talk to the delivery robot, and the delivery robot can inform the user of the delivered item information and the location of the target delivery area in the form of voice. After the user confirms that the item delivered by the delivery robot is the item he has reserved, he arrives at the target delivery area to obtain the item delivered by the delivery robot. For example, the delivery robot can trigger the generation of a key, which is used to confirm the pickup, such as a pickup code.
[0042] It should be noted that the above is only an example of the autonomous mobile robot being applied to a goods delivery scenario. In actual applications, the autonomous mobile robot can also be applied to other scenarios, and the embodiments of the present application do not limit this. For example, the autonomous mobile robot can be applied to a cleaning scenario. In this case, the autonomous mobile robot is a cleaning robot.
[0043] Figure 1 is a schematic diagram of the structure of an autonomous mobile robot provided in an embodiment of the present application. Figure 1 The autonomous mobile robot may include a mobile chassis 10, a shell 20 and a laser radar system 30, wherein the mobile chassis 10 may be provided with a turn signal unit 101 and a driving wheel 102, the turn signal unit 101 is provided with a plurality of turn signals 1011, and the shell 20 may be provided with a function controller 201.
[0044] It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the autonomous mobile robot. In some embodiments, the autonomous mobile robot may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0045] The mobile chassis 10 is used to control the autonomous mobile robot to move.
[0046] The turn signal unit 101 is used to indicate that the autonomous mobile robot is turning. The number of the turn signal unit 101 can be one or more. The one or more turn signal units 101 can be arranged at the front end of the mobile chassis 10. For example, see Figure 1 The turn signal unit 101 can be arranged on the left and right sides of the front end of the mobile chassis 10 .
[0047] The driving wheel 102 is used to drive the autonomous mobile robot to move. The number of the driving wheel 102 can be one or more. The one or more driving wheels 102 can be arranged at the bottom of the mobile chassis 10. For example, see Figure 1 The driving wheels 102 can be arranged on the left and right sides of the bottom of the mobile chassis 10 .
[0048] Optionally, one or more driven wheels may be further provided at the bottom of the mobile chassis 10. The one or more driven wheels are used to assist the driving wheel 102 in driving the housing 20 and the chassis 10 of the autonomous mobile robot to move, thereby reducing the load pressure of the driving wheel 102. For example, the one or more driven wheels may be provided at the rear side of the driving wheel 102.
[0049] The housing 20 is used to carry items.
[0050] The function controller 201 is used to provide function operations for the user. For example, the function controller 201 can be a touch screen. The function controller 201 can be arranged at the front end of the housing 20, or can be arranged at the top of the housing 20, which is not limited in the embodiment of the present application.
[0051] Optionally, a bottom layer controller, a component controller for controlling the moving unit, and a component controller for the environment detection unit may also be disposed in the housing 20 .
[0052] The underlying controller is used to control map generation and path planning.
[0053] The element controller of the control mobile unit is used to control the speed of the driving wheel 102 and control the turn signal unit 101 to light up in a preset sequence when the autonomous mobile robot turns. The preset sequence can be pre-set. For example, the preset sequence can be set by the user according to needs.
[0054] In some cases, if it is detected that the speed difference between the driving wheels 102 is greater than a preset value, the element controller of the control moving unit controls one or more turn lights 1011 in the turn light unit 101 to light up in a preset order.
[0055] The element controller of the environment detection unit is used to connect and process the data collected by the laser radar.
[0056] The laser radar system 30 is used to collect environmental information, perform environmental perception, obstacle recognition and self-positioning. The laser radar system 30 can be set in the autonomous mobile robot. For example, Figure 1 As shown, the laser radar system 30 can be arranged between the mobile chassis 10 and the housing 20.
[0057] Optionally, the laser radar system 30 can rotate along a preset plane. The preset plane can be preset. For example, the preset plane can be set to a horizontal plane, a vertical plane, etc., which is not limited in the embodiment of the present application.
[0058] Optionally, the autonomous mobile robot may further include a voice module, which may be connected to the element controller of the control mobile unit. The voice module is used to receive instructions sent by the element controller of the control mobile unit, and issue a voice prompt message accordingly. For example, the voice module may receive a control instruction sent by the element controller of the control mobile unit when the autonomous mobile robot turns, so as to issue a voice prompt message of turning.
[0059] In some embodiments, before executing a delivery task, the autonomous mobile robot may first obtain a map, which is a map of the movable area of the autonomous mobile robot. Specifically, the autonomous mobile robot may move, and during the movement, the position information of the autonomous mobile robot is obtained through the positioning function of the laser radar system 30, and environmental information (such as terrain, etc.) is collected through the laser radar system 30. Afterwards, an initial map corresponding to the area is constructed based on the collected position information and environmental information, and then the user edits based on the initial map to obtain the edited map and save it in the autonomous mobile robot.
[0060] After obtaining the map, the autonomous mobile robot can wait for the user to assign a delivery task, which can carry a pickup location and a delivery location. After receiving the delivery task, the autonomous mobile robot can use the laser radar system 30 to collect positioning and environmental information (including but not limited to obstacle locations), and then plan a pickup route based on the current location, pickup location and the environmental information, and pick up the goods according to the pickup route. After picking up the goods, the autonomous mobile robot can plan a delivery route based on the delivery location and the current location, and then deliver according to the delivery route. After the delivery is completed, if the autonomous mobile robot has not received a new delivery task, it can plan a route to move to a pre-set designated location to wait for receiving a new delivery task.
[0061] In some embodiments, during the map editing process, the user can add various elements to the map to perform path setting and planning, thereby helping the autonomous mobile robot improve the efficiency and accuracy of navigation, path planning, and delivery task execution.
[0062] Optionally, the multiple elements may include one or more of path elements, navigation mark elements, obstacle elements, target point elements, starting point elements, restricted area elements, etc.
[0063] The path element is used to set the moving path of the autonomous mobile robot. Figure 2 As shown, the path element may include one or more of a blue path element, a red path element, etc., wherein the blue path element can be oriented, and the red path element cannot be oriented.
[0064] For example, Figure 2 As shown in Figure (a) in the figure, you can first add a blue path element to the map, and then Figure 2 As shown in Figure (b), the moving direction of the blue path element can be set in the options of "bidirectional", "136-99", or "99-136" to indicate that the autonomous mobile robot can move according to the set path and direction. Figure 2 As shown in Figure (a), a red path element can be added to the map to indicate that the autonomous mobile robot can move along the set path.
[0065] The navigation mark element is used to help the autonomous mobile robot to perform more accurate path planning. For example, the navigation mark element may include a key point element, a label element, and a path point element.
[0066] For example, Figure 3As shown in Figure (a), a key point element 19 can be added to the map. The key point element 19 is used to help the autonomous mobile robot plan and track the path when performing a task, ensuring that the key point position corresponding to the key point element 19 can be moved to the key point position corresponding to the next key point element 20.
[0067] For example, Figure 3 As shown in Figure (b) in the figure, a label element can be added to the map. The label element is used to indicate a safe area or an area recommended for passing, so as to indicate that the autonomous mobile robot preferably passes through the area indicated by the label element.
[0068] For example, Figure 2 As shown in Figure (a) in the figure, a waypoint element 90 can be added to the map, and the waypoint element 90 is used to indicate that the position is a key path conversion point, so as to instruct the autonomous mobile robot to turn at the waypoint element 90, etc.
[0069] The starting point element is used to indicate the initial position of the autonomous mobile robot and is used to determine the starting point of path planning. For example, the position of the starting point element can be a fixed position, or can be the current position of the robot.
[0070] The target point element is used to indicate the position that the autonomous mobile robot needs to reach. For example, the target point element may include a charging pile element, an arrow element, a food outlet element, and the like.
[0071] For example, Figure 3 As shown in Figure (b), a charging pile element 1 can be added to the map. The charging pile element 1 is used to indicate that the autonomous mobile robot needs to return to the position corresponding to the charging pile element 1 after completing the task, or is used to indicate that the autonomous mobile robot needs to reach the position corresponding to the charging pile element 1 when the battery is too low.
[0072] For example, Figure 4 As shown in Figure (a) in the figure, an arrow element can be added to the map to indicate that the autonomous mobile robot needs to move to the position corresponding to the arrow element (such as the room corresponding to the room number).
[0073] For example, Figure 4 As shown in Figure (b), a food outlet element 1 can be added to the map to indicate that the autonomous mobile robot can reach the position corresponding to the food outlet element 1 to pick up food.
[0074] The obstacle element is used to indicate an object or area that the autonomous mobile robot needs to avoid during movement.
[0075] For example, the obstacle element may include a virtual wall element, a stair element, etc.
[0076] For example, Figure 4 As shown in Figures (b) and (c) in the figure, the virtual wall element can be set in the map to indicate that there is a wall (such as a glass wall) here, prohibiting the autonomous mobile robot from passing through the area corresponding to the virtual wall element.
[0077] The restricted area element is used to indicate an area where the autonomous mobile robot needs to slow down to pass. For example, the restricted area element may include a speed limit area element and a gate element, wherein the speed limit area element is used to indicate that the autonomous mobile robot needs to slow down to pass at a preset speed, and the gate element is used to allow only a specific autonomous mobile robot to pass.
[0078] The preset speed can be preset. For example, the preset speed can be set according to demand. For example, the preset speed can be set to 60% of the normal speed of the autonomous mobile robot.
[0079] For example, Figure 5 As shown in (a) and (b) of the figure, a speed limit area element can be set in the map to instruct the autonomous mobile robot to slow down to a preset speed when moving to the speed limit area, and to set the moving speed of the autonomous mobile robot in the speed limit area to 60% of the normal speed. In this way, when the autonomous mobile robot subsequently enters the speed limit area, it will automatically slow down to 60% of the normal speed to pass through.
[0080] For example, Figure 5 As shown in Figure (c) in the figure, gate 1 can be set in the map to indicate that unauthorized autonomous mobile robots are prohibited from passing through gate 1.
[0081] Optionally, each of the multiple elements in the map may include an element identifier, and the element identifier of an element is used to identify the element.
[0082] Optionally, each of the multiple elements also has a graphic type, and the graphic type of an element is a graphic displayed by the element in the map. For example, the graphic type of an element may include one or more of a circle, a triangle, an n-gon, a line segment, or a polyline, etc., where n is an integer greater than or equal to 4.
[0083] Optionally, the autonomous mobile robot may further include a map coordinate system, and the map coordinate system may be a coordinate system in which the map is located. The map coordinate system may be pre-set. For example, the upper left corner of the map may be determined as the origin of the coordinate system of the map coordinate system, or the lower left corner of the map may be determined as the origin of the coordinate system of the map coordinate system. Of course, other positions in the map may also be determined as the origin of the coordinate system of the map coordinate system, and the embodiments of the present application are not limited thereto.
[0084] In some embodiments, each of the multiple elements may also have a detection area, and the detection area of an element is the coordinate range of the graphic corresponding to the element in the map coordinate system.
[0085] For example, if the shape type of an element is a circle, then Figure 6 As shown in Figure (a) in the figure, the coordinate range of the circle in the map coordinate system is the coordinate range formed by the center position and radius of the circle; if the graphic type of an element is a triangle, then Figure 6 As shown in Figure (b) in the figure, the coordinate range of the triangle in the map coordinate system is the coordinate range formed by the three vertices of the triangle; if the graphic type of an element is a quadrilateral, then Figure 6 As shown in Figure (c) in the figure, the coordinate range of the quadrilateral in the map coordinate system is the coordinate range formed by the four vertices of the quadrilateral; if the graphic type of an element is a pentagon, then Figure 6 As shown in Figure (d) in the figure, the coordinate range of the pentagon in the map coordinate system is the coordinate range formed by the five vertices of the pentagon; if the graphic type of an element is a line segment, then Figure 6 As shown in Figure (e) in the figure, the coordinate range of the line segment in the map coordinate system is the coordinate range of the rectangle extended outward from the line segment; if the graphic type of an element is a polyline, and the polyline is composed of multiple line segments, then Figure 6 As shown in Figure (f), the coordinate range of the polyline in the map coordinate system is the coordinate range of the rectangle extended outward from each line segment in the polyline.
[0086] Optionally, each element in the map may be referred to as an object, and the elements in the map may include element information (i.e., properties of the object). For example, the element information of an element may include the element identifier of the element, the coordinate range of the element in the map, etc. In this case, each time a user adds an element to the map, the element information of the element may be added to the database for storage.
[0087] In some embodiments, a response function may also be added to the elements in the map, and the response function is used to trigger a specific event.
[0088] The response function may be triggered by a specified operation on the element. For example, the specified operation may be one or more of a click operation, a long press operation, a slide operation, and the like.
[0089] For example, Figure 3 As shown in (a) or (b) of FIG. 1 , the response function of the element 20 or the label element is used to pop up a menu, and the response function can be triggered by a click operation. Then, after the user clicks the element 20 or the label element, the corresponding menu can be popped up.
[0090] After the map is edited in the above manner, the autonomous mobile robot can plan a route according to the map, and can also display the map on the function controller 201. When the user needs to modify an element in the map, the user can modify the element in the map through the function controller 201.
[0091] In the related art, after triggering a click operation on the map, the autonomous mobile robot can compare the coordinates corresponding to the click operation with the coordinate range of each element in the map to determine the element clicked by the click operation, and perform the corresponding operation accordingly. However, as the number of elements in the map continues to increase, after the user clicks on the map, the amount of calculation required by the autonomous mobile robot will be very large, resulting in a heavy load on the central processing unit (CPU), which will not only lead to a low map response speed, but also seriously affect the rendering frame rate, resulting in poor map display smoothness and a poor user experience.
[0092] To this end, the embodiment of the present application provides a map response method, which can divide the map into multiple areas, each of which can include one or more elements. After triggering an operation on the map, the area corresponding to the operation in the map can be quickly determined according to the coordinates corresponding to the operation, and then the element targeted by the operation can be determined from the area. In this way, the amount of calculation can be greatly reduced, and the CPU load can be reduced, thereby not only improving the map response speed, but also ensuring the stability of the rendering frame rate to a certain extent, improving the smoothness of map display, and thus improving the user experience.
[0093] The map response method provided in the embodiment of the present application is explained in detail below.
[0094] Figure 7 is a flowchart of a map response method provided in an embodiment of the present application. The map response method can be applied to Figure 1 The autonomous mobile robot shown in FIG. 1 may include a touch screen. Figure 7 , the method comprises the following steps:
[0095] Step 701: The autonomous mobile robot displays a map on a touch screen, where the map includes one or more elements, and the map corresponds to a target tree.
[0096] The target tree is a tree structure. The target tree includes branch nodes and leaf nodes at the bottom of the target tree, where a node with 0 child nodes is a leaf node, and a node with 1 child nodes or more is a branch node. The topmost branch node in the target tree can be called a root node, which is a branch node without a parent node in the target tree.
[0097] The target tree includes at least one branch node and multiple leaf nodes, the multiple leaf nodes correspond to multiple areas in the map one by one, each of the multiple leaf nodes includes element information of elements in the corresponding area, and each of the at least one branch node includes the coordinate range of the area corresponding to the subordinate node. For example, the element information of the element includes the element identifier, coordinate range, etc. of the element. The coordinate range of the area in the map and the coordinate range of the element in the map are both determined based on the map coordinate system of the map.
[0098] The correspondence between the map and the target tree means that the target tree covers the entire map space. Specifically, the map can be divided into multiple regions, and then the element information of the elements in the multiple regions is stored one by one in multiple leaf nodes in the target tree. In this case, a leaf node in the target tree includes the element information of each element in all elements in the corresponding region, and a branch node includes the coordinate range of the region corresponding to its subordinate node (leaf node or branch node).
[0099] It should be noted that, if an element spans at least two regions, then at least two leaf nodes corresponding one-to-one to the at least two regions both include element information of the element.
[0100] In the embodiment of the present application, the hierarchical structure of the target tree can make the management of complex map data more organized, so that after the user edits the map, the map can be quickly updated and maintained accordingly.
[0101] Optionally, the target tree is an m-ary tree, that is, the maximum number of child nodes of each branch node in the target tree is m, where m is an integer greater than or equal to 2.
[0102] For example, the target tree is a quadtree. In this case, if Figure 8 As shown in Figure (a), the map can be divided into 12 areas. Figure 8 As shown in Figure (b), since area 1 is composed of area 5, area 6, area 7 and area 8, and area 8 is composed of area 9, area 10, area 11 and area 12, area 1 and area 8 correspond to a branch node in the target tree respectively; and each of area 2, area 3, area 4, area 5, area 6, area 7, area 9, area 10, area 11 and area 12 is an independent area, so each of these areas corresponds to a leaf node in the target tree; in particular, the map is composed of area 1, area 2, area 3 and area 4, so the entire area of the map corresponds to the root node in the target tree.
[0103] In some embodiments, the operation of the autonomous mobile robot displaying a map on the touch screen may include the following two methods:
[0104] The first mode: the autonomous mobile robot displays an initial map on the touch screen, where the initial map includes environmental information; and each element of the one or more elements is displayed in sequence in the initial map.
[0105] The initial map is a map with no elements displayed yet.
[0106] The environment information may include detailed data of the real environment corresponding to the initial map, such as walls, doors, stairs, obstacles, corridor layout, room configuration, etc.
[0107] For example, the element information of each of the one or more elements may be pre-stored in a database. After the autonomous mobile robot displays the initial map on the touch screen, it may sequentially read the element information of each of the one or more elements stored in the database, and then display the read elements in the initial map. After the element information of all elements in the database is read, all elements are correspondingly displayed in the initial map. The initial map that displays all elements may be called a map.
[0108] The second method: the autonomous mobile robot displays the map in a viewport in the touch screen.
[0109] like Fig. 9 As shown, the viewport in the touch screen refers to the visible area in the touch screen, which is used to display part of the area or all of the area in the map.
[0110] The viewport has a viewport coordinate system. The viewport coordinate system of the viewport can be preset. For example, the upper left corner of the viewport can be determined as the origin of the coordinate system of the viewport coordinate system, or the lower left corner of the viewport can be determined as the origin of the coordinate system of the viewport coordinate system. Of course, other positions in the viewport can also be determined as the origin of the coordinate system of the viewport coordinate system, which is not limited in the embodiments of the present application.
[0111] There is a mapping relationship between the viewport coordinate system and the map coordinate system of the map, and the mapping relationship can be reflected by the first transformation matrix. That is, the conversion between the coordinates in the viewport coordinate system and the coordinates in the map coordinate system can be achieved according to the first transformation matrix.
[0112] In some embodiments, after displaying the map, the autonomous mobile robot can generate a unit matrix as a first transformation matrix; if a second operation acting on the map is detected, a second transformation matrix is determined based on operation information of the second operation; and the current first transformation matrix is multiplied by the second transformation matrix to obtain a new first transformation matrix.
[0113] The first transformation matrix has an initial value. For example, the initial value of the first transformation matrix may be a value in the following identity matrix:
[0114]
[0115] The second operation is an operation of the user on the map displayed in the viewport. The second operation can adjust the area of the map displayed in the viewport.
[0116] For example, the second operation may be one or more of a translation operation, a zoom operation, a rotation operation, etc. of the map. For example, the second operation of the user on the map in the viewport may be a two-finger zoom, a drag, a two-finger rotation, etc., which is not limited in the present embodiment.
[0117] For example, the operation information of the translation operation may be the translation distance, the operation information of the zoom operation may be the zoom ratio, and the operation information of the rotation operation may be the rotation angle.
[0118] The second transformation matrix is a matrix generated according to the operation information of the second operation, and may indicate the affine transformation brought about by the second operation.
[0119] For example, the second transformation matrix determined according to the operation information of the translation operation may be as follows:
[0120]
[0121] Wherein, x is the translation distance of the map in the viewport coordinate system in the horizontal direction caused by the translation operation, and y is the translation distance of the map in the viewport coordinate system in the vertical direction caused by the translation operation.
[0122] If x is greater than 0, it means translation in the positive direction of the horizontal axis; if x is equal to 0, it means no movement in the horizontal direction; if x is less than 0, it means translation in the negative direction of the horizontal axis. If y is greater than 0, it means translation in the positive direction of the vertical axis; if y is equal to 0, it means no movement in the vertical direction; if y is less than 0, it means translation in the negative direction of the vertical axis.
[0123] For example, the second transformation matrix determined according to the operation information of the scaling operation may be as follows:
[0124]
[0125] Among them, scale x is the scaling ratio of the map in the viewport coordinate system in the horizontal direction of the zoom operation, and x is the scaling factor in the horizontal direction; scale y is the scaling ratio of the map in the viewport coordinate system in the vertical direction of the zoom operation, and y is the scaling factor in the vertical direction.
[0126] If x is greater than 1, it means enlarging in the horizontal direction; if x is equal to 1, it means not scaling in the horizontal direction; if x is less than 1, it means shrinking in the horizontal direction. If y is greater than 1, it means enlarging in the vertical direction; if y is equal to 1, it means not scaling in the vertical direction; if y is less than 1, it means shrinking in the vertical direction.
[0127] For example, the second transformation matrix determined according to the operation information of the rotation operation may be as follows:
[0128]
[0129] Among them, θ is the rotation angle of the rotation operation; cosθ represents the scaling factor, which is used to adjust the horizontal and vertical components after rotation; -sinθ represents the influence factor in the horizontal direction after rotation, which is used to adjust the horizontal component after rotation; sinθ represents the influence factor in the vertical direction, which is used to adjust the vertical component after rotation.
[0130] If the autonomous mobile robot detects a second operation acting on the map, it means that the user is currently adjusting the map in the viewport, then the map area displayed in the viewport may change, and the mapping relationship between the viewport coordinate system and the map coordinate system will also change accordingly. In this case, a second transformation matrix for representing the operation information of the second operation can be determined first. Since the second transformation matrix can represent the specific operation performed by the user on the map in the viewport, the current first transformation matrix can be multiplied by the second transformation matrix to obtain a new first transformation matrix to indicate the mapping relationship between the viewport coordinate system and the map coordinate system of the adjusted map.
[0131] In some embodiments, the first method and the second method mentioned above can be combined, that is, when the autonomous mobile robot displays a map on the touch screen, it can first display the initial map in the viewport on the touch screen, and then display each element of one or more elements in the initial map in turn.
[0132] In some embodiments, the autonomous mobile robot may construct an initial m-ary tree during the process of displaying the initial map. In this case, each time the autonomous mobile robot displays an element in the initial map, the element information of the element may be stored in a leaf node corresponding to the region where the element is located. Then, when the autonomous mobile robot has displayed all elements in the initial map, the m-ary tree is successfully constructed.
[0133] The initial m-ary tree includes a root node and m leaf nodes, and the m leaf nodes are all child nodes of the root node. The initial m-ary tree can be constructed based on the coordinate ranges of the m areas pre-divided in the map. For example, the m areas can be obtained by equally dividing the entire area of the map. The m leaf nodes in the initial m-ary tree correspond to the m areas one by one, and the root node in the initial m-ary tree includes the coordinate ranges of the areas corresponding to the m leaf nodes under it. Each leaf node in the initial m-ary tree has not yet stored element information.
[0134] In the embodiment of the present application, the target tree can be constructed only when needed, so that the memory usage can be reduced. In addition, the method of storing the element information of the element to the leaf node while displaying the element can ensure the consistency of the element information in the map and the element information in the target tree, thereby avoiding the possible data outdated problem to a certain extent.
[0135] It should be noted that the embodiment of the present application can not only construct the target tree during the process of displaying the map, but also pre-construct the target tree before displaying the map.
[0136] For example, when the autonomous mobile robot pre-constructs the target tree, it can first construct an initial m-ary tree, and then store all the elements in the map in multiple leaf nodes in the initial m-ary tree according to the area where each element in the map is located to obtain an m-ary tree.
[0137] In some embodiments, if the user adds a new element to the map during the map display process, the autonomous mobile robot may update the target tree accordingly. This process may include the following steps 1 to 3:
[0138] Step 1: The autonomous mobile robot receives a new instruction.
[0139] The new addition instruction carries the element information of the element to be added, and the element information includes the coordinate range of the element. The new addition instruction is used to instruct to add an element to the map. The new addition instruction can be triggered by the user, for example, the user can trigger the new addition instruction through operations such as clicking, long pressing, sliding, voice, gesture or somatosensory operation.
[0140] Step 2: The autonomous mobile robot indexes the first leaf node in the target tree according to the coordinate range of the element.
[0141] The first leaf node corresponds to the area where the element is located in the map. That is, the coordinate range of the element is within the coordinate range of the area corresponding to the first leaf node.
[0142] For example, the autonomous mobile robot may index nodes layer by layer from the root node of the target tree downwards according to the coordinate range of the element until a leaf node is indexed, and the leaf node is the first leaf node.
[0143] Specifically, the autonomous mobile robot can determine the coordinate range of a child node of the root node of the target tree in which the coordinate range of the element is located, and this process is to index the next node. After determining that the coordinate range of the element is in the coordinate range of a child node of the root node, this child node is the next node indexed.
[0144] If this node is a branch node, then we can continue to determine which child node of this node the coordinate range of the element is in, that is, continue to index the next node until the indexed node is a leaf node, which is the first leaf node.
[0145] If this node is a leaf node, then it can be determined that this node is the first leaf node.
[0146] Step 3: The autonomous mobile robot stores the element information of the element to the first leaf node.
[0147] It should be noted that if the coordinate range of the element is located in at least two regions, that is, if the element spans at least two regions, it will eventually index at least two first leaf nodes. Then, the element information of the element needs to be stored in each of the at least two first leaf nodes.
[0148] In some embodiments, after the autonomous mobile robot stores the element information of an element in a leaf node, such as after storing the element information of an element in a leaf node in the initial m-ary tree in the target tree construction process, or after storing the element information of an element in a first leaf node in the target tree in the process of adding an element, the autonomous mobile robot may also determine the amount of element information in the leaf node to determine whether the map needs to be further divided into regions according to the amount of element information. This process may include the following steps (1) to (4):
[0149] Step (1): If the number of element information in the leaf node is greater than a preset number, the autonomous mobile robot determines the area corresponding to the leaf node as the target area, and obtains multiple element information in the leaf node.
[0150] The preset number is used to indicate the maximum number of element information that can be stored in the leaf node. The preset number can be preset. For example, the preset number can be set by the user according to demand. For example, the preset number can be set to 7, 8, 9, etc., which is not limited in the embodiment of the present application.
[0151] The target area is the area that needs to be divided.
[0152] If the number of element information in the leaf node is greater than the preset number, it means that the number of element information currently stored in the leaf node has exceeded the maximum number, then it can be determined that the leaf node needs to be split, so the area corresponding to the leaf node can be determined as the target area (that is, the area that needs to be divided).
[0153] If the number of element information in the leaf node is less than or equal to the preset number, it means that the number of element information currently stored in the leaf node has not exceeded the maximum number, so it can be determined that the leaf node does not need to be split yet.
[0154] Step (2): The autonomous mobile robot divides the target area into m areas.
[0155] Each of the m regions is a part of the target region, and each of the m regions has a coordinate range. For example, the target region may be divided into m regions.
[0156] Step (3): The autonomous mobile robot uses the leaf node as a new branch node and constructs m child nodes of the new branch node. The new branch node includes the coordinate range of each area in the m areas, and the m child nodes correspond one-to-one to the m areas.
[0157] The m child nodes are m leaf nodes corresponding one-to-one to the m regions.
[0158] Since the target area is divided into the m areas, the leaf node can be determined as a new branch node, and since the m areas are obtained by dividing the target area, the new branch node includes the coordinate range of each area in the m areas, and each of the m child nodes of the new branch node corresponds to one area in the m areas.
[0159] Step (4): The autonomous mobile robot stores the multiple element information into the m child nodes respectively.
[0160] It should be noted that, since the target area is divided into m areas, there may be a situation where part of an element is divided into one area and the other part is divided into other areas. In this case, for such an element divided into multiple areas, the element information of the element can be stored in the leaf node corresponding to each area in the multiple areas, to indicate that the element is in the multiple areas.
[0161] Since each of the m regions has a coordinate range, and each of the multiple element information includes a coordinate range, the coordinate range in each of the multiple element information can be compared with the coordinate range of each of the m regions to determine in which region of the m regions the element indicated by the element information is located. After determining the region where the element is located, the element information is stored in the leaf node corresponding to the region.
[0162] For example, it is assumed that the preset number is 8. Fig.10 Figure (a) in the figure is the initial quadtree, and the number of element information in the leaf node corresponding to region 1 in the initial quadtree is 8. Fig.10 As shown in Figure (b) in the figure, the autonomous mobile robot stores new element information in the leaf node corresponding to area 1 in the initial quadtree, and then determines that the number of element information in the leaf node corresponding to area 1 is 9, which is greater than the preset number 8. Fig.10 As shown in Figure (c), the autonomous mobile robot determines area 1 as the target area, determines the leaf node corresponding to area 1 as the new branch node, divides area 1 into area 5, area 6, area 7 and area 8; constructs leaf nodes corresponding to area 5, area 6, area 7 and area 8 as child nodes of the new branch node, and then stores the element information of the elements in area 1 in the leaf nodes corresponding to area 5, area 6, area 7 and area 8 according to the coordinate range.
[0163] In some embodiments, each element in the map also has a node list attribute. The node list attribute of an element may include the identifier of each leaf node in all leaf nodes where the element information of the element is located. In this case, all leaf nodes storing the element information of the element in the target tree can be quickly queried through the node list attribute of the element.
[0164] Step 702: If the autonomous mobile robot detects a first operation acting on the map, determine a first coordinate of the first operation in a map coordinate system of the map.
[0165] For example, the first operation may be a tap operation, a long press operation, etc., which is not limited in the embodiment of the present application.
[0166] In some embodiments, if the autonomous mobile robot displays the map in a viewport, then after detecting a first operation acting on the map, the autonomous mobile robot can directly obtain a second coordinate of the first operation in the viewport coordinate system of the viewport, and then convert the second coordinate into the first coordinate.
[0167] Optionally, the operation of the autonomous mobile robot converting the second coordinate into the first coordinate may be: converting the second coordinate according to a first transformation matrix to obtain the first coordinate.
[0168] The first transformation matrix is used to indicate the mapping relationship from the viewport coordinate system to the map coordinate system. For example, the second coordinate can be converted into the first matrix, the value of the first row of the first matrix is the horizontal coordinate in the second coordinate, the value of the second row is the vertical coordinate in the second coordinate, and the value of the third row is 1; the first transformation matrix is multiplied by the first matrix to obtain the second matrix; the value of the first row and the value of the second row in the second matrix are used as the horizontal coordinate and the vertical coordinate respectively to obtain the first coordinate.
[0169] Step 703: The autonomous mobile robot determines a target leaf node indexed by the first coordinate in the target tree, and the first coordinate is within a coordinate range of an area corresponding to the target leaf node.
[0170] For example, the autonomous mobile robot can index nodes layer by layer from the root node of the target tree downwards according to the first coordinate until a leaf node is indexed, and the leaf node is the target leaf node.
[0171] Specifically, the autonomous mobile robot can determine the coordinate range of a child node of the root node of the target tree where the first coordinate is located, and this process is to index the next node. After determining that the first coordinate is within the coordinate range of a child node of the root node, this child node is the next node indexed.
[0172] If this node is a branch node, then we can continue to determine which child node of this node the first coordinate is in, that is, continue to index the next node until the indexed node is a leaf node, which is the target leaf node.
[0173] If this node is a leaf node, then it can be determined that this node is the target leaf node.
[0174] It should be noted that the map corresponds to the target tree, and the multiple leaf nodes in the target tree correspond one-to-one to the multiple areas in the map, and each of the multiple leaf nodes includes element information of the elements in the corresponding area. Therefore, by indexing the target leaf node in the target tree, the areas where the first operation does not take effect can be quickly filtered out from the multiple areas in the map, thereby reducing the areas that need to be checked when confirming the elements operated by the first operation, and can greatly reduce the number of elements that need to be queried subsequently.
[0175] Step 704: The autonomous mobile robot searches for a target element from elements in an area corresponding to the target leaf node according to the first coordinate and element information of the element in the target leaf node.
[0176] The target element is the element targeted by the first operation, that is, the element that can respond to the first operation.
[0177] In the embodiment of the present application, after the autonomous mobile robot indexes the target leaf node in the target tree according to the first coordinate, it can directly query the target element in the elements in the area corresponding to the target leaf node, without querying the target element in the elements in the areas corresponding to other leaf nodes. In this way, the number of elements required to be queried can be greatly reduced, the amount of calculation can be reduced, and the CPU load can be reduced, thereby not only improving the map response speed, but also ensuring the stability of the rendering frame rate to a certain extent, improving the smoothness of map display, and thus improving the user experience.
[0178] In some embodiments, the operation of the autonomous mobile robot querying the target element from the elements in the area corresponding to the target leaf node according to the first coordinate and the element information of the element in the target leaf node may include the following two methods:
[0179] The first method: if the number of element information in the target leaf node is 0, the autonomous mobile robot determines that the target element is not found; if the number of element information in the target leaf node is greater than 0, then for any element information in the target leaf node, based on the first coordinate and the coordinate range in the element information, determine whether the element identified by the element identifier in the element information is the target element.
[0180] If the number of element information in the target leaf node is 0, it means that there is no element in the area corresponding to the target leaf node, so it can be determined that the target element has not been found. If the number of element information in the target leaf node is greater than 0, it means that there may be a target element in the area corresponding to the target leaf node, so it can be determined whether the element identified by the element identifier in the element information is the target element based on the first coordinate and the coordinate range in the element information in the target leaf node.
[0181] Optionally, the autonomous mobile robot determines whether the element identified by the element identifier in the element information is the target element based on the first coordinate and the coordinate range in the element information. The operation may be as follows: if the first coordinate is within the coordinate range in the element information, then the element identified by the element identifier in the element information is determined to be the target element; if the first coordinate is not within the coordinate range in the element information, then the element identified by the element identifier in the element information is determined not to be the target element.
[0182] If the elements identified by the element identifiers in all the element information in the target leaf node are not the target elements, it can be determined that the target element has not been found.
[0183] The second method: If the number of element information in the target leaf node is 0, the autonomous mobile robot determines that the target element has not been found. If the number of element information in the target leaf node is greater than 0, the autonomous mobile robot obtains the coordinate range of the viewport where the map is located in the map coordinate system; for any element information in the target leaf node, if the coordinate range in the element information is not within the coordinate range of the viewport, it is determined that the element identified by the element identifier in the element information is not the target element; if the coordinate range in the element information is within the coordinate range of the viewport, it is determined whether the element identified by the element identifier in the element information is the target element based on the first coordinate and the coordinate range in the element information.
[0184] The coordinate range of the viewport where the map is located in the map coordinate system is the coordinate range that the user can operate in the map, so the element information of the elements in the target leaf node that are not in the viewport can be filtered out by the coordinate range of the viewport in the map coordinate system. For the element information of the element in the target leaf node that is in the viewport, it can be determined whether the element identified by the element identifier in the element information is the target element based on the first coordinate and the coordinate range in the element information.
[0185] Optionally, the autonomous mobile robot determines whether the element identified by the element identifier in the element information is the target element based on the first coordinate and the coordinate range in the element information. The operation may be as follows: if the first coordinate is within the coordinate range in the element information, then the element identified by the element identifier in the element information is determined to be the target element; if the first coordinate is not within the coordinate range in the element information, then the element identified by the element identifier in the element information is determined not to be the target element.
[0186] If the elements identified by the element identifiers in all the element information in the target leaf node are not the target elements, it can be determined that the target element has not been found.
[0187] In this way, the elements in the area corresponding to the target leaf node that are not in the viewport can be quickly filtered out without performing coordinate range inclusion calculations on these elements, thereby reducing the amount of calculation when querying the target element and improving element query efficiency.
[0188] In some cases, in the first method or the second method mentioned above, before the autonomous mobile robot determines whether the element identified by the element identifier in the element information is the target element based on the first coordinate and the coordinate range in the element information, for the element identified by the element identifier in the element information, the autonomous mobile robot can determine whether the first coordinate is within the coordinate range of the bounding box of the element; if the first coordinate is within the coordinate range of the bounding box of the element, then determine whether the element is the target element based on the first coordinate and the coordinate range in the element information; if the first coordinate is not within the coordinate range of the bounding box of the element, it can be determined that the element is not the target element.
[0189] The two sides of the bounding box of the element in the horizontal direction are parallel to the horizontal axis in the map coordinate system, and the two sides of the bounding box of the element in the vertical direction are parallel to the vertical axis in the map coordinate system. For example, the bounding box of the element can be the circumscribed rectangle of the element, such as the minimum circumscribed rectangle.
[0190] For example, the autonomous mobile robot can obtain the maximum horizontal coordinate value, the minimum horizontal coordinate value, the maximum vertical coordinate value and the minimum vertical coordinate value of the coordinate range of the element, and then generate four vertex coordinates based on the maximum horizontal coordinate value, the minimum horizontal coordinate value, the maximum vertical coordinate value and the minimum vertical coordinate value, and determine the four vertex coordinates as the coordinate range information of the bounding box of the element.
[0191] The four vertex coordinates may include a coordinate consisting of the minimum horizontal coordinate value and the minimum vertical coordinate value, a coordinate consisting of the minimum horizontal coordinate value and the maximum vertical coordinate value, a coordinate consisting of the maximum horizontal coordinate value and the minimum vertical coordinate value, and a coordinate consisting of the maximum horizontal coordinate value and the maximum vertical coordinate value.
[0192] For example, Fig.11 As shown, the element includes four vertices, namely A(2,4), B(4,5), C(7,3.8) and D(6,1). Then the minimum horizontal coordinate value of the element is 2, the maximum vertical coordinate value is 5, the maximum horizontal coordinate value is 7, and the minimum vertical coordinate value is 1. By combining the minimum horizontal coordinate value 2, the maximum horizontal coordinate value 7, the minimum vertical coordinate value 1 and the maximum vertical coordinate value 5, the coordinates of the four vertices of the bounding box of the element can be obtained as a(2,1), b(2,5), c(7,5) and d(7,1). The coordinates of the four vertices are the coordinate range information of the bounding box.
[0193] If the first coordinate is within the coordinate range of the bounding box of the element, it means that the coordinate range of the element may include the first coordinate, that is, the element may be the target element, so whether the element is the target element can be further determined based on the first coordinate and the coordinate range of the element; if the first coordinate is not within the coordinate range of the bounding box of the element, it means that the coordinate range of the element does not include the first coordinate, that is, the element is not the target element.
[0194] Since the bounding box of the element is a regular shape, the operation of determining whether the first coordinate is within the coordinate range of the bounding box of the element is relatively simple and requires less calculation. The elements whose first coordinates are not within the coordinate range of their bounding boxes can be filtered out quickly, reducing the number of elements that need to perform element coordinate range inclusion calculations, thereby further reducing the amount of calculations and improving element query efficiency.
[0195] In some embodiments, the operation of the autonomous mobile robot to determine whether the first coordinate is within the coordinate range of the bounding box of the element may be: if the horizontal coordinate value of the first coordinate is greater than or equal to the minimum horizontal coordinate value of the coordinate range of the bounding box of the element and less than or equal to the maximum horizontal coordinate value of the coordinate range of the bounding box of the element, and the vertical coordinate value of the first coordinate is greater than or equal to the minimum vertical coordinate value of the coordinate range of the bounding box of the element and less than or equal to the maximum vertical coordinate value of the coordinate range of the bounding box of the element, then it is determined that the first coordinate is within the coordinate range of the bounding box of the element; if the horizontal coordinate value of the first coordinate is less than the minimum horizontal coordinate value of the coordinate range of the bounding box of the element or greater than the maximum horizontal coordinate value of the coordinate range of the bounding box of the element, and / or, if the vertical coordinate value of the first coordinate is less than the minimum vertical coordinate value of the coordinate range of the bounding box of the element or greater than the maximum vertical coordinate value of the coordinate range of the bounding box of the element, then it is determined that the first coordinate is not within the coordinate range of the bounding box of the element.
[0196] In some embodiments, the operation of the autonomous mobile robot determining whether the element identified by the element identifier in the element information is the target element based on the first coordinate and the coordinate range in the element information may be as follows: for the element identified by the element identifier in the element information, the autonomous mobile robot determines the target algorithm corresponding to the graphic type of the element; based on the first coordinate and the coordinate range of the element, determines whether the first coordinate is within the coordinate range of the element through the target algorithm corresponding to the graphic type of the element; if the first coordinate is within the coordinate range of the element, determines that the element is the target element; if the first coordinate is not within the coordinate range of the element, determines that the element is not the target element.
[0197] For example, the graphic type of the element may be a circle, a triangle, an n-gon, a line segment, a polyline, etc., where n is an integer greater than or equal to 4.
[0198] The target algorithm is an algorithm for determining whether the first coordinate is within the coordinate range of the element. Different graphic types correspond to different target algorithms. A target algorithm corresponding to a graphic type is an algorithm that is more suitable for the graphic type, and when the target algorithm corresponding to the graphic type is used to perform coordinate range inclusion calculations of elements belonging to the graphic type, the accuracy is higher and the amount of calculation required is less.
[0199] In an embodiment of the present application, the autonomous mobile robot can select a corresponding target algorithm according to the graphic type of the element to determine whether the first coordinate is within the coordinate range of the element. This can not only improve accuracy but also reduce the amount of calculation.
[0200] In some embodiments, if the graphic type of the element is a circle, the coordinate range information of the element may include the center coordinates and radius of the element. In this case, the target algorithm corresponding to the circle is: determine the distance between the center coordinates and the first coordinate; if the distance is less than or equal to the radius, determine that the first coordinate is within the coordinate range of the element; if the distance is greater than the radius, determine that the first coordinate is not within the coordinate range of the element.
[0201] In this case, whether the first coordinate is within the coordinate range of the element can be determined only by the distance between the first coordinate and the coordinate of the center of the circle, which is simple to operate and requires less calculation.
[0202] In some embodiments, if the graphic type of the element is a triangle, the coordinate range information of the element includes the coordinates of the three vertices of the element. In this case, the target algorithm corresponding to the triangle is: for one vertex among the three vertices, determine the two edges of the element that include this vertex; determine the first vector of the coordinate point from this vertex to the first coordinate; decompose the first vector along the direction of each of the two edges to obtain two second vectors; for any one of the two edges, determine the ratio of the length of the second vector along the direction of this edge to the length of this edge; determine whether the first coordinate is within the coordinate range of the element according to the ratio corresponding to each of the two edges.
[0203] For one of the two edges, the ratio of the length of the second vector along the direction of this edge to the length of this edge can reflect the distance between the coordinate point of the first coordinate and this edge. The larger the ratio, the greater the distance between the coordinate point of the first coordinate and this edge, and the smaller the ratio, the smaller the distance between the coordinate point of the first coordinate and this edge. Correspondingly, the ratio of the length of the second vector along the direction of the other edge to the length of the other edge can reflect the distance between the coordinate point of the first coordinate and the other edge.
[0204] In some embodiments, the operation of determining whether the first coordinate is within the coordinate range of the element based on the ratio corresponding to each of the two sides may be: if the ratio corresponding to each of the two sides is equal to 0, then it is determined that the first coordinate is within the coordinate range of the element; if the ratio corresponding to each of the two sides is greater than 0 and the sum of the ratios corresponding to each of the two sides is less than or equal to 1, then it is determined that the first coordinate is within the coordinate range of the element; if the sum of the ratios corresponding to each of the two sides is greater than 1, then it is determined that the first coordinate is not within the coordinate range of the element.
[0205] If the ratio corresponding to each of the two sides is equal to 0, it means that the coordinate point of the first coordinate is on the vertex of the triangle, so it can be determined that the first coordinate is within the coordinate range of the element.
[0206] If the ratio corresponding to each of the two sides is greater than 0 and the sum of the ratio corresponding to each of the two sides is less than 1, it means that the coordinate point of the first coordinate is within the triangle, so it can be determined that the first coordinate is within the coordinate range of the element.
[0207] If the ratio corresponding to each of the two sides is greater than 0 and the sum of the ratio corresponding to each of the two sides is equal to 1, it means that the coordinate point of the first coordinate is on the edge of the triangle, so it can be determined that the first coordinate is within the coordinate range of the element.
[0208] If the sum of the ratios corresponding to each of the two sides is greater than 1, it means that the coordinate point of the first coordinate is outside the triangle, and thus it can be determined that the first coordinate is not within the coordinate range of the element.
[0209] In this way, it is possible to directly determine whether the first coordinate is within the coordinate range of the triangle without considering the boundary problem between the ray and the triangle caused by the ray method in the related art, and the amount of calculation required is relatively small.
[0210] For example, Fig.12 As shown, the coordinates of the three vertices of triangle ABC are A(1,1), B(2.3,4), and C(4,1), and the coordinate point of the first coordinate is P(2.5,2). Connect point A and point P to get the first vector AP. Decompose the first vector AP along the sides AB and AC to get vector AE and vector AF. Then determine that the ratio of the length of vector AE to the side AB is 0.6, and determine that the ratio of the length of vector AF to the side AC is 0.33. The sum of these two ratios is 0.93, which is less than 1, so it can be determined that the first coordinate P(2.5,2) is inside triangle ABC.
[0211] In some embodiments, the n-gon includes a first n-gon, each side of the first n-gon is parallel to a coordinate axis of the map coordinate system, and the first n-gon is a rectangle. If the graphic type of the element is the first n-gon, the coordinate range information of the element includes the coordinates of the four vertices of the element. In this case, the target algorithm corresponding to the first n-gon is: obtain the maximum horizontal coordinate value, the minimum horizontal coordinate value, the maximum vertical coordinate value and the minimum vertical coordinate value of the coordinates of the four vertices; if the horizontal coordinate value of the first coordinate is greater than or equal to the minimum horizontal coordinate value and less than or equal to the maximum horizontal coordinate value, and the vertical coordinate value of the first coordinate is greater than or equal to the minimum vertical coordinate value and less than or equal to the maximum vertical coordinate value, then determine that the first coordinate is within the coordinate range of the element; if the horizontal coordinate value of the first coordinate is less than the minimum horizontal coordinate value or greater than the maximum horizontal coordinate value, and / or, if the vertical coordinate value of the first coordinate is less than the minimum vertical coordinate value or greater than the maximum vertical coordinate value, then determine that the first coordinate is not within the coordinate range of the element.
[0212] In some embodiments, the n-gon includes a second n-gon, and there are edges in the second n-gon that are not parallel to both coordinate axes of the map coordinate system. If the graphic type of the element is the second n-gon, then the coordinate range information of the element includes the coordinates of the n vertices of the element and the connection relationship of the n vertices. In this case, the target algorithm corresponding to the second n-gon is: according to the coordinates of the n vertices and the connection relationship of the n vertices, determine the coordinate range of each of the n edges of the element. If the first edge does not exist in the n edges, it is determined that the first coordinate is not within the coordinate range of the element, and the ordinate range in the coordinate range of the first edge includes the ordinate value of the first coordinate. If the first edge exists in the n edges, then for any first edge in the n edges, determine the cross product value of the vectors from the coordinate point of the first coordinate to the two endpoints of the first edge respectively; determine whether the first edge is the second edge according to the cross product value; and determine whether the first coordinate is within the coordinate range of the element according to the number of second edges in the n edges.
[0213] The connection relationship of the n vertices is used to indicate the connection order between the n vertices. For example, the connection order between the n vertices can be clockwise connection or counterclockwise connection.
[0214] For any one of the n edges of the element, the coordinate range information of the edge may include the coordinates of each of the two endpoints of the edge. For example, assuming that the coordinates of the two endpoints of the edge are (1,5) and (2,7), the horizontal coordinate range of the edge is 1 to 2, and the vertical coordinate range is 5 to 7.
[0215] Optionally, the coordinate range of each of the n edges may be a left-closed and right-open interval. In this way, when the coordinate point of the first coordinate is a vertex of the element, repeated calculations can be avoided.
[0216] The cross product values of the vectors from the coordinate point of the first coordinate to the two endpoints of the first side can be used to determine the relationship between the coordinate point of the first coordinate and the first side.
[0217] Specifically, if the cross product value is less than 0, it means that the coordinate point of the first coordinate is in the counterclockwise direction of the first side, so a ray parallel to the horizontal axis with the coordinate point of the first coordinate as the endpoint in the positive direction of the horizontal axis will intersect with the first side, so it can be determined that the first side is the second side. If the cross product value is equal to 0, it means that the coordinate point of the first coordinate is on the first side, so it can be determined that the first side is the second side. If the cross product value is greater than 0, it means that the coordinate point of the first coordinate is in the clockwise direction of the first side, so a ray parallel to the horizontal axis with the coordinate point of the first coordinate as the endpoint in the positive direction of the horizontal axis will not intersect with the first side, so it can be determined that the first side is not the second side.
[0218] For example, assuming that the positive direction of the horizontal axis is to the right, if the coordinate point of the first coordinate is on the left side of the first side, or if the coordinate point of the first coordinate is on the first side, it can be determined that the first side is the second side; if the coordinate point of the first coordinate is on the right side of the first side, it can be determined that the first side is not the second side.
[0219] If the first edge does not exist in the n edges of the element, it means that the ordinate value of the first coordinate is not within the ordinate range of the n edges, so it can be determined that the first coordinate is not within the coordinate range of the element.
[0220] If the first edge exists in the n edges, it means that the ordinate value of the first coordinate is within the ordinate range of one or more edges in the n edges, and the first coordinate may be within the coordinate range of the element. In this case, whether the first coordinate is within the coordinate range of the element can be determined based on the number of second edges in the first edge.
[0221] In this way, it is possible to directly determine whether the first coordinate is within the coordinate range of the polygon without considering the situation in the ray method in the related art where the ray coincides with the edge of the polygon or the vertex of the polygon, and less calculation is required.
[0222] In some embodiments, the operation of determining whether the first coordinate is within the coordinate range of the element based on the number of second edges among the n edges can be: if the number of second edges among the n edges is an odd number, determining that the first coordinate is within the coordinate range of the element; if the number of second edges among the n edges is an even number, determining that the first coordinate is not within the coordinate range of the element.
[0223] If the number of the second sides among the n sides is an odd number, it means that the number of intersections between the ray with the coordinate point of the first coordinate as the endpoint and extending in the positive direction of the horizontal axis and the n sides is an odd number, then it can be determined that the coordinate point of the first coordinate is located in the second n-gon, that is, the first coordinate is within the coordinate range of the element.
[0224] If the number of the second sides among the n sides is an even number, it means that the number of intersections between the ray with the coordinate point of the first coordinate as the endpoint and extending in the positive direction of the horizontal axis and the n sides is an even number, then it can be determined that the coordinate point of the first coordinate is outside the second n-gon, that is, the first coordinate is not within the coordinate range of the element.
[0225] For example, Fig.13 As shown, the coordinates of the four vertices of the second n-gon ABCD are A(1,2), B(2,5), C(5,4), and D(4,1), and the coordinate point of the first coordinate is P(3.5,2.5). It can be seen that the vertical coordinate range of side AB is 2 to 5, the vertical coordinate range of side BC is 4 to 5, the vertical coordinate range of side AD is 1 to 2, and the vertical coordinate range of side CD is 1 to 4. According to the vertical coordinate value of the coordinate point P of the first coordinate of 2.5, side CD is determined as the first side from side AB, side BC, side AD, and side BD, and then vector PC and vector PD are determined. The cross product value of vector PC and vector PD is calculated to be 1.6. The cross product value is greater than 0, so it can be determined that side CD is the second side. Since the number of second sides is 1, which is an odd number, it can be determined that the first coordinate is within the coordinate range of the second n-gon ABCD.
[0226] In some embodiments, if the graphic type of the element is a line segment, the coordinate range information of the element includes the coordinates of the two endpoints of the element. In this case, the target algorithm corresponding to the line segment is: for one of the two endpoints, based on the coordinates of this endpoint and the first coordinate, determine the projection point of the line between this endpoint and the coordinate point of the first coordinate in the direction of the line between the two endpoints; if the projection point is not on the line between the two endpoints, determine that the first coordinate is not within the coordinate range of the element; if the projection point is on the line between the two endpoints, obtain the distance between the coordinate point of the first coordinate and the projection point; if the distance is less than or equal to the preset distance, determine that the first coordinate is within the coordinate range of the element; if the distance is greater than the preset distance, determine that the first coordinate is not within the coordinate range of the element.
[0227] The preset distance is used to indicate the detection distance of the line segment. The preset distance can be set in advance.
[0228] If the projection point is on the line between the two endpoints, and the distance between the coordinate point of the first coordinate and the projection point is less than or equal to the preset distance, it means that the coordinate point of the first coordinate is within the detection area of the line segment, and thus it can be determined that the first coordinate is within the coordinate range of the element; if the distance is greater than the preset distance, it means that the coordinate point of the first coordinate is not within the detection area of the line segment, and thus it can be determined that the first coordinate is not within the coordinate range of the element.
[0229] For example, Fig.14 As shown, the coordinates of the two endpoints of line segment AB are A(2,2) and B(6,2), respectively, the preset distance is 2, and the coordinate point of the first coordinate is P(4,6). Determine the projection point P`(4,2) of the line AP between point A and point P on line segment AB, and then determine that the ratio between the length of line segment AP` and the length of line segment AB is 0.5, so it can be determined that the projection point P` is on line segment AB, and then determine that the distance between the coordinate point P(4,6) of the first coordinate and the projection point P` is 4, which is greater than the preset distance 2, so it can be determined that the first coordinate is not within the coordinate range of line segment AB.
[0230] In some embodiments, if the graphic type of the element is a polyline, the coordinate range information of the element includes the coordinates of the two endpoints of each of the multiple line segments of the element. In this case, the target algorithm corresponding to the polyline is: for any one of the multiple line segments, according to the first coordinate and the coordinates of the two endpoints of the line segment, the target algorithm corresponding to the line segment is used to determine whether the first coordinate is within the coordinate range of the line segment; if the first coordinate is not within the coordinate range of each of the multiple line segments, it is determined that the first coordinate is not within the coordinate range of the element; if the first coordinate is within the coordinate range of at least one of the multiple line segments, it is determined that the first coordinate is within the coordinate range of the element.
[0231] The operation of determining whether the first coordinate is within the coordinate range of the line segment through the target algorithm corresponding to the line segment can refer to the relevant description of the target algorithm corresponding to the above line segment, and the embodiments of the present application will not be repeated here.
[0232] Step 705: If the target element is found, the autonomous mobile robot executes the response logic corresponding to the target element.
[0233] The response logic corresponding to the target element can be preset.
[0234] Optionally, the elements in the map have an interactive attribute. When the interactive attribute of an element is yes, the element also has a corresponding response function, which is used to execute the response logic.
[0235] For example, the response function corresponding to each event (such as a click event or a long press event) can be set in the listener list of the element. Then when the event is triggered at the element, the response function corresponding to the event can be called to execute the corresponding response logic.
[0236] For example, Figure 3 As shown in Figure (a), the target element is element 20, and the response logic of element 20 can be a function menu corresponding to the pop-up element 20. The user can subsequently perform operations such as modification and deletion of the element based on the function menu.
[0237] In some embodiments, after the user performs a deletion operation on an element, the autonomous mobile robot may update the target tree accordingly. This process may include the following steps A to C:
[0238] Step A: The autonomous mobile robot receives a deletion instruction.
[0239] The delete instruction carries the element identifier of the element to be deleted. The delete instruction is used to instruct to delete the element. The delete instruction can be triggered by the user, and the user can trigger the delete instruction through operations such as clicking, long pressing, sliding, voice operation, gesture operation or somatosensory operation.
[0240] For example, Figure 3 As shown in Figure (a), after the user clicks on element 20, a function menu of element 20 pops up, and then the user clicks on the delete button in the function menu, which triggers a delete instruction. The delete instruction carries the element identifier of element 20 to indicate the deletion of element 20.
[0241] Step B: The autonomous mobile robot determines a second leaf node in the target tree according to the element identifier of the element.
[0242] The second leaf node is the leaf node corresponding to the region where the element is located, that is, the leaf node storing the element information of the element.
[0243] Optionally, the autonomous mobile robot may obtain a node list attribute of the element according to the element identifier of the element, and the leaf node identified by the node identifier in the node list attribute is the second leaf node.
[0244] Step C: The autonomous mobile robot deletes the element information of the element from the second leaf node.
[0245] In some embodiments, after the user performs a modification operation on an element, the autonomous mobile robot may update the target tree accordingly. This process may include the following steps a to c:
[0246] Step a: The autonomous mobile robot receives a modification instruction.
[0247] The modification instruction carries the element identifier of the element to be modified and the modified element information. The modification instruction is used to modify the element. The modification instruction can be triggered by the user, and the user can trigger the modification instruction through operations such as clicking, long pressing, sliding, voice operation, gesture operation or somatosensory operation.
[0248] For example, Figure 3 As shown in Figure (a), after the user clicks on element 20, a function menu of element 20 pops up, and then the user clicks on the rename button in the function menu, which triggers a modification instruction. The modification instruction carries the element identifier of element 20 and the modified element information to indicate the modification of element 20.
[0249] Step b: The autonomous mobile robot determines the third leaf node in the target tree according to the element identifier of the element, and deletes the element information of the element from the third leaf node.
[0250] The operation of step b is similar to the above-mentioned steps B and C, and will not be repeated here.
[0251] Step c: The autonomous mobile robot indexes the fourth leaf node in the target tree according to the modified element information of the element, and stores the modified element information of the element in the fourth leaf node.
[0252] The fourth leaf node corresponds to the area where the element is located in the map. That is, the coordinate range of the element is within the coordinate range of the area corresponding to the fourth leaf node.
[0253] In an embodiment of the present application, an autonomous mobile robot displays a map on a touch screen, the map includes one or more elements, the map corresponds to a target tree, the target tree includes at least one branch node and multiple leaf nodes, the multiple leaf nodes correspond to multiple regions in the map, each of the multiple leaf nodes includes element information of the element in the corresponding region, each of the at least one branch node includes the coordinate range of the region corresponding to the subordinate node, and the element information of the element includes the element identifier and coordinate range of the element. Afterwards, if a first operation acting on the map is detected, the first coordinate of the first operation in the map coordinate system of the map is determined, and then the target leaf node indexed by the first coordinate in the target tree is determined, so that the region where the first operation does not act can be quickly filtered out from multiple regions in the map. Afterwards, the target element is queried from the elements in the region corresponding to the target leaf node according to the first coordinate and the element information of the element in the target leaf node, without querying the target element in the elements in the region corresponding to other leaf nodes. If the target element is queried, the response logic corresponding to the target element is executed. The embodiments of the present application can greatly reduce the number of elements required to be queried, reduce the amount of calculation, and reduce the CPU load, thereby not only improving the map response speed, but also ensuring the stability of the rendering frame rate to a certain extent, improving the smoothness of map display, and thus improving the user experience.
[0254] Fig.15 is a schematic diagram of a map response device provided in an embodiment of the present application. The device can be implemented by software, hardware or a combination of both to form part or all of a computer device, and the computer device can be as follows Fig.16 The autonomous mobile robot shown. Fig.15 The device includes: a display module 1501, a first determination module 1502, a second determination module 1503, a query module 1504, and an execution module 1505.
[0255] Display module 1501, used to display a map on a touch screen, the map includes one or more elements, the map corresponds to a target tree, the target tree includes at least one branch node and multiple leaf nodes, the multiple leaf nodes correspond one-to-one to multiple regions in the map, each of the multiple leaf nodes includes element information of an element in a corresponding region, each of the at least one branch node includes a coordinate range of a region corresponding to a subordinate node, and the element information of the element includes an element identifier and a coordinate range of the element;
[0256] A first determining module 1502 is configured to determine a first coordinate of the first operation in a map coordinate system of the map if a first operation acting on the map is detected;
[0257] The second determination module 1503 is used to determine the target leaf node indexed by the first coordinate in the target tree, and the first coordinate is within the coordinate range of the area corresponding to the target leaf node;
[0258] A query module 1504, configured to query a target element from elements in a region corresponding to the target leaf node according to the first coordinate and element information of the element in the target leaf node;
[0259] The execution module 1505 is used to execute the response logic corresponding to the target element if the target element is found.
[0260] In an embodiment of the present application, the autonomous mobile robot indexes the target leaf node in the target tree according to the first coordinate, and can quickly filter out the area where the first operation does not work from multiple areas in the map. After indexing the target leaf node, the target element can be directly queried in the elements in the area corresponding to the target leaf node, without having to query the target element in the elements in the areas corresponding to other leaf nodes. In this way, the number of elements required to be queried can be greatly reduced, the amount of calculation can be reduced, and the CPU load can be reduced, thereby not only improving the map response speed, but also ensuring the stability of the rendering frame rate to a certain extent, improving the smoothness of the map display, and thus improving the user experience.
[0261] It should be noted that: the map response device provided in the above embodiment only uses the division of the above-mentioned functional modules as an example when responding to operations on the map. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0262] The functional units and modules in the above embodiments may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit, and the above integrated units may be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present application.
[0263] The map response device and the map response method provided in the above embodiments belong to the same concept. The specific working process and technical effects brought about by the units and modules in the above embodiments can be found in the method embodiment part and will not be repeated here.
[0264] Fig.16 This is a schematic diagram of the structure of an autonomous mobile robot provided in an embodiment of the present application. Fig.16As shown, the autonomous mobile robot 16 includes: a touch screen (not shown in the figure), a processor 160, a memory 161, and a computer program 162 stored in the memory 161 and executable on the processor 160. When the processor 160 executes the computer program 162, the steps in the map response method in the above embodiment are implemented.
[0265] The processor 160 may be a CPU, or other general-purpose processors, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0266] In some embodiments, the memory 161 may be an internal storage unit of the computer device 16, such as a hard disk or memory of the computer device 16. In other embodiments, the memory 161 may also be an external storage device of the computer device 16, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 16. Further, the memory 161 may also include both an internal storage unit and an external storage device of the computer device 16. The memory 161 is used to store an operating system, an application program, a boot loader, data, and other programs. The memory 161 may also be used to temporarily store data that has been output or is to be output.
[0267] An embodiment of the present application also provides a computer device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, and when the processor executes the computer program, the steps in any of the above-mentioned method embodiments are implemented.
[0268] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0269] An embodiment of the present application provides a computer program product, which, when executed on a computer, enables the computer to execute the steps in the above-mentioned method embodiments.
[0270] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above method embodiments, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above method embodiments can be implemented. Among them, the computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, ROM (Read-Only Memory), RAM (Random Access Memory), CD-ROM (Compact Disc Read-Only Memory), magnetic tape, floppy disk and optical data storage device. The computer-readable storage medium mentioned in the present application can be a non-volatile storage medium, in other words, it can be a non-transient storage medium.
[0271] It should be understood that all or part of the steps to implement the above embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The computer instructions can be stored in the above-mentioned computer readable storage medium.
[0272] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0273] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0274] In the embodiments provided in the present application, it should be understood that the disclosed devices / computer equipment and methods can be implemented in other ways. For example, the device / computer equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0275] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0276] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A map response method, It is characterized in that Applied to an autonomous mobile robot, the autonomous mobile robot includes a touch screen, and the method includes: Displaying a map on the touch screen, the map including one or more elements, the map corresponding to a target tree, the target tree including at least one branch node and multiple leaf nodes, the multiple leaf nodes corresponding one-to-one to multiple areas in the map, each of the multiple leaf nodes including element information of an element in a corresponding area, each of the at least one branch node including a coordinate range of an area corresponding to a subordinate node, and the element information of the element including an element identifier and a coordinate range of the element; If a first operation acting on the map is detected, determining first coordinates of the first operation in a map coordinate system of the map; Determine a target leaf node indexed by the first coordinate in the target tree, where the first coordinate is within a coordinate range of a region corresponding to the target leaf node; According to the first coordinates and the element information of the element in the target leaf node, query the target element from the elements in the area corresponding to the target leaf node; If the target element is found, the response logic corresponding to the target element is executed.
2. The method according to claim 1, It is characterized in that The target tree is an m-ary tree, where m is an integer greater than or equal to 2, and displaying a map on the touch screen includes: displaying an initial map on the touch screen, where the initial map includes environmental information; and sequentially displaying each of the one or more elements in the initial map; Accordingly, the method further includes: in the process of displaying the initial map, constructing an initial m-ary tree, the initial m-ary tree including a root node and m leaf nodes; each time an element is displayed in the initial map, storing the element information of the element in the leaf node corresponding to the area where the element is located; And / or, displaying the map on the touch screen includes: displaying the map in a viewport on the touch screen; Correspondingly, determining the first coordinates of the first operation in the map coordinate system of the map includes: acquiring the second coordinates of the first operation in the viewport coordinate system of the viewport; and converting the second coordinates into the first coordinates.
3. The method according to claim 2, It is characterized in that After storing the element information of the element in the leaf node corresponding to the area where the element is located, the method further includes: For a leaf node where the element information of the element is located, if the amount of element information in the leaf node is greater than a preset amount, determining the area corresponding to the leaf node as the target area, and obtaining multiple element information in the leaf node; Dividing the target area into m areas; Taking the leaf node as a new branch node, constructing m child nodes of the new branch node, wherein the new branch node includes a coordinate range of each of the m regions, and the m child nodes correspond to the m regions one by one; The plurality of element information are stored in the m child nodes respectively.
4. The method according to claim 2, It is characterized in that The converting the second coordinates to the first coordinates includes: converting the second coordinates according to a first transformation matrix to obtain the first coordinates, wherein the first transformation matrix is used to indicate a mapping relationship between the viewport coordinate system and the map coordinate system; And / or, the method also includes: after displaying the map, generating a unit matrix as the first transformation matrix; if a second operation acting on the map is detected, determining a second transformation matrix based on operation information of the second operation; multiplying the current first transformation matrix by the second transformation matrix to obtain a new first transformation matrix.
5. The method according to claim 1, It is characterized in that The step of searching for a target element from elements in an area corresponding to the target leaf node according to the first coordinate and the element information of the element in the target leaf node includes: if the amount of element information in the target leaf node is 0, determining that the target element has not been found; if the amount of element information in the target leaf node is greater than 0, determining whether the element identified by the element identifier in the element information is the target element for any element information in the target leaf node according to the first coordinate and the coordinate range in the element information; Alternatively, the target element is queried from the elements in the area corresponding to the target leaf node based on the first coordinate and the element information of the element in the target leaf node, including: if the amount of element information in the target leaf node is greater than 0, obtaining the coordinate range of the viewport where the map is located in the map coordinate system; for any element information in the target leaf node, if the coordinate range in the element information is not within the coordinate range of the viewport, determining that the element identified by the element identifier in the element information is not the target element; if the coordinate range in the element information is within the coordinate range of the viewport, determining whether the element identified by the element identifier in the element information is the target element based on the first coordinate and the coordinate range in the element information.
6. The method according to claim 5, It is characterized in that Before determining whether the element identified by the element identifier in the element information is the target element according to the first coordinate and the coordinate range in the element information, the method further includes: For the element identified by the element identifier in the element information, determining whether the first coordinate is within the coordinate range of the bounding box of the element; If the first coordinate is within the coordinate range of the bounding box of the element, then performing the step of determining whether the element identified by the element identifier in the element information is the target element according to the first coordinate and the coordinate range in the element information; After determining whether the first coordinate is within the coordinate range of the bounding box of the element, the method further includes: If the first coordinate is not within the coordinate range of the bounding box of the element, it is determined that the element is not the target element.
7. The method according to claim 6, It is characterized in that The method further comprises: Get the maximum horizontal coordinate value, the minimum horizontal coordinate value, the maximum vertical coordinate value and the minimum vertical coordinate value of the coordinate range of the element; Generate four vertex coordinates according to the maximum horizontal coordinate value, the minimum horizontal coordinate value, the maximum vertical coordinate value and the minimum vertical coordinate value; The four vertex coordinates are determined as coordinate range information of a bounding box of the element.
8. The method according to claim 7, It is characterized in that The determining whether the first coordinate is within the coordinate range of the bounding box of the element includes: If the abscissa value of the first coordinate is greater than or equal to the minimum abscissa value of the coordinate range of the bounding box of the element and less than or equal to the maximum abscissa value of the coordinate range of the bounding box of the element, and the ordinate value of the first coordinate is greater than or equal to the minimum ordinate value of the coordinate range of the bounding box of the element and less than or equal to the maximum ordinate value of the coordinate range of the bounding box of the element, then it is determined that the first coordinate is within the coordinate range of the bounding box of the element; If the horizontal coordinate value of the first coordinate is smaller than the minimum horizontal coordinate value of the coordinate range of the bounding box of the element or larger than the maximum horizontal coordinate value of the coordinate range of the bounding box of the element, and / or if the vertical coordinate value of the first coordinate is smaller than the minimum vertical coordinate value of the coordinate range of the bounding box of the element or larger than the maximum vertical coordinate value of the coordinate range of the bounding box of the element, it is determined that the first coordinate is not within the coordinate range of the bounding box of the element.
9. The method according to any one of claims 5 to 8, It is characterized in that The determining, according to the first coordinate and the coordinate range in the element information, whether the element identified by the element identifier in the element information is the target element includes: For the element identified by the element identifier in the element information, determining a target algorithm corresponding to the graphic type of the element, where different graphic types correspond to different target algorithms; Determining whether the first coordinate is within the coordinate range of the element by using a target algorithm corresponding to the graphic type of the element according to the first coordinate and the coordinate range of the element; If the first coordinate is within the coordinate range of the element, determining that the element is the target element; If the first coordinate is not within the coordinate range of the element, determining that the element is not the target element; The graphic type of the element is a circle, a triangle, an n-gon, a line segment or a broken line, and n is an integer greater than or equal to 4.
10. The method according to claim 9, It is characterized in that The graphic type of the element is a circle, the coordinate range information of the element includes the center coordinates and radius of the element, and the target algorithm corresponding to the circle is: determining the distance between the center coordinates and the first coordinate; if the distance is less than or equal to the radius, determining that the first coordinate is within the coordinate range of the element; if the distance is greater than the radius, determining that the first coordinate is not within the coordinate range of the element; Alternatively, the graphic type of the element is a triangle, the coordinate range information of the element includes the coordinates of the three vertices of the element, and the target algorithm corresponding to the triangle is: for one vertex among the three vertices, determine the two sides of the element including the one vertex; determine a first vector from the one vertex to the coordinate point of the first coordinate; decompose the first vector along the direction of each of the two sides to obtain two second vectors; for any one of the two sides, determine the ratio of the length of the second vector along the direction of the one side to the length of the one side; determine whether the first coordinate is within the coordinate range of the element according to the ratio corresponding to each of the two sides; Alternatively, the n-gon includes a first n-gon, each side of the first n-gon is parallel to a coordinate axis of the map coordinate system, the graphic type of the element is the first n-gon, and the coordinate range information of the element includes the coordinates of the four vertices of the element; the target algorithm corresponding to the first n-gon is: obtaining the maximum horizontal coordinate value, the minimum horizontal coordinate value, the maximum vertical coordinate value and the minimum vertical coordinate value of the coordinates of the four vertices; if the horizontal coordinate value of the first coordinate is greater than or equal to the minimum horizontal coordinate value and less than or equal to the maximum horizontal coordinate value, and the vertical coordinate value of the first coordinate is greater than or equal to the minimum vertical coordinate value and less than or equal to the maximum vertical coordinate value, then it is determined that the first coordinate is within the coordinate range of the element; if the horizontal coordinate value of the first coordinate is less than the minimum horizontal coordinate value or greater than the maximum horizontal coordinate value, and / or, if the vertical coordinate value of the first coordinate is less than the minimum vertical coordinate value or greater than the maximum vertical coordinate value, then it is determined that the first coordinate is not within the coordinate range of the element; Alternatively, the n-gon includes a second n-gon, the second n-gon has sides that are not parallel to two coordinate axes of the map coordinate system, the graphic type of the element is the second n-gon, the coordinate range information of the element includes the coordinates of n vertices of the element and the connection relationship of the n vertices, and the target algorithm corresponding to the second n-gon is: determining the coordinate range of each of the n sides of the element according to the coordinates of the n vertices and the connection relationship of the n vertices; If the first edge does not exist among the n edges, it is determined that the first coordinate is not within the coordinate range of the element, and the ordinate range in the coordinate range of the first edge includes the ordinate value of the first coordinate; if the first edge exists among the n edges, for any first edge among the n edges, the cross product value of the vectors from the coordinate point of the first coordinate to the two endpoints of the first edge is determined; determining whether the first edge is the second edge according to the cross product value; determining whether the first coordinate is within the coordinate range of the element according to the number of the second edges in the n edges; Alternatively, the graphic type of the element is a line segment, the coordinate range information of the element includes the coordinates of two endpoints of the element, and the target algorithm corresponding to the line segment is: for one of the two endpoints, according to the coordinates of the one endpoint and the first coordinate, determining a projection point of a line between the one endpoint and a coordinate point of the first coordinate in the direction of the line between the two endpoints; If the projection point is not on the line between the two endpoints, it is determined that the first coordinate is not within the coordinate range of the element; if the projection point is on the line between the two endpoints, the distance between the coordinate point of the first coordinate and the projection point is obtained; if the distance is less than or equal to a preset distance, it is determined that the first coordinate is within the coordinate range of the element; if the distance is greater than the preset distance, it is determined that the first coordinate is not within the coordinate range of the element; Alternatively, the graphic type of the element is a broken line, the coordinate range information of the element includes the coordinates of the two endpoints of each of the multiple line segments of the element, and the target algorithm corresponding to the broken line is: for any one of the multiple line segments, according to the first coordinate and the coordinates of the two endpoints of the line segment, determine whether the first coordinate is within the coordinate range of the line segment through the target algorithm corresponding to the line segment; if the first coordinate is not within the coordinate range of each of the multiple line segments, determine that the first coordinate is not within the coordinate range of the element; if the first coordinate is within the coordinate range of at least one of the multiple line segments, determine that the first coordinate is within the coordinate range of the element.
11. The method according to claim 10, It is characterized in that The determining, according to the ratio corresponding to each of the two sides, whether the first coordinate is within the coordinate range of the element includes: If the ratio corresponding to each of the two sides is equal to 0, it is determined that the first coordinate is within the coordinate range of the element; If the ratio corresponding to each of the two sides is greater than 0 and the sum of the ratio corresponding to each of the two sides is less than or equal to 1, it is determined that the first coordinate is within the coordinate range of the element; If the sum of the ratios corresponding to each of the two sides is greater than 1, it is determined that the first coordinate is not within the coordinate range of the element; Alternatively, determining whether the first edge is the second edge according to the cross product value includes: If the cross product value is less than or equal to 0, determining that the first edge is the second edge; If the cross product value is greater than 0, it is determined that the first edge is not the second edge.
12. The method according to claim 11, It is characterized in that The determining, according to the number of the second edges in the n edges, whether the first coordinate is within the coordinate range of the element includes: If the number of the second edges in the n edges is an odd number, determining that the first coordinate is within the coordinate range of the element; If the number of the second edges in the n edges is an even number, it is determined that the first coordinate is not within the coordinate range of the element.
13. An autonomous mobile robot, It is characterized in that The autonomous mobile robot comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the method according to any one of claims 1 to 12 when executed by the processor; Alternatively, the autonomous mobile robot is also capable of reading a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.
