Ros2 node remote control method and system
By setting up a master ROS2 node in the ROS2 distributed system, the node name is bound to the device information and remotely controlled, which solves the problem of low management efficiency of existing ROS2 nodes and improves development efficiency and robustness.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INSPUR SUZHOU INTELLIGENT TECH CO LTD
- Filing Date
- 2023-02-17
- Publication Date
- 2026-05-26
AI Technical Summary
The current ROS2 node startup and shutdown control on multiple computing devices requires manual operation, which is inefficient and inconvenient to manage. The node task allocation has low robustness and scalability.
By setting up a master ROS2 node in the ROS2 distributed system, the device can be managed to remotely control nodes on other computing devices, thereby binding and mapping node names with device information, and using the Secure Shell protocol for passwordless login and remote control.
It improves ROS2 development efficiency, enhances node robustness and scalability, simplifies node management, and avoids frequent manual operations.
Smart Images

Figure CN116302252B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method and system for remote control of ROS2 nodes. Background Technology
[0002] The Robot Operating System (ROS) is a software development kit used for developing robot application software. Due to its advantages such as high real-time performance, free and open source, and support for distributed computing and communication, it has been widely praised by industry and academia and is now widely used in many fields, such as industrial robots, service robots, and autonomous driving.
[0003] In its initial stages, ROS was primarily used on standalone computing devices. As technology advanced, ROS's features became insufficient for many scenarios. To adapt to the needs of robot development, the second-generation robot operating system (ROS2) was introduced. ROS2 improved upon ROS in terms of system architecture, such as multi-robot platforms, real-time performance, and network connectivity. It established a self-discovery mechanism, achieving true distributed computing. Furthermore, it adopted a Data Distribution Service (DDS) communication mechanism, making the system more stable and flexible.
[0004] While ROS2 currently implements underlying distributed computing, some shortcomings remain in node startup and computation layers during practical applications. When multiple computing devices are running ROS2 tasks, controlling node startup and shutdown requires manual operation on each device individually. This method is inefficient and makes node management difficult. Therefore, a remote control method and system for ROS2 nodes is urgently needed to address these issues. Summary of the Invention
[0005] To address the problems existing in the prior art, this invention provides a method and system for remote control of ROS2 nodes.
[0006] This invention provides a method for remote control of ROS2 nodes, comprising:
[0007] Based on the ROS2 node configuration file, a first target device and a second target device are determined. The first target device is the computing device corresponding to the main ROS2 node in the ROS2 node group, and the second target device is the computing device corresponding to other ROS2 nodes in the ROS2 node group other than the main ROS2 node.
[0008] The node startup command is sent from the first target device to the second target device to start the ROS2 node in the second target device according to the node startup command.
[0009] According to a ROS2 node remote control method provided by the present invention, before determining the first target device and the second target device based on the ROS2 node configuration file, the method further includes:
[0010] Obtain device information from multiple computing devices;
[0011] Based on the functional type of each ROS2 node in the ROS2 node group, generate the node name corresponding to each ROS2 node.
[0012] The ROS2 node name and the device information are bound one by one to construct the ROS2 node configuration file.
[0013] According to a remote control method for a ROS2 node provided by the present invention, the step of binding the ROS2 node name and the device information one by one to construct the ROS2 node configuration file includes:
[0014] Based on the computing capabilities of each computing device, the ROS2 node name is bound to the corresponding device information one by one to obtain the mapping relationship between the ROS2 node and the computing device. The device information includes the device name, login information and IP address information of the computing device.
[0015] Based on the preset master device selection rules, a master ROS2 node is determined in the ROS2 node group, and the ROS2 node configuration file is constructed according to the master ROS2 node and the mapping relationship.
[0016] According to a ROS2 node remote control method provided by the present invention, after binding the ROS2 node name and the device information one by one to construct the ROS2 node configuration file, the method further includes:
[0017] Based on the secure enclosure protocol, a communication connection is established between the first target device and each of the second target devices;
[0018] After the communication connection is established, based on the mapping relationship, each ROS2 node is assigned to a corresponding computing device through the first target device, so that each ROS2 node runs on the corresponding computing device.
[0019] According to a ROS2 node remote control method provided by the present invention, the step of determining a first target device and a second target device based on the ROS2 node configuration file includes:
[0020] The target ROS2 node is determined based on the dependency relationship between the main ROS2 node and other ROS2 nodes in the ROS2 node group;
[0021] The target device information is obtained by using the node name of the target ROS2 node and the mapping relationship. The target device information is the device information of the computing device that has been assigned the target ROS2 node.
[0022] The computing device running the main ROS2 node is identified as the first target device, and the second target device is identified based on the target device information.
[0023] According to a remote control method for ROS2 nodes provided by the present invention, after the communication connection is established, based on the mapping relationship, each ROS2 node is assigned to a corresponding computing device through the first target device so that each ROS2 node runs on the corresponding computing device, the method further includes:
[0024] Based on the function type of the newly added ROS2 node, the newly added ROS2 node is bound to the corresponding device information, and the mapping relationship is updated according to the binding result to obtain the updated mapping relationship;
[0025] Based on the updated mapping relationship, the newly added ROS2 nodes are assigned to the corresponding computing devices.
[0026] According to a ROS2 node remote control method provided by the present invention, after sending a node startup command to a second target device via a first target device to start the ROS2 node in the second target device according to the node startup command, the method further includes:
[0027] The first target device sends a node shutdown command to the second target device to start or shut down the ROS2 node in the second target device according to the node shutdown command.
[0028] The present invention also provides a ROS2 node remote control system, comprising:
[0029] The parsing module is used to determine a first target device and a second target device based on the ROS2 node configuration file. The first target device is the computing device corresponding to the main ROS2 node in the ROS2 node group, and the second target device is the computing device corresponding to other ROS2 nodes in the ROS2 node group other than the main ROS2 node.
[0030] The node remote control module is used to send a node startup command to the second target device through the first target device, so as to start the ROS2 node in the second target device according to the node startup command.
[0031] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the ROS2 node remote control method as described above.
[0032] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the ROS2 node remote control method as described above.
[0033] The present invention provides a method and system for remote control of ROS2 nodes. By setting up a master ROS2 node in a ROS2 application with multiple interconnected computing devices, the computing device running the master ROS2 node can remotely control the ROS2 nodes on other computing devices. This avoids the existing manual operation of logging into remote nodes for control, improves ROS2 development efficiency, and makes it easier to manage the ROS2 development process. Attached Figure Description
[0034] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0035] Figure 1 A flowchart illustrating the ROS2 node remote control method provided by this invention;
[0036] Figure 2 This is a communication diagram of multiple computing devices provided by the present invention;
[0037] Figure 3 This is a schematic diagram of the structure of the ROS2 node remote control system provided by the present invention;
[0038] Figure 4 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0039] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0040] In the current ROS2 development process, when multiple computing devices run ROS2 tasks, the control process of starting and stopping each ROS2 node requires developers to manually start or stop the node on each computing device on which it runs. This results in low development efficiency and makes the nodes difficult to manage. Furthermore, when using multiple computing devices to run ROS2 nodes, the task allocation process also requires manual task splitting, which has low robustness. At the same time, when expanding computing devices, nodes also need to be manually reallocated to computing devices, resulting in low scalability.
[0041] This invention addresses the problems existing in the remote control of ROS2 nodes by constructing a master node (i.e., the primary ROS2 node) within the ROS2 distributed system as a node management device (i.e., the first target device). This node management device then remotely manages the startup and shutdown of ROS2 nodes on other computing devices (i.e., the second target device). By simply setting the login information and assigned node names for different computing nodes on the node management device, all nodes in the ROS2 distributed system can be started and stopped with a single click. This effectively improves ROS2 development efficiency and significantly enhances robustness, fault tolerance, and scalability compared to traditional methods. Furthermore, for changes or additions / removals of ROS2 nodes, this invention only requires modifying the device and node information in the configuration file, avoiding frequent modifications to the startup file due to node allocation changes and the inefficiency of manual expansion methods in existing approaches.
[0042] Figure 1 This is a flowchart illustrating the ROS2 node remote control method provided by the present invention, as shown below. Figure 1 As shown, this invention provides a method for remote control of ROS2 nodes, including:
[0043] Step 101: Based on the ROS2 node configuration file, determine the first target device and the second target device, wherein the first target device is the computing device corresponding to the main ROS2 node in the ROS2 node group, and the second target device is the computing device corresponding to other ROS2 nodes in the ROS2 node group other than the main ROS2 node.
[0044] In this invention, a ROS2 distributed system is provided with multiple computing devices. Each computing device is interconnected using a high-speed serial computer expansion bus (Peripheral Component Interconnect Express, or PCIE for short) in EP (EndPoint) mode.
[0045] Furthermore, in this invention, all computing devices have complete bidirectional connections and can normally receive topic and service messages. Simultaneously, to enable remote startup of ROS2 nodes across devices, the master node (i.e., the primary ROS2 node) in the ROS2 node group of the ROS2 distributed system is determined using the previously configured ROS2 node configuration file, along with the computing device running the primary ROS2 node (i.e., the first target device). Then, based on task requirements, other corresponding ROS2 nodes are selected, and the computing devices running these ROS2 nodes are designated as the second target devices.
[0046] In this invention, any ROS2 node on one of the computing devices in the distributed ROS2 system can be selected as the master node. On this computing device, a passwordless SSH login environment can be set up to enable passwordless SSH login from the first target device to any other second target device. Alternatively, a master node can be selected based on the computing power of the computing device or the dependency relationship between the ROS2 nodes in the task requirements (e.g., the ROS2 node to be selected as the master node is mainly used for simulation calculations of various data, while other ROS2 nodes are used to calculate relevant data for different functions and feed this data back to the master node for processing). Figure 2 This is a schematic diagram of communication between multiple computing devices provided by the present invention, which can be referred to. Figure 2 As shown, DDS communication can be achieved between devices A, B, and C, and device A can log in to devices B and C without a password via the SSH protocol.
[0047] Step 102: Send a node startup command to the second target device through the first target device, so as to start the ROS2 node in the second target device according to the node startup command.
[0048] In this invention, after parsing the ROS2 node configuration file through the above embodiments, the first target device and the second target device in the distributed ROS2 system are determined. It should be noted that in this invention, there is at least one second target device. When remotely controlling multiple second target devices, according to the mapping relationship in the configuration file and the development task requirements, the first target device is used to remotely enable the ROS2 nodes in the multiple second target devices involved in this case. Alternatively, according to actual needs, some of the ROS2 nodes in the second target devices can be remotely enabled.
[0049] Furthermore, in this invention, a node startup command is executed on the first target device and sent to the second target device via a communication protocol, thereby starting the ROS2 nodes in each of the second target devices. Specifically, in this invention, during the ROS2 node startup process, each ROS2 node corresponding to the current development task, as well as the computing device information on which these ROS2 nodes run, is first determined according to the ROS2 node configuration file. For the first target device where the master node is located, after the master node receives the node startup command, it directly runs the ROS2 node on the first target device. If the ROS2 node to be started is assigned to a second target device, the first target device remotely logs into the second target device via the SSH protocol using the IP address and login information of the second target device, and sends the node startup command to the second target device.
[0050] The ROS2 node remote control method provided by this invention sets up a master ROS2 node in a ROS2 application with multiple interconnected computing devices, and then remotely controls the ROS2 nodes on other computing devices through the computing device running the master ROS2 node. This avoids the existing manual operation of logging into remote nodes for control, improves ROS2 development efficiency, and makes it easier to manage the ROS2 development process.
[0051] Based on the above embodiments, before determining the first target device and the second target device according to the ROS2 node configuration file, the method further includes:
[0052] Obtain device information from multiple computing devices;
[0053] Based on the functional type of each ROS2 node in the ROS2 node group, generate the node name corresponding to each ROS2 node.
[0054] The ROS2 node name and the device information are bound one by one to construct the ROS2 node configuration file.
[0055] In this invention, the remote control process of ROS2 nodes in the autonomous driving framework Autoware.auto is used as an example. Autoware.auto, as an open-source collaborative project, is seamlessly compatible with ROS2 and is used for the functional development, simulation, and verification of autonomous driving systems. These systems include multiple modules such as perception, localization, planning, and control (corresponding to the computational functions of multiple ROS2 nodes). Due to the limited computing power of a single edge computing device, different functions need to be assigned to different computing devices; that is, different ROS2 nodes perform computations on different computing devices. Specifically, in one embodiment, by obtaining the device information of each computing device, such as IP address information, the functional type to be implemented by each ROS2 node is bound to the corresponding IP address, i.e., one ROS2 node corresponds to one computing device. This constructs a ROS2 node configuration file, and then, based on this configuration file, different ROS2 nodes are assigned to their corresponding computing devices. It should be noted that in this invention, for the pre-built configuration file, any ROS2 node in the configuration file can be set as the primary ROS2 node at any time according to different task requirements (developers can set this according to the region where the current computing device is located; for example, the ROS2 node already assigned in the computing device currently operated by the developer can be set as the primary ROS2 node), allowing developers to directly use the nearest computing device to quickly remotely control ROS nodes on other computing devices.
[0056] Based on the above embodiments, the step of binding the ROS2 node name and the device information one by one to construct the ROS2 node configuration file includes:
[0057] Based on the computing capabilities of each computing device, the ROS2 node name is bound to the corresponding device information one by one to obtain the mapping relationship between the ROS2 node and the computing device. The device information includes the device name, login information and IP address information of the computing device.
[0058] Based on the preset master device selection rules, a master ROS2 node is determined in the ROS2 node group, and the ROS2 node configuration file is constructed according to the master ROS2 node and the mapping relationship.
[0059] In this invention, ROS2 nodes with different computing functions are allocated to corresponding computing devices based on their computing capabilities. In one embodiment, the computing devices used mainly consist of two parts: one x86 architecture server and four ARM architecture edge computing devices. Specific device information can be found in Table 1.
[0060] Table 1
[0061]
[0062] Furthermore, based on the functional type to be implemented by each ROS2 node, a corresponding node name is generated, thereby providing a more intuitive understanding of the functions implemented by the ROS2 node. In this invention, the node name of each ROS2 node is bound to the device information of the computing device to which the ROS2 node is to be assigned, thus establishing a mapping relationship between the ROS2 node and the computing device. Further, according to a preset master device selection rule, a master ROS2 node is selected from the multiple bound ROS2 nodes, thereby obtaining the ROS2 node configuration. In one embodiment, the master ROS2 node can be selected according to user needs, or it can be selected from the devices with higher computing power (e.g., selecting an X86 architecture server from Table 1) as the master ROS2 node based on the computing power of the computing device.
[0063] Specifically, an x86 server is interconnected with four Orin edge computing devices via PCIe, operating in EP (EndPoint) mode, enabling effective communication between any two computing devices. For ease of description, the x86 server and the four Orin devices are labeled as Device A, Device B, Device C, Device D, and Device E, respectively. Device A serves as the master node, and a node allocation strategy is set. Based on the different functional computing characteristics, ROS2 nodes in Autoware.auto are allocated for sensing, control, and planning functions. That is, the ROS2 nodes in Device A are responsible for simulation functions, the ROS2 nodes in Device B are responsible for sensing functions, the ROS2 nodes in Device C are responsible for control functions, the ROS2 nodes in Device D are responsible for planning functions, and the ROS2 nodes in Device E are responsible for positioning functions. The specific allocation is shown in Table 2 below.
[0064] Table 2
[0065] Equipment Name Device IP Login Username ROS2 node name A 192.168.3.6 A / rviz / * B 192.168.3.7 B / perception / * C 192.168.3.8 C / control / * D 192.168.3.9 D / planning / * E 192.168.3.10 E / location / *
[0066] In Table 2, * represents a wildcard. Based on the node information in Table 2, node allocation is performed in config_node.yaml, binding the IP address information of the specified computing device with the ROS2 node name. The device name, IP address, login information, and other device information have a one-to-many dictionary relationship with the ROS2 node. In one embodiment, the IP address information is the key, and the ROS2 node is the value, establishing a mapping relationship between them. Alternatively, the mapping relationship between device information and ROS2 nodes can be established based on the device name, IP address, login information, etc. In one embodiment, the contents of config_node.yaml can be seen in Table 3.
[0067] Table 3
[0068]
[0069] Based on the above embodiments, after binding the ROS2 node name and the device information one by one to construct the ROS2 node configuration file, the method further includes:
[0070] Based on the secure enclosure protocol, a communication connection is established between the first target device and each of the second target devices;
[0071] After the communication connection is established, based on the mapping relationship, each ROS2 node is assigned to a corresponding computing device through the first target device, so that each ROS2 node runs on the corresponding computing device.
[0072] In this invention, SSH-related software packages are installed on each computing device, enabling the first target device to log in to multiple second target devices via the SSH protocol in a password-free manner, thereby controlling the start or stop of ROS2 nodes on the multiple second target devices and improving ROS2 development efficiency.
[0073] Based on the above embodiments, determining the first target device and the second target device according to the ROS2 node configuration file includes:
[0074] The target ROS2 node is determined based on the dependency relationship between the main ROS2 node and other ROS2 nodes in the ROS2 node group;
[0075] The target device information is obtained by using the node name of the target ROS2 node and the mapping relationship. The target device information is the device information of the computing device that has been assigned the target ROS2 node.
[0076] The computing device running the main ROS2 node is identified as the first target device, and the second target device is identified based on the target device information.
[0077] In this invention, based on the ROS2 node group, it is necessary to determine the target ROS2 node to be run on the second target device according to the current development task requirements. For example, in the autonomous driving framework Autoware.auto, the ROS2 node in device A is responsible for simulation function, the ROS2 node in device B is responsible for perception function, the ROS2 node in device C is responsible for control function, the ROS2 node in device D is responsible for planning function, and the ROS2 node in device E is responsible for positioning function. Since the ROS2 node of device A needs to obtain relevant data from the ROS2 nodes of devices B, C, D and E for simulation calculation, the target ROS2 node can be selected from the ROS2 node group according to the above dependencies.
[0078] Furthermore, after completing the ROS2 node allocation strategy, software programs are written to enable SSH login to remote devices and the startup of corresponding processes. Specifically, on device A (the first target device), the `ros2 launch` command is used as the node startup instruction. By parsing and reading the contents of `config_node.yaml`, ROS2 nodes are allocated to various devices. A process is established to enable SSH remote login to the second target device, and the command to start the ROS2 nodes is executed on the second target device, completing the node startup. It should be noted that in this invention, after allocating each ROS2 node to its corresponding computing device, in subsequent remote control operations, the ROS2 nodes on multiple second target devices can be remotely started directly from the first target device without needing to perform node allocation operations again. Node allocation operations are only performed again when node information changes (such as adding a ROS2 node or changing the computing device on which the ROS2 node is located).
[0079] Based on the above embodiments, after the communication connection is established, and based on the mapping relationship, each ROS2 node is assigned to a corresponding computing device through the first target device so that each ROS2 node runs on the corresponding computing device, the method further includes:
[0080] Based on the function type of the newly added ROS2 node, the newly added ROS2 node is bound to the corresponding device information, and the mapping relationship is updated according to the binding result to obtain the updated mapping relationship;
[0081] Based on the updated mapping relationship, the newly added ROS2 nodes are assigned to the corresponding computing devices.
[0082] In this invention, on the computing device where the master node is located, an updated configuration file can be obtained by modifying the correspondence between ROS2 nodes and computing device IP address information in the configuration file. For example, adding a new ROS2 node. In one embodiment, the device relationship of ROS2 nodes that have been allocated to computing devices in the current configuration file can also be adjusted, and the ROS2 nodes on the current computing device can be allocated to different computing devices, thereby improving the scalability of the distributed ROS2 system. Each ROS2 node name uniquely corresponds to a device IP address, indicating that the ROS2 node is running on the target device.
[0083] Based on the above embodiments, after sending the node startup command to the second target device through the first target device to start the ROS2 node in the second target device according to the node startup command, the method further includes:
[0084] The first target device sends a node shutdown command to the second target device to start or shut down the ROS2 node in the second target device according to the node shutdown command.
[0085] In this invention, when it is necessary to shut down all current ROS2 node processes, a termination command is executed on the computing device where the master node resides. Using the SSH protocol and process management method, only the program on the first target node needs to be closed to simultaneously terminate the ROS2 nodes on all computing devices. Preferably, in one embodiment, some ROS2 nodes can be remotely shut down according to development needs.
[0086] The ROS2 node remote control system provided by the present invention is described below. The ROS2 node remote control system described below and the ROS2 node remote control method described above can be referred to in correspondence.
[0087] Figure 3 This is a schematic diagram of the ROS2 node remote control system provided by the present invention, as shown below. Figure 3As shown, the present invention provides a ROS2 node remote control system, including a parsing module 301 and a node remote control module 302. The parsing module 301 is used to determine a first target device and a second target device according to the ROS2 node configuration file. The first target device is the computing device corresponding to the master ROS2 node in the ROS2 node group, and the second target device is the computing device corresponding to other ROS2 nodes in the ROS2 node group other than the master ROS2 node. The node remote control module 302 is used to send a node start command to the second target device through the first target device, so as to start the ROS2 node in the second target device according to the node start command.
[0088] In this invention, all computing devices in the distributed ROS2 system have complete bidirectional connections and can normally receive topic and service messages. To enable remote startup of ROS2 nodes across devices, the parsing module 301 parses the ROS2 node configuration file obtained in the previous configuration to determine the master node (i.e., the primary ROS2 node) in the ROS2 node group of the ROS2 distributed system, and the computing device running the primary ROS2 node (i.e., the first target device). Then, according to the task requirements, other corresponding ROS2 nodes are selected, and the computing devices running these ROS2 nodes are designated as the second target devices.
[0089] Furthermore, the node remote control module 302 remotely logs into any other second target device through the first target device, and remotely starts the ROS2 nodes in the multiple second target devices involved in this invention using the first target device. Alternatively, it can remotely start only some of the ROS2 nodes in the second target devices as needed. In this invention, the node remote control module 302 runs a node startup command in the first target device and sends the node startup command to the second target devices via a communication protocol, thereby starting the ROS2 nodes in each of the second target devices. Specifically, in this invention, during the ROS2 node startup process, the node remote control module 302 first determines each ROS2 node corresponding to the current development task, as well as the computing device information on which these ROS2 nodes are running, according to the ROS2 node configuration file. For the first target device where the master node is located, after the master node receives the node startup command, the node remote control module 302 directly runs the ROS2 node on the first target device. If the ROS2 node to be started is assigned to the second target device, the node remote control module 302 remotely logs into the second target device via the SSH protocol using the first target device, based on the IP address and login information of the second target device, and sends the node startup command to the second target device.
[0090] The ROS2 node remote control system provided by this invention sets up a master ROS2 node in a ROS2 application with multiple interconnected computing devices, and then remotely controls the ROS2 nodes on other computing devices through the computing device running the master ROS2 node. This avoids the existing manual operation of logging into remote nodes for control, improves ROS2 development efficiency, and makes it easier to manage the ROS2 development process.
[0091] The system provided by this invention is used to execute the above-described method embodiments. For specific processes and details, please refer to the above embodiments, which will not be repeated here.
[0092] Figure 4 This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 4 As shown, the electronic device may include: a processor 401, a communications interface 402, a memory 403, and a communication bus 404, wherein the processor 401, communications interface 402, and memory 403 communicate with each other via the communication bus 404. The processor 401 can call logical instructions in the memory 403 to execute a ROS2 node remote control method. This method includes: determining a first target device and a second target device according to a ROS2 node configuration file, wherein the first target device is the computing device corresponding to the primary ROS2 node in the ROS2 node group, and the second target device is the computing device corresponding to other ROS2 nodes in the ROS2 node group besides the primary ROS2 node; sending a node startup command to the second target device through the first target device to start the ROS2 node in the second target device according to the node startup command.
[0093] Furthermore, the logical instructions in the aforementioned memory 403 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0094] On the other hand, the present invention also provides a computer program product, the computer program product including a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, when the program instructions are executed by a computer, the computer is able to execute the ROS2 node remote control method provided by the above methods, the method including: determining a first target device and a second target device according to a ROS2 node configuration file, wherein the first target device is a computing device corresponding to the main ROS2 node in the ROS2 node group, and the second target device is a computing device corresponding to other ROS2 nodes in the ROS2 node group other than the main ROS2 node; sending a node startup instruction to the second target device through the first target device, so as to start the ROS2 node in the second target device according to the node startup instruction.
[0095] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the ROS2 node remote control method provided in the above embodiments. The method includes: determining a first target device and a second target device according to a ROS2 node configuration file, wherein the first target device is a computing device corresponding to the master ROS2 node in a ROS2 node group, and the second target device is a computing device corresponding to other ROS2 nodes in the ROS2 node group besides the master ROS2 node; sending a node startup command to the second target device through the first target device to start the ROS2 node in the second target device according to the node startup command.
[0096] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0097] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0098] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A ROS 2 node remote control method, comprising: include: Based on the ROS2 node configuration file, a first target device and a second target device are determined. The first target device is the computing device corresponding to the primary ROS2 node in the ROS2 node group, and the second target device is the computing device corresponding to other ROS2 nodes in the ROS2 node group besides the primary ROS2 node. The primary ROS2 node is determined by setting any ROS2 node in the configuration file based on different task requirements. In remote control operations, the ROS2 nodes on multiple second target devices are remotely started through the first target device. If the node information changes, a node allocation operation is performed. The node startup command is sent from the first target device to the second target device to start the ROS2 node in the second target device according to the node startup command. Before determining the first target device and the second target device based on the ROS2 node configuration file, the method further includes: Obtain device information from multiple computing devices; Based on the functional type of each ROS2 node in the ROS2 node group, generate the node name corresponding to each ROS2 node. The ROS2 node name and the device information are bound one by one to construct the ROS2 node configuration file; The step of binding the ROS2 node name and the device information one by one to construct the ROS2 node configuration file includes: Based on the computing capabilities of each computing device, the ROS2 node name is bound to the corresponding device information one by one to obtain the mapping relationship between the ROS2 node and the computing device. The device information includes the device name, login information and IP address information of the computing device. Based on the preset master device selection rules, a master ROS2 node is determined in the ROS2 node group, and the ROS2 node configuration file is constructed according to the master ROS2 node and the mapping relationship. After binding the ROS2 node names and device information one by one to construct the ROS2 node configuration file, the method further includes: Based on the secure enclosure protocol, a communication connection is established between the first target device and each of the second target devices; After the communication connection is established, based on the mapping relationship, each ROS2 node is assigned to a corresponding computing device through the first target device, so that each ROS2 node runs on the corresponding computing device.
2. The ROS2 node remote control method of claim 1, wherein, The step of determining the first target device and the second target device based on the ROS2 node configuration file includes: The target ROS2 node is determined based on the dependency relationship between the main ROS2 node and other ROS2 nodes in the ROS2 node group; The target device information is obtained by using the node name of the target ROS2 node and the mapping relationship. The target device information is the device information of the computing device that has been assigned the target ROS2 node. The computing device running the main ROS2 node is identified as the first target device, and the second target device is identified based on the target device information.
3. The ROS2 node remote control method of claim 1, wherein, After the communication connection is established, based on the mapping relationship, each ROS2 node is assigned to a corresponding computing device through the first target device so that each ROS2 node runs on the corresponding computing device. The method further includes: Based on the function type of the newly added ROS2 node, the newly added ROS2 node is bound to the corresponding device information, and the mapping relationship is updated according to the binding result to obtain the updated mapping relationship; Based on the updated mapping relationship, the newly added ROS2 nodes are assigned to the corresponding computing devices.
4. The ROS 2 node remote control method of any one of claims 1 to 3, wherein, After sending a node startup command to the second target device via the first target device to start the ROS2 node in the second target device according to the node startup command, the method further includes: The first target device sends a node shutdown command to the second target device to start or shut down the ROS2 node in the second target device according to the node shutdown command.
5. A ROS2 node remote control system, comprising: The system is used to implement the ROS2 node remote control method as described in any one of claims 1 to 4.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the ROS2 node remote control method as described in any one of claims 1 to 4.
7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the ROS2 node remote control method as described in any one of claims 1 to 4.