Task recovery method and device, electronic equipment and storage medium
By configuring the nodes with self-start delay and saving task information in the ROS network, the task recovery time-consuming problem caused by ROS node crashes is solved, and the task operation is achieved with fast recovery and efficient execution.
Patent Information
- Application Number
- CN202310976867.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-03
- Publication Date
- 2025-02-14
AI Technical Summary
Task recovery caused by ROS node crashes takes time, affecting task execution efficiency and user experience.
By performing self-start delay configuration on the node in the ROS network, the service node subscribes to the diagnostic results of the diagnosis node, saves task information related to the lost node, and plans task execution through the saved task information when the node is restored.
It realizes the rapid recovery of tasks after ROS node crashes, avoids tasks stopping for a long time, and improves the reliability and efficiency of task operation.
Smart Images

Figure CN119440887A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of ROS robots, and in particular to a task recovery method, device, electronic device and storage medium. Background Art
[0002] ROS (Robot Operating System) is an open source meta-operating system for robots, which is currently widely used in the field of autonomous driving. The ROS system may have task interruptions during real-time operation. One reason for task interruptions is that defects in the ROS system itself lead to the loss of ROS nodes, where a node is the smallest process unit in the ROS system. For example, if a ROS node is lost in an autonomous cleaning vehicle, a restaurant or hotel delivery vehicle, a low-speed logistics vehicle, or a ROS-based autonomous driving vehicle or a ROS-based robot, the vehicle or robot may stop running, that is, the task is interrupted. It can be said that ROS node crash is an inevitable situation.
[0003] If the loss of ROS nodes causes task interruption, a relevant solution is manual intervention by operators. Operators record ROS bags and collect core files generated by node crashes, so that R&D personnel can analyze and troubleshoot the bugs that caused the ROS node crash. After that, on-site operators manually restart and reissue the tasks before the ROS node crashed. However, this manual intervention behavior is heavily dependent on on-site operators, and the overall task recovery time is long, which also seriously affects the execution efficiency of the task. In addition, the product user experience is poor, which is not conducive to large-scale product promotion.
[0004] Furthermore, in another related technology, after a node crash occurs in a product (such as an autonomous driving vehicle based on ROS), the fault diagnosis node diagnoses a node loss fault, and the business node saves the current autonomous driving task status and the unfinished flag of the autonomous driving task and sends them to the database; the business node directly restarts the project after saving, and after the project restart is completed, the business node reads the unfinished flag of the autonomous driving task from the database. If the flag is true, the autonomous driving task is restored from the database and the unfinished autonomous driving task is continued. However, the project restart method may cause a long-term shutdown, which will have a relatively negative impact on the product. At the same time, the project restart method also consumes a lot of time and will also affect the product's operating efficiency.
[0005] Therefore, how to solve the problem of time-consuming task recovery caused by ROS node crash is an urgent problem we need to solve. Summary of the invention
[0006] In order to solve or partially solve the problems existing in the related art, the present application provides a task recovery method, device, electronic device and storage medium, which can quickly recover the task stop caused by ROS node crash and ensure the reliability of task operation.
[0007] A first aspect of the present application provides a task recovery method, the method being applied to a service node in a ROS network, the ROS network comprising the service node, a diagnostic node, and a first node related to the service status of the service node, the method comprising:
[0008] After the self-start of each node in the ROS network is delayed accordingly, the service node subscribes to the diagnosis result of the diagnosis node, the diagnosis result is periodically determined by the diagnosis node from the heartbeat signal of the service node and the first node, and the diagnosis period of the diagnosis node is less than the delay time of the service node and the first node;
[0009] When the subscribed diagnosis result is that the node is lost, the service node saves the task information related to the lost node and ends the related task;
[0010] When the subscribed diagnosis result is that the lost node is restored, the service node plans the related tasks directly or indirectly through the saved task information according to the restored node to execute the planned tasks.
[0011] In one embodiment, if the lost node is the first node, the service node plans the related tasks directly or indirectly through the saved task information according to the restored node when the subscribed diagnosis result is that the lost node is restored, including:
[0012] If the subscribed diagnosis result is that the lost first node is restored, the service node plans the related tasks according to the stored service information.
[0013] In one implementation, the service node plans the related tasks according to the stored service information, including:
[0014] The service node restores the service state of the service layer;
[0015] The service node takes the current waypoint coordinates in the stored service information as a starting point, calls the global path planning again to generate a new global path, and sends it to the planning node in the first node.
[0016] In one embodiment, if the lost node is another service node, the service node plans the related tasks directly or indirectly through the saved task information according to the restored node when the subscribed diagnosis result is that the lost node is restored, including:
[0017] If the subscribed diagnosis result is that the lost other service nodes are restored, the service node synchronizes the stored service information to the other service nodes, and the other service nodes plan the related tasks according to the synchronized service information.
[0018] In one embodiment, if the number of lost nodes is at least two, the service node plans the related tasks directly and / or indirectly through the stored task information according to the restored nodes when all lost nodes are restored.
[0019] In one embodiment, the method further comprises:
[0020] If a temporary task with a higher priority is triggered, the service node saves the current task information, ends the current task, and executes the temporary task;
[0021] After the temporary task is executed, the service node plans the current task according to the current service information.
[0022] In one embodiment, if the lost node recovers, the lost node is configured to switch to an idle state.
[0023] In one implementation, the ROS network further includes a second node that is independent of the service state of the service node, and a diagnosis period of the diagnosis node is greater than a delay time of the diagnosis node and the second node.
[0024] In one implementation, the service node and the first node have a respawn-delay attribute, and the diagnosis node and the second node have a respawn attribute.
[0025] A second aspect of the present application provides a task recovery device, the device being arranged in a service node in a ROS network, the ROS network comprising a service node, a diagnostic node and a first node related to the service status of the service node, the device comprising:
[0026] A subscription module, used for subscribing to the diagnosis result of the diagnosis node after the self-start of each node in the ROS network is delayed accordingly, wherein the diagnosis result is periodically determined by the diagnosis node from the heartbeat signal of the business node and the first node, and the diagnosis period of the diagnosis node is less than the delay time of the business node and the first node;
[0027] An operation module, used for saving task information related to the lost node and ending the related task when the subscribed diagnosis result is that the node is lost;
[0028] The planning module is used to plan the related tasks directly or indirectly through the saved task information according to the restored node when the subscribed diagnosis result is that the lost node is restored, so as to execute the planned tasks.
[0029] A third aspect of the present application provides an electronic device, including:
[0030] Processor; and
[0031] The memory stores executable codes thereon, and when the executable codes are executed by the processor, the processor is caused to execute the method as described above.
[0032] A fourth aspect of the present application provides a mobile tool, which includes the electronic device as described above.
[0033] A fifth aspect of the present application provides a computer-readable storage medium having executable code stored thereon. When the executable code is executed by a processor of an electronic device, the processor is caused to execute the method as described above.
[0034] The technical solution provided by this application may have the following beneficial effects:
[0035] The technical solution provided by the present application first divides the nodes in the ROS network, such as determining the business node, the diagnostic node and the first node related to the business status of the business node, and then performs a corresponding delay configuration for the self-start of each node in the ROS network, so that each node will automatically restart after the node is lost; the diagnostic node periodically determines the diagnostic result of the node loss or recovery from the heartbeat signal of the business node and the first node, and the diagnostic cycle is less than the delay time of the business node and the first node; after the diagnostic node determines the diagnostic result, the business node subscribes to the diagnostic result, if the diagnostic result is node loss, the task information related to the lost node is saved, and the related task is terminated, if the diagnostic result is node recovery, the related tasks are planned directly or indirectly according to the restored node through the saved task information to execute the planned tasks. The technical solution of the present application can configure the self-start parameters according to different nodes after the ROS node crashes unexpectedly, so that the business node can quickly recover the task, avoid the task from stopping for a long time, and ensure the reliability of the task operation.
[0036] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The above and other objects, features and advantages of the present application will become more apparent by describing in more detail exemplary embodiments of the present application in conjunction with the accompanying drawings, wherein the same reference numerals generally represent the same components in the exemplary embodiments of the present application.
[0038] Figure 1 is a flowchart of a task recovery method shown in an embodiment of the present application;
[0039] Figure 2 is a schematic diagram of the structure of the ROS network shown in the embodiment of the present application;
[0040] Figure 3 is a schematic diagram of the structure of a task recovery device shown in an embodiment of the present application;
[0041] Figure 4 It is a schematic diagram of the structure of an electronic device shown in an embodiment of the present application. DETAILED DESCRIPTION
[0042] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to make the present application more thorough and complete, and to fully convey the scope of the present application to those skilled in the art.
[0043] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0044] It should be understood that although the terms "first", "second", "third", etc. may be used in this application to describe various information, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0045] In the ROS system, if a ROS node is lost during the real-time operation of a task, it may be interrupted. At present, the recovery of tasks usually takes a long time.
[0046] In response to the above problems, an embodiment of the present application provides a task recovery method. After an ROS node crashes unexpectedly, self-start parameter configuration can be performed according to different nodes, so that the business node can quickly recover the task, avoid long-term task suspension, and ensure the reliability of task operation.
[0047] The technical solution of the embodiments of the present application is described in detail below with reference to the accompanying drawings.
[0048] The task recovery method of the present application can be applied to a mobile tool, and the task recovery method can be executed by an electronic device. In some possible implementations, the task recovery method can be implemented by a processor calling a computer-readable instruction stored in a memory.
[0049] In some specific embodiments, the mobile tools referred to in this application include but are not limited to vehicles or robots having the following functions:
[0050] (1) Passenger-carrying function, such as family cars and buses;
[0051] (2) Cargo-carrying functions, such as ordinary trucks, van trucks, trailer trucks, closed trucks, tank trucks, flatbed trucks, container trucks, dump trucks, trucks with special structures, etc.;
[0052] (3) Tool functions, such as logistics delivery vehicles, automatic guided transport vehicles, patrol vehicles, cranes, hoists, excavators, bulldozers, forklifts, rollers, loaders, off-road engineering vehicles, armored engineering vehicles, sewage treatment vehicles, sanitation vehicles, vacuum trucks, floor washing vehicles, sprinkler trucks, sweeping robots, food delivery robots, shopping guide robots, welcoming robots, disinfection robots, lawn mowers, golf carts, etc.;
[0053] (4) Entertainment functions, such as entertainment vehicles, amusement park self-driving devices, balance vehicles, etc.;
[0054] (5) Special rescue functions, such as fire trucks, ambulances, power repair vehicles, engineering rescue vehicles, etc.
[0055] In some specific embodiments, an electronic device for executing the task recovery method provided in the embodiments of the present application may include a processor and a memory, wherein an executable code is stored in the memory, and when the executable code is executed by the processor, the processor executes the task recovery method provided in the embodiments of the present application.
[0056] Figure 4 It is a schematic diagram of the structure of an electronic device shown in an embodiment of the present application.
[0057] See also Figure 4 , the electronic device 400 includes a memory 401 and a processor 402.
[0058] The processor 402 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (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 the processor may be any conventional processor, etc.
[0059] The memory 401 may include various types of storage units, such as system memory, read-only memory (ROM) and permanent storage devices. Among them, ROM can store static data or instructions required by the processor 402 or other modules of the computer. The permanent storage device may be a readable and writable storage device. The permanent storage device may be a non-volatile storage device that does not lose the stored instructions and data even after the computer is powered off. In some embodiments, the permanent storage device uses a large-capacity storage device (such as a magnetic or optical disk, flash memory) as a permanent storage device. In some other embodiments, the permanent storage device may be a removable storage device (such as a floppy disk, an optical drive). The system memory may be a readable and writable storage device or a volatile readable and writable storage device, such as a dynamic random access memory. The system memory may store some or all instructions and data required by the processor at run time. In addition, the memory 401 may include a combination of any computer-readable storage media, including various types of semiconductor memory chips (such as DRAM, SRAM, SDRAM, flash memory, programmable read-only memory), and disks and / or optical disks may also be used. In some embodiments, the memory 401 may include a readable and / or writable removable storage device, such as a laser disc (CD), a read-only digital versatile disc (such as a DVD-ROM, a double-layer DVD-ROM), a read-only Blu-ray disc, an ultra-density optical disc, a flash memory card (such as an SD card, a mini SD card, a Micro-SD card, etc.), a magnetic floppy disk, etc. The computer-readable storage medium does not include carrier waves and transient electronic signals transmitted wirelessly or wired.
[0060] The memory 401 stores executable codes, and when the executable codes are processed by the processor 402 , the processor 402 can execute part or all of the above-mentioned methods.
[0061] In some specific embodiments, the mobile tool includes the above-mentioned electronic device. For example, the mobile tool may be equipped with various sensors for sensing environmental information and the mobile tool's own information (including but not limited to laser radar, camera, millimeter wave radar, ultrasonic radar, inertial measurement unit, wheel speed meter, etc.), and the electronic device may be configured on the mobile tool in the form of an autonomous driving domain controller, which is connected to the aforementioned various sensors in communication, and performs path planning for the mobile tool based on the environmental information collected by these sensors and the mobile tool's own information, so as to achieve the purpose of controlling the mobile tool to drive automatically.
[0062] The task recovery method provided by the embodiment of the present application is introduced below by taking the mobile tool as a floor cleaning device as an example. In some specific implementations, the floor cleaning device can be a floor washing vehicle, a floor washing machine, a floor sweeper, a floor sweeper, a floor sweeping robot, a sanitation vehicle, a cleaning machine, a vacuum cleaner, a dust pusher, and other equipment that can autonomously plan a driving path and have an automatic driving function.
[0063] like Figure 1 As shown, an embodiment of the present application provides a task recovery method, which is applied to a service node in a ROS network, the ROS network includes a service node, a diagnostic node, and a first node related to the service status of the service node, and the method may include the following steps:
[0064] Step S101: After the self-start of each node in the ROS network is delayed accordingly, the business node subscribes to the diagnosis result of the diagnosis node. The diagnosis result is periodically determined by the diagnosis node from the heartbeat signal of the business node and the first node, and the diagnosis period of the diagnosis node is less than the delay time of the business node and the first node.
[0065] like Figure 2 As shown, in an embodiment of the present application, taking the deployment of the ROS network on a ground cleaning electric vehicle as an example, the ground cleaning electric vehicle may have multiple business nodes, such as cleaning nodes, charging nodes, and the like. It should be explained that the business node can be understood as a class or one according to the actual meaning. Among them, under normal circumstances, the loss of a business node will not affect the task being executed. When the task is completed, the business node remains lost, which makes the ground cleaning electric vehicle remain parked. The business node is mainly used to handle the business logic processing of different tasks of the ground cleaning electric vehicle. Taking the cleaning task as an example, the cleaning node needs to complete the task of automatic driving and issue it, and perform pause, continue, end, etc. according to the status of the automatic driving task. The cleaning node also needs to complete the control of, for example, the turning on and off of the lights and the rotation of the roller brush.
[0066] The first node related to the business status of the business node is, for example, a perception node, a positioning node, a planning node, a map node, and the like. Among them, the first node is characterized in that it includes a working state that is strongly related to the business. Taking the perception node as an example, the node can include "normal operation mode", "automatic charging mode", "edge mode", etc., and the perception node switches to different modes under different tasks; and, after the node is lost, it is difficult for the first node to automatically restore the mode, and it can usually only maintain the "idle mode". Generally speaking, in the first node, the main function of the perception node is to obtain environmental information around the ground cleaning electric vehicle by using laser radar, camera, etc., so as to provide effective and reliable data support for planning and decision-making; the main function of the positioning node is to determine the location information of the ground cleaning electric vehicle itself in the environment through data including but not limited to radar, inertial measurement unit, wheel speed meter, etc.; the main function of the planning node is to plan and decide the most reasonable driving trajectory, driving speed, etc. of the ground cleaning electric vehicle based on the data information provided by the perception node, positioning node, etc.; the map node mainly provides a global planning path for the automatic driving of the ground cleaning electric vehicle, and provides a path navigation function during the execution of the cleaning task.
[0067] Furthermore, the ROS network also includes a second node that is independent of the business status of the business node, and the diagnostic cycle of the diagnostic node is greater than the delay time of the diagnostic node and the second node. The second node is, for example, a control node, a CANBUS node, and the like. Among them, the second node is characterized in that it does not have different working modes, does not need to switch its own working mode according to different tasks, and can return the corresponding data output given the data input; and, after the node is lost, the second node can directly restore the working mode after the node is self-started. In the second node, the control node needs to analyze the acceleration, braking, steering, etc. of the ground cleaning electric vehicle according to the trajectory and speed planned by the planning node, and then obtain a reasonable motion control amount to meet the planning requirements; the CANBUS node is mainly to connect the automatic driving domain and the chassis domain of the ground cleaning electric vehicle, and publish the motion control amount obtained from the control node and the headlight signal and roller brush signal obtained from the cleaning node to the CAN bus in the form of CAN messages.
[0068] As far as the diagnostic node is concerned, its main function is to detect the heartbeat information of all business nodes and all first nodes in the ground cleaning electric vehicle. In practice, the diagnostic node can also detect the heartbeat information of the second node. After detecting the heartbeat information, the diagnostic node can determine the diagnostic result according to the acquired heartbeat information, that is, which node or nodes have node loss or node recovery. After determining the diagnostic result, the diagnostic node will publish it to the outside. In this embodiment, the diagnostic node publishes the diagnostic result to each business node in the form of a topic. Among them, for the diagnostic node, its function is to mainly detect the heartbeat information of all business nodes and all first nodes in the ground cleaning electric vehicle. For the nodes that need to be detected online, a separate thread is opened. The diagnostic node periodically calls the heartbeat information of each node, and determines whether the detected node is normal, lost or recovered through the change of the heartbeat information, and the diagnostic node can directly restore the working mode after the node is self-started after the node is lost. Among them, if the diagnostic node has not received the heartbeat signal of the target node for more than the set first time, it is determined that the target node has node loss. The specific data of the first time is determined according to actual needs, and the first time is defined as the delay time.
[0069] Further, the service node and the first node have a respawn-delay attribute, and the diagnosis node and the second node have a respawn attribute.
[0070] In this embodiment, each node is a ROS node. The roslaunch file is configured in the ROS network, and the node that needs to be restarted is added with a respawn attribute, that is, respawn = "true". According to the above description of the characteristics of each node, for the business node and the first node, a delay is required after the node is lost, so the delay time (i.e., the first time) is greater than the time when the diagnosis node gives the diagnosis result (i.e., the diagnosis cycle). Specifically, the delay time of the business node and the first node is greater than the diagnosis cycle of the diagnosis node. In the roslaunch file, the respawn_delay attribute needs to be configured for the business node and the first node, and further needs to be configured as respawn_delay = "TBD", TBD is the delay time (i.e., the first time), in seconds. Taking the first node as an example, if the first node is lost during the execution of the task, the time of the node loss exceeds the judgment time of the diagnosis node, that is, exceeds the diagnosis cycle, the diagnosis node can diagnose that the first node has a node loss, and the diagnosis node can be published through topic communication for subscription by the business node and the first node. In the roslaunch file, it is only necessary to configure the respawn attribute for the second node and the diagnostic node. The node configured with the respawn attribute will immediately return to the previous working mode after the node is self-started. Taking the second node as an example, there is no obvious correlation between the state of the second node and the task. After the node is self-started, it does not need to switch the task state or working mode to continue the current task executed before the second node was lost. When the second node is also configured with the respawn_delay attribute, where the first time TBD is less than the diagnostic cycle, the loss / recovery of the second node is imperceptible to the diagnostic node, that is, the result of whether the diagnostic node detects the heartbeat information of the second node is the same. Therefore, for the second node, only the respawn attribute is needed, and the delay time is approximately zero, which is less than the set diagnostic cycle.
[0071] If the lost node is restored, the lost node is configured to switch to an idle state. In this embodiment, each node will be delayed to start after configuring the respawn attribute, wherein the service node and the first node switch their own state to an idle mode after self-starting, and the diagnosis of node loss / recovery in the embodiment of the present application is for the service node and the first node.
[0072] It should be noted that the diagnostic node and the second node do not have any changes in working mode after self-startup, so they do not meet the prerequisite for switching to the idle state. Therefore, when the diagnostic node also detects the loss / recovery of the second node, the lost second node cannot be configured to the idle state.
[0073] Step S102: When the subscribed diagnosis result is that the node is lost, the service node saves the task information related to the lost node and ends the related task.
[0074] In this embodiment, the diagnostic node performs diagnostic detection on the business node and the first node. Therefore, the lost node can be the first node, or the business node, or both are lost. In practice, the business node of the ground cleaning electric vehicle is difficult to execute a single task, and generally has multiple business nodes. Therefore, when the business node A is lost, the task information related to the business node A will be saved through the business node B with normal nodes. When any first node C is lost, any business node can save the task information of task D related to the first node C. Among them, the task information includes the task ID, execution status (such as pause status, running status, end status) and the waypoint coordinates of the global path corresponding to the task. For example, if a first node related to the cleaning task is lost, the cleaning service saves the cleaning task, and after saving the cleaning task, the cleaning task is ended.
[0075] Step S103: When the subscribed diagnosis result indicates that the lost node is restored, the service node plans related tasks directly or indirectly according to the restored node through the stored task information to execute the planned tasks.
[0076] In an optional embodiment, if the lost node is the first node, when the subscribed diagnosis result is that the lost node is restored, the service node plans related tasks directly or indirectly according to the restored node through the saved task information, including:
[0077] If the subscribed diagnosis result is that the lost first node is restored, the service node plans the related tasks according to the saved service information.
[0078] Furthermore, the service node plans related tasks based on the stored service information, including:
[0079] The business node restores the business status of the business layer;
[0080] The business node takes the current waypoint coordinates in the saved business information as the starting point, calls the global path planning again to generate a new global path, and sends it to the planning node in the first node.
[0081] In this embodiment, if the first node C is lost, any service node can save the task D related to the first node C. In step S102, task D is terminated. Therefore, when the first node C is restored, task D has been terminated, and the service node saves the task information of task D. The service node restores the service state of the service layer through the saved task information. At this moment, the electric ground cleaning vehicle remains at a certain position. The service node takes the waypoint coordinates corresponding to the position as the starting point and the end point coordinates of task D as the end point. The global path planning is re-invoked to generate the coordinates of each waypoint of the new global path, which is sent to the planning node as the new task D, and the electric ground cleaning vehicle begins to resume the execution of task D.
[0082] Furthermore, if the number of lost nodes is at least two, the business node plans related tasks directly and / or indirectly through the saved task information based on the restored nodes when all lost nodes are restored. Generally speaking, before the business node plans related tasks based on the saved business information, it should be ensured that all business nodes and the first node are in a normal state. Therefore, when multiple nodes are lost, it is necessary to resume execution of the tasks after all nodes are restored. It should be noted that the lost nodes recorded in the embodiments of the present application specifically refer to the first node and / or business node diagnosed by the diagnostic node.
[0083] In an optional embodiment, if the lost node is another service node, when the subscribed diagnosis result is that the lost node is restored, the service node plans related tasks directly or indirectly according to the restored node through the saved task information, including:
[0084] If the subscribed diagnosis result is that the lost other business nodes are restored, the business node will synchronize the saved business information to other business nodes, and other business nodes will plan related tasks based on the synchronized business information.
[0085] In this embodiment, if the node lost is business node A, the task information of task E related to business node A will be saved through business node B with normal node. After business node A is restored, business node B will synchronize the task information of task E to business node A. Business node A will restore the business status of task E according to the task information of task E. At this moment, the ground cleaning electric vehicle remains at a certain position, and the business node takes the waypoint coordinates corresponding to the position as the starting point and the end point coordinates of task E as the end point. The global path planning is re-called to generate the coordinates of each waypoint of the new global path, which is sent to the planning node as the new task E, and the ground cleaning electric vehicle begins to resume the execution of task E.
[0086] Obviously, when a service node fails, more than two service nodes are required to simultaneously detect the diagnosis results published by the diagnosis node.
[0087] In a preferred embodiment, the method further comprises:
[0088] If a temporary task with a higher priority is triggered, the business node saves the current task information, ends the current task, and executes the temporary task;
[0089] After the temporary task is executed, the business node plans the current task based on the current business information.
[0090] In this embodiment, when the electric ground cleaning vehicle runs out of power during the execution of the cleaning task, a higher priority charging task will be triggered. The cleaning node saves the cleaning task information, ends the cleaning task, and executes the charging task. After the battery is fully charged or the power is unplugged, the cleaning node restores the cleaning task according to the saved cleaning task information. At this moment, the electric ground cleaning vehicle remains at a certain position, and the cleaning node takes the waypoint coordinates corresponding to the position as the starting point and the end point coordinates of the cleaning task as the end point. The global path planning is re-called to generate the coordinates of each waypoint of the new global path, which is sent to the planning node as a new cleaning task, and the electric ground cleaning vehicle begins to resume the execution of the cleaning task.
[0091] In this embodiment, during the cleaning process of the electric ground cleaning vehicle, the planning node reports the execution status of the task to the cleaning node in real time, and the map node reports the coordinate information of the waypoints traveled by the cleaning task to the cleaning node in real time.
[0092] To sum up, the embodiments of the present application are applied to ground cleaning electric vehicles deployed with a ROS network. After an unexpected crash of a ROS node, the business node can quickly and effectively restore the task according to the delayed start method of different nodes, thereby avoiding the situation where the ground cleaning electric vehicle stops operating for a long time, improving operating efficiency, and reducing the number of operating personnel, which is conducive to the promotion of the ground cleaning electric vehicle.
[0093] Corresponding to the aforementioned application function implementation method embodiment, the present application also provides a task recovery device and corresponding embodiments.
[0094] Figure 3 : is a structural diagram of a task recovery device shown in an embodiment of the present application. The device is set in a service node in a ROS network, the ROS network includes a service node, a diagnostic node and a first node related to the service status of the service node, and the device includes:
[0095] The subscription module 301 is used to subscribe to the diagnosis result of the diagnosis node after the self-start of each node in the ROS network is delayed accordingly, and the diagnosis result is determined by the diagnosis node periodically from the heartbeat signal of the business node and the first node, and the diagnosis period of the diagnosis node is less than the delay time of the business node and the first node;
[0096] The operation module 302 is used to save the task information related to the lost node when the subscribed diagnosis result is that the node is lost, and end the related task;
[0097] The planning module 303 is used to plan related tasks directly or indirectly through the stored task information according to the restored node when the subscribed diagnosis result is that the lost node is restored, so as to execute the planned tasks.
[0098] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated again here.
[0099] The method according to the present application may also be implemented as a computer program or a computer program product, which includes computer program code instructions for executing some or all of the steps in the above method of the present application.
[0100] Alternatively, the present application can also be implemented as a computer-readable storage medium (or non-transitory machine-readable storage medium or machine-readable storage medium) on which executable code (or computer program or computer instruction code) is stored. When the executable code (or computer program or computer instruction code) is executed by a processor of an electronic device (or server, etc.), the processor executes part or all of the steps of the above-mentioned method according to the present application.
[0101] The embodiments of the present application have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A task recovery method, characterized in that: The method is applied to a service node in a ROS network, the ROS network comprising the service node, a diagnostic node and a first node related to the service status of the service node, and the method comprises: After the self-start of each node in the ROS network is delayed accordingly, the service node subscribes to the diagnosis result of the diagnosis node, the diagnosis result is periodically determined by the diagnosis node from the heartbeat signal of the service node and the first node, and the diagnosis period of the diagnosis node is less than the delay time of the service node and the first node; When the subscribed diagnosis result is that the node is lost, the service node saves the task information related to the lost node and ends the related task; When the subscribed diagnosis result is that the lost node is restored, the service node plans the related tasks directly or indirectly through the saved task information according to the restored node to execute the planned tasks.
2. The task recovery method according to claim 1, characterized in that: If the lost node is the first node, the service node plans the related tasks directly or indirectly through the saved task information according to the restored node when the subscribed diagnosis result is that the lost node is restored, including: If the subscribed diagnosis result is that the lost first node is restored, the service node plans the related tasks according to the stored service information.
3. The task recovery method according to claim 2, characterized in that: The service node plans the related tasks according to the stored service information, including: The service node restores the service state of the service layer; The service node takes the current waypoint coordinates in the stored service information as a starting point, calls the global path planning again to generate a new global path, and sends it to the planning node in the first node.
4. The task recovery method according to claim 1, characterized in that: If the lost node is another service node, the service node plans the related tasks directly or indirectly through the saved task information according to the restored node when the subscribed diagnosis result is that the lost node is restored, including: If the subscribed diagnosis result is that the lost other service nodes are restored, the service node synchronizes the stored service information to the other service nodes, and the other service nodes plan the related tasks according to the synchronized service information.
5. The task recovery method according to claim 1, characterized in that: If the number of lost nodes is at least two, the service node plans the related tasks directly and / or indirectly through the stored task information according to the restored nodes when all lost nodes are restored.
6. The task recovery method according to claim 1, characterized in that: The method further comprises: If a temporary task with a higher priority is triggered, the service node saves the current task information, ends the current task, and executes the temporary task; After the temporary task is executed, the service node plans the current task according to the current service information.
7. The task recovery method according to claim 1, characterized in that: If the lost node recovers, the lost node is configured to switch to an idle state.
8. The task recovery method according to claim 1, characterized in that: The ROS network further includes a second node that is independent of the service state of the service node, and a diagnosis period of the diagnosis node is greater than a delay time of the diagnosis node and the second node.
9. The task recovery method according to claim 8, characterized in that: The service node and the first node have a respawn-delay attribute, and the diagnosis node and the second node have a respawn attribute.
10. A task recovery device, characterized in that: The device is arranged at a service node in a ROS network, the ROS network comprising a service node, a diagnostic node and a first node related to the service status of the service node, and the device comprises: A subscription module, used for subscribing to the diagnosis result of the diagnosis node after the self-start of each node in the ROS network is delayed accordingly, wherein the diagnosis result is periodically determined by the diagnosis node from the heartbeat signal of the business node and the first node, and the diagnosis period of the diagnosis node is less than the delay time of the business node and the first node; An operation module, used for saving task information related to the lost node and ending the related task when the subscribed diagnosis result is that the node is lost; The planning module is used to plan the related tasks directly or indirectly through the saved task information according to the restored node when the subscribed diagnosis result is that the lost node is restored, so as to execute the planned tasks.
11. An electronic device, characterized in that: include: processor; as well as A memory having executable codes stored thereon, which, when executed by the processor, causes the processor to execute the method according to any one of claims 1 to 10.
12. A mobile tool, characterized in that: The mobile tool comprises the electronic device as claimed in claim 11.
13. A computer-readable storage medium having executable codes stored thereon, which, when executed by a processor of an electronic device, causes the processor to execute the method according to any one of claims 1 to 10.