Program development method and device, computing equipment and storage medium

By extracting the scene template software package in the ROS framework and performing template processing, the problem that ROS2 applications cannot be deployed remotely is solved, and the rapid creation and compilation of robot applications across operating systems is achieved, supporting the rapid development and deployment of multi-target scenarios.

CN120631373APending Publication Date: 2025-09-12KYLAND TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510792899.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-13
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

The existing ROS2 application development method cannot be deployed remotely. The ROS2 compilation environment needs to be deployed separately on each machine, and the developed robot scenarios cannot be applied on machines with different operating systems.

Method used

By extracting the scene template software package of the reference scene, templatizing the software package name and node name, using the ROS framework to create the software package of the target scene on a computing device, and realizing rapid compilation and deployment across operating system environments through local or container compilation.

Benefits of technology

It enables the rapid creation and compilation of robot applications on a single computing device, supports the deployment of robot applications in multi-target scenarios with inconsistent operating systems, and reduces duplication of development work.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120631373A_ABST
    Figure CN120631373A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a program development method and device, a computing setup and a storage medium, a robot application program is developed on a computing device by using an ROS framework, and the method comprises the following steps: templating a software package name and a running node name in a software package of each computing device in a reference scene to obtain a scene template software package; obtaining a software package for each computing device in the target scene according to the scene template software package, configuring development options, and creating a work space based on an ROS framework; and according to the development option of each computing device in the target scene, calling a compiling component of the ROS framework in the workspace to compile a software package of the computing device. According to the technical scheme, the scene template software package is extracted from the existing robot scene, the software package of the new scene is created based on the scene template software package during development, and rapid creation and compiling of the robot application program are achieved on one computing device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software development technology, and in particular to a program development method, apparatus, computing device, and storage medium. Background Art

[0002] ROS2 (Robot Operating System 2) is an open-source framework for developing robotics applications. Current ROS2 application development methods are performed using the command line on an Ubuntu machine, creating an empty ROS2 package, writing source code, creating a launch configuration, compiling, and running the application.

[0003] The above development processes can only be performed on the local machine and cannot be deployed remotely unless the remote machine's operating system is exactly the same.

[0004] Actual robot application scenarios may include multiple software packages and nodes distributed across different machines. If you follow the existing ROS2 development process to develop scenario applications, you will need to deploy the ROS2 compilation environment on each machine and develop and compile ROS2 software packages separately.

[0005] If the developed scenario needs to be applied to another group of similar machines, the above development process must be repeated. Summary of the Invention

[0006] In view of this, the embodiments of the present application provide a program development method, apparatus, computing device and storage medium. The technical solution of the embodiments of the present application uses an existing robot scene as a reference scene, extracts a scene template software package, creates a new scene software package based on the scene template software package during development, and realizes the rapid creation and compilation of robot applications on a computing device.

[0007] In a first aspect, an embodiment of the present application provides a program development method for developing a robot application on a computing device using the ROS framework, the method comprising: templating the software package name and the running node name in the software package of each computing device in a reference scenario to obtain a scenario template software package, wherein the software package of the reference scenario is a software package developed based on the ROS framework, and the scenario template software includes a template software package for each computing device in the reference scenario; based on the scenario template software package, obtaining the software package of each computing device in the target scenario, and creating a workspace based on the ROS framework for the target scenario and configuring development options for each computing device, wherein the development options for each computing device in the target scenario include the software package and compilation method of the computing device; and calling the compilation component of the ROS framework in the workspace to compile the software package of the computing device according to the development options of each computing device in the target scenario.

[0008] As described above, by extracting a scenario template software package from a reference scenario, a software package of a new scenario is created based on the scenario template software package during development, thereby enabling rapid creation and compilation of a robot application on a computing device.

[0009] In a possible implementation of the first aspect, the compilation mode includes local compilation and container compilation; when the compilation mode of a target computing device in the target scenario is container compilation, an operating system environment of the computing device is constructed based on the container in the workspace, and the compilation component of the ROS framework is called in the environment to compile the software package of the computing device.

[0010] From the above, when the operating system environment of the target computing device (the computing device on which the software package to be compiled runs) is different from the current operating system environment, the compilation of the software package of the robot application of the target computing device is achieved through container compilation, and the rapid compilation of the software packages of the robot application of all computing devices in the multi-target field is achieved on one computing device.

[0011] In a possible implementation of the first aspect, for each computing device in the reference scenario, the templating specifically includes: defining a software package template name for the computing device, replacing the software package name in the source code and file name of the computing device software package with the software package template name; defining a template node name for each node of the computing device software package, and replacing the node name in the source code and file name of the computing device software package with the template node name.

[0012] As described above, by templating the software package source code and name keywords in the file name of any computing device in the reference scenario, the software package of the computing device is templating, thereby generating a software package for the computing device of the target scenario with the same functions.

[0013] In a possible implementation of the first aspect, for each computing device in the target scenario, when obtaining the software package of the computing device in the target scenario, it includes: obtaining a template software package of the computing device according to the development options of the computing device, and storing it in the computing space created for the computing device; replacing the software package template name in the source code and file name of the template software package of the computing device with the software package name of the computing device; replacing each template node name in the source code and file name of the software package of the computing device with the corresponding node name in the computing device.

[0014] As described above, by templating the software package source code and name keywords in the file name of any computing device in the reference scenario, the software package of the computing device is templating, thereby generating a software package for the computing device of the target scenario with the same functions.

[0015] In a possible implementation of the first aspect, it also includes: templating the reference scenario to obtain development options for each computing device in the reference scenario; configuring the development options for each computing device in the target scenario using the template scenario as a template, and adding a node in the software package of the computing device to the development options of each computing device in the target scenario.

[0016] As described above, by obtaining the template scene from the software package of the reference scene, the development options of each computing device in the target scene are configured according to the template scene of the reference scene, thereby facilitating the creation of the target scene.

[0017] In a possible implementation of the first aspect, the development options of each computing device in the target scenario include one of the following: a Launch file name option for the computing device, a host address option for the computing device; when the Launch file name option of a computing device in the target scenario includes a Launch file, the method further includes: after compiling the software package of the computing device in the target scenario, creating a Launch file for the computing device in the workspace according to the software package name and node name of the computing device; when the host address option of a computing device in the target scenario includes a host address, the method further includes: when deploying the software package of the computing device in the target scenario, sending the launch file of the computing device and the files of the computing device in the install directory in the workspace to the computing device according to the host address.

[0018] As described above, by configuring the development options of each computing device in the target scenario to include: a launch file name option and a host address option for the computing device, it is convenient to create a launch file for each computing device and deploy each computing device.

[0019] In a possible implementation of the first aspect, the method is executed through a command line in a ROS framework on a computing device in the target scene.

[0020] As described above, by executing the program development method on a computing device in the target scenario, there is no need to add a separate device to develop an application program for each computing device in the target scenario.

[0021] In a second aspect, an embodiment of the present application provides a program development device, which is deployed on a computing device and is used to develop robot applications using the ROS framework. The device includes: a template generation module, which is used to template the software package name and the running node name in the software package of each computing device in the reference scene to obtain a scene template software package, wherein the software package of the reference scene is a software package developed based on the ROS framework, and the scene template software includes a template software package for each computing device in the reference scene; a scene generation module, which is used to obtain the software package of each computing device in the target scene based on the scene template software package, and create a workspace based on the ROS framework for the target scene and configure the development options of each computing device, wherein the development options of each computing device include the software package and compilation method of the computing device; a software development module, which is used to call the compilation component of the ROS framework in the workspace to compile the software package of the computing device according to the development options of each computing device in the target scene.

[0022] As described above, by extracting a scenario template software package from a reference scenario, a software package of a new scenario is created based on the scenario template software package during development, thereby enabling rapid creation and compilation of a robot application on a computing device.

[0023] In a possible implementation of the first aspect, the compilation mode includes local compilation and container compilation; when the compilation mode of a target computing device in the target scenario is container compilation, an operating system environment of the computing device is constructed based on the container in the workspace, and the compilation component of the ROS framework is called in the environment to compile the software package of the computing device.

[0024] From the above, when the operating system environment of the target computing device (the computing device on which the software package to be compiled runs) is different from the current operating system environment, the compilation of the software package of the robot application of the target computing device is achieved through container compilation, and the rapid compilation of the software packages of the robot application of all computing devices in the multi-target field is achieved on one computing device.

[0025] In a possible implementation of the second aspect, for each computing device in the reference scenario, the template generation module is specifically used to include: defining a software package template name for the computing device, replacing the software package name in the source code and file name of the computing device software package with the software package template name; defining a template node name for each node of the software package of the computing device, and replacing the node name in the source code and file name of the computing device software package with the template node name.

[0026] As described above, by templating the software package source code and name keywords in the file name of any computing device in the reference scenario, the software package of the computing device is templating, thereby generating a software package for the computing device of the target scenario with the same functions.

[0027] In a possible implementation of the second aspect, for each computing device in the target scenario, the scenario generation module is used to obtain a template software package for the computing device according to the development options of the computing device when obtaining the software package of the computing device in the target scenario, and store it in the computing space created for the computing device; replace the software package template name in the source code and file name of the template software package of the computing device with the software package name of the computing device; and replace each template node name in the source code and file name of the software package of the computing device with the corresponding node name in the computing device.

[0028] As described above, by templating the software package source code and name keywords in the file name of any computing device in the reference scenario, the software package of the computing device is templating, thereby generating a software package for the computing device of the target scenario with the same functions.

[0029] In a possible implementation of the second aspect, the template generation module is also used to template the reference scene to obtain development options for each computing device in the reference scene; the scenario generation module configures the development options of each computing device in the target scene using the template scene as a template, and adds a node of the software package of the computing device to the development options of each computing device in the target scene.

[0030] As described above, by obtaining the template scene from the software package of the reference scene, the development options of each computing device in the target scene are configured according to the template scene of the reference scene, thereby facilitating the creation of the target scene.

[0031] In a possible implementation of the second aspect, the development options of each computing device in the target scenario include one of the following: a Launch file name option for the computing device, a host address option for the computing device; the apparatus further includes a startup configuration module for creating a Launch file for the computing device in the workspace according to the software package name and node name of the computing device after compiling the software package of the computing device in the target scenario when the Launch file name option of the computing device in the target scenario includes a Launch file; and a target deployment module for sending the launch file of the computing device in the workspace and the files of the computing device in the install directory to the computing device according to the host address when deploying the software package of the computing device in the target scenario when the host address option of the computing device in the target scenario includes a host address.

[0032] As described above, by configuring the development options of each computing device in the target scenario to include: a launch file name option and a host address option for the computing device, it is convenient to create a launch file for each computing device and deploy each computing device.

[0033] In a possible implementation of the second aspect, the apparatus is deployed on a computing device in the target scene and is run through a command line in a ROS framework.

[0034] As described above, by executing the program development method on a computing device in the target scenario, there is no need to add a separate device to develop an application program for each computing device in the target scenario.

[0035] In a third aspect, an embodiment of the present application provides a computing device, comprising: a bus; a communication interface connected to the bus; at least one processor connected to the bus; and at least one memory connected to the bus and storing program instructions, wherein when the program instructions are executed by the at least one processor, the at least one processor executes the method described in any embodiment of the first aspect of the present application.

[0036] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having program instructions stored thereon, which, when executed by a computer, causes the computer to execute the method described in any embodiment of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 A flowchart of a program development method embodiment 1 of the present application;

[0038] Figure 2 This is a flow chart of a second embodiment of a program development method of the present application;

[0039] Figure 3 A schematic diagram of a software package templating process for a computing device in a reference scenario in a second embodiment of a program development method of the present application;

[0040] Figure 4 A schematic diagram of a scene templating process of a computing device in a reference scene in a second embodiment of a program development method of the present application;

[0041] Figure 5 This is a schematic diagram of the structure of the target scenario of Example 2 of a program development method of this application;

[0042] Figure 6 This is a structural diagram of a program development device embodiment 1 of the present application;

[0043] Figure 7 This is a structural diagram of a second embodiment of a program development device of the present application;

[0044] Figure 8 A schematic diagram of the structure of the computing device of this application. DETAILED DESCRIPTION

[0045] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0046] In the following description, the terms "first\second\third, etc." or module A, module B, module C, etc. are not only used to distinguish similar objects, or to distinguish different embodiments, but do not represent a specific ordering of the objects. It can be understood that the specific order or sequence can be interchanged where permitted so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0047] In the following description, the numbers representing the steps, such as S110, S120, etc., do not necessarily mean that the steps must be executed in this manner. If permitted, the order of the steps can be interchanged or they can be executed simultaneously.

[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.

[0049] An embodiment of the present application provides a program development method, apparatus, computing device, and storage medium, the method utilizing the ROS framework to develop a robot application on a computing device, comprising: templating the software package name and running node name in the software package of each computing device in a reference scenario to obtain a scenario template software package, wherein the software package of the reference scenario is a software package developed based on the ROS framework, and the scenario template software includes a template software package for each computing device in the reference scenario; obtaining the software package of each computing device in a target scenario based on the scenario template software package, creating a ROS framework-based workspace for the target scenario, and configuring development options for each computing device, wherein the development options for each computing device include the software package and compilation method of the computing device; and calling the compilation component of the ROS framework in the workspace according to the development options of each computing device in the target scenario to compile the software package of the computing device.

[0050] The technical solution of the embodiment of the present application uses an existing robot scene as a reference scene, extracts a scene template software package, creates a new scene software package based on the scene template software package during development, and realizes the rapid creation and compilation of robot applications on a computing device.

[0051] The following describes various embodiments of the present application in conjunction with the accompanying drawings. Figure 1The following describes a first embodiment of a program development method of the present application.

[0052] Each step of a program development method embodiment 1 is executed on a computing device, that is, the generation and compilation of the software packages of each computing device in the target scenario are completed on one computing device (including a computing device in the target scenario).

[0053] Figure 1 The flowchart of the first embodiment of a program development method is shown, including steps S110 to S130.

[0054] S110: Template the software package name and the running node name in the software package of each computing device in the reference scenario to obtain a scenario template software package.

[0055] The software package of the reference scenario is a software package developed based on the ROS framework, and the scenario template software includes a template software package for each computing device in the reference scenario.

[0056] In some embodiments, templating the software package of any computing device in a reference scenario includes: defining a software package template name for the computing device, replacing the software package name in the source code and file name of the software package for the computing device with the software package template name; defining a template node name for each node in the software package for the computing device, and replacing the node name in the source code and file name of the software package for the computing device with the template node name. By templating the name keywords in the source code and file name of the software package for any computing device in the reference scenario, templating the software package for the computing device is achieved, thereby generating a software package for a computing device in a target scenario with the same functionality.

[0057] In some embodiments, templating the reference scenario further includes obtaining a template scenario based on a software package of each computing device in the reference scenario, wherein the template scenario includes development options for each computing device in the reference scenario. Obtaining the template scenario of the reference scenario facilitates creation of the target scenario.

[0058] S120: Obtain the software package of each computing device in the target scene according to the scene template software package and configure development options for each computing device, and create a workspace based on the ROS framework for the target scene.

[0059] The target scenario and the reference scenario have the same functionality. The development options for each computing device in the target scenario include the software package and compilation method for that computing device. The software package and compilation method for that computing device are determined based on the development options for that computing device. Compilation methods include native compilation and container compilation. Native compilation of the software package to be deployed uses the same operating system environment as the current computing device. Container compilation of the software package to be deployed uses a different operating system environment than the current computing device.

[0060] The ROS framework-based workspace created for the target scene includes a scene template software package to facilitate the generation of a software package for each computing device in the target scene.

[0061] In some embodiments, a template software package for each computing device in the target scenario is obtained and stored in the created computing space; the software package template name in the source code and file name of the template software package of the computing device is replaced with the software package name of the computing device; each template node name in the source code and file name of the software package of the computing device is replaced with the corresponding node name in the computing device, thereby completing the rapid generation of software packages for all computing devices in the target scenario on one computing device.

[0062] In some embodiments, when a template scenario is obtained, the development options of each computing device in the target scenario are configured using the template scenario as a template, and a node is added to the software package of each computing device in the target scenario. The development options of each computing device in the target scenario are configured based on the template scenario of the reference scenario, thereby facilitating the creation of the target scenario.

[0063] S130: According to the development options of each computing device in the target scenario, the compilation component of the ROS framework is called in the created workspace to compile the software package of the computing device.

[0064] In some embodiments, when a computing device uses container compilation as its compilation method, an operating system environment for the computing device is constructed based on the container in a created workspace. Within this environment, the compilation component of the ROS framework is called to compile the software package for the computing device. Therefore, when the operating system environment of the target computing device (the computing device where the software package to be compiled runs) differs from the current operating system environment, container compilation is used to compile the software package for the robot application on the target computing device, enabling rapid compilation of the robot application software packages for all computing devices in a multi-target field on a single computing device.

[0065] In some embodiments, the development options for each computing device include one of the following: a Launch file name option for the computing device, and a host address option for the computing device. When the Launch file name option for a computing device includes a Launch file name, its Launch file has already been generated; if it does not include a Launch file name, a Launch file for the computing device needs to be generated. When the host address option for a computing device includes a host address, the computing device is remotely deployed; if it does not include a host address, the computing device is locally deployed.

[0066] In some embodiments, when the Launch file name option of a computing device in the target scenario does not include a Launch file name, after compiling the software package of the computing device, a Launch file of the computing device is created in the created workspace based on the software package name and node name of each computing device.

[0067] In some embodiments, when the host address option of a computing device in the target scenario includes an available host address (not 127.0.0.1), when deploying the software package of the computing device, the launch file of the computing device in the created workspace and the files of the computing device in the install directory are sent to the computing device according to the host address.

[0068] The method described in this embodiment can be executed on a computing device in the target scenario, or it can be run on a computing device specifically used to develop applications for various scenarios. A better solution is to execute it through a command line in the ROS framework on a computing device in the target scenario.

[0069] In summary, a program development method embodiment 1 uses an existing robot scene as a reference scene, extracts a scene template software package, creates a target scene software package based on the scene template software package during development, and realizes the rapid creation and compilation of a robot application on a computing device.

[0070] The following combination Figures 2 to 5 The second embodiment of a program development method of the present application is introduced. The second embodiment of a program development method is a more detailed implementation of the first embodiment of the program development method, and has all the advantages thereof.

[0071] Figure 2 The flowchart of the second embodiment of a program development method is shown, including steps S210 to S270.

[0072] To describe the aspects Figure 5 Taking the structure of the target scenario of the second embodiment of a program development method as an example, the target scenario includes three computing devices Machine1, Machine2, and Machine3. The actual scenario may include multiple computing devices.

[0073] Machine 1, Machine 2, and Machine 3 are in the same LAN and connected by a switch. Machine 1 can access Machine 2 and Machine 3 using SSH without a password.

[0074] Among them, Machine1 includes two nodes, which have the ROS compilation environment and running environment; Machine2 includes one node, which only has the ROS running environment but not the compilation environment; Machine3 includes two nodes, which only has the ROS running environment but not the compilation environment.

[0075] A program development method embodiment 2: Develop ROS applications on Machi ne 1, including applications for Machine 1, Machine 2, and Machine 3, and distribute them to Machi ne 1, Machi ne 2, and Machi ne 3 for execution.

[0076] S210: Reference the scenario software package template to obtain a scenario template software package.

[0077] The foundation of a scenario is a software package. The existing software package source code in a reference scenario is used to create a scenario template software package. The reference scenario also consists of three computing devices, each with the same functionality as the corresponding computing device in the target scenario. The software package for each computing device in the reference scenario also contains the same number of nodes as the software package for the corresponding computing device in the target scenario. This allows for the rapid creation of a software package for the target scenario based on the scenario template software package.

[0078] Among them, the command line is executed in Machi ne1 to complete the templating of the reference scene software package and obtain the scene template software package, including three template software t_pkg1, t_pkg2, and t_pkg3, which are used for generating software packages of Machi ne1, Machi ne2, and Machine3 respectively.

[0079] The scenario template software package is obtained by replacing the software package name in the source code and file name of each computing device in the reference scenario with the preset software package template name, and the node name with the preset template node name. When obtaining the software package for the target scenario, the software package template name and node template name in the scenario template software package are replaced with the new software package name and new node name for the target scenario, respectively.

[0080] Figure 3 The software package templating process of a computing device in the reference scenario of this embodiment is shown, including:

[0081] (1) Software package name template: First customize a software package template name, and then set the software package name and package.xml <name>, the package name in CMakeLists.txt, the source code of include / <directory name> / header file.h, the source code of the header file referenced in src / source file.cpp, the package name in src / source file.cpp, the package name in setup.py, and the package name keyword in <directory name> / source file.py are replaced with the package template name.

[0082] (2) Node name templating: Customize a template node name for each node based on the number of existing nodes in the software package of each computing device. Then replace the node name keywords in the node name, binary name, source file name in CMakeLists.txt, node name in src / <source file name>.cpp, src / source file.cpp, node name and source file name in setup.py, and node name in directory name / source file.py with the template node name.

[0083] Among them, when implemented through scripts, the package.xml <name>As the keyword of the software package name to be templated, use the node name in setup.py and the node name in CMakeLists.txt as the keyword of the node name to be templated.

[0084] S220: Template the reference scenario to obtain the scenario template.

[0085] Among them, template the development options template of each computing device in the reference scenario to obtain the scenario template, which is convenient for creating the target scenario. Before scenario templating, place all the source codes of the software packages required in the reference scenario under an empty workspace for subsequent operations.

[0086] Among them, at the root directory of the workspace of Machine1, execute the command line to complete the templating of the reference scenario and obtain the scenario template. The template software of the computing devices of Machine1, Machine2, and Machine3 are three template software packages t_pkg1, t_pkg2, and t_pkg3 respectively.

[0087] Figure 4 Shows the scenario templating process of the reference scenario in this embodiment, including: extracting the template software package, compilation configuration, deployment configuration, and startup configuration of each computer device in the reference scenario to obtain the development options of each computing device and writing them into the scenario template. <X

[0088] Among them, use a json file to describe the development options of a computing device in the scenario template, including:

[0089] "t_pkg":"<software package template name>"; [[ID=X0000200]] [[ID=X0000201]]

[0090] "image":"<compilation container>", (compilation method); [[ID=X0000204]] [[ID=X0000205]]

[0091] "host":"<deployment IP>", (host address option); [[ID=X0000208]] [[ID=X0000209]]

[0092] "launch":"<launch file>", (launch file name option). [[ID=X0000212]] [[ID=X0000213]]

[0093] Among them, when templating the scenario, first obtain the <software package template name> of each computing device, and then generate the scenario template, which is represented by a json file. [[ID=X0000216]] [[ID=X0000217]]

[0094] Among them, when generating the json file of the scenario template, fill in image: if the software package is compiled locally, image can be empty; otherwise, add the compilation container image name. Fill in host: if running locally, do not fill in or fill in 127.0.0.1; otherwise fill in the target machine IP. Fill in launch: fill in the relative path of the launch.py file; if not filled in, it can be generated.

[0095] For example, the development options for the first computing device in the scenario template are:

[0096] "t_pkg":"t_pkg1", / / software package template name;

[0097] "image":"", / / local compilation;

[0098] "host":"", / / local deployment;

[0099] "launch":"", / / Automatically generated.

[0100] The development options for the second computing device in the scenario template are:

[0101] "t_pkg":"n_pkg2", / / software package template name;

[0102] "image":"Machine2_dev:latest", / / Container compilation;

[0103] "host":"192.168.1.22", / / remote deployment;

[0104] "launch":"", / / Automatically generated.

[0105] The development options for the first and third computing devices in the scenario template are:

[0106] "t_pkg":"t_pkg3, / / software package template name;

[0107] "image":"Machine3_dev:latest", / / Container compilation;

[0108] "host":"192.168.1.33, / / remote deployment;

[0109] "launch":"", / / Automatically generated.

[0110] S230: Generate a software package for the target scenario, and configure the target scenario based on the scenario template.

[0111] Among them, create a new scene for the target scene based on the existing <template scene>.json. In the root directory of the workspace of Machine1, execute the command line to generate the target scene json file, including the development options of Machine1, Machine and Machine3, as well as the node name in the software package of each computing device. The image, host and launch items can all be modified; and create a new workspace for the target scene in Machine1, and put the target scene json file in the root directory of the workspace.

[0112] For example, the development options for Machine1 are:

[0113] "pkg":"n_pkg1", / / software package name;

[0114] "nodes":["n_node11", "n_node12"], / / node name;

[0115] "image":"", / / local compilation;

[0116] "host":"", / / local deployment;

[0117] "launch":"", / / Automatically generated.

[0118] The development options for Machine2 are:

[0119] "pkg":"n_pkg2", / / software package name;

[0120] "nodes":["n_node21"], / / node name;

[0121] "image":"Machine2_dev:latest", / / Container compilation;

[0122] "host":"192.168.1.22", / / remote deployment;

[0123] "launch":"", / / Automatically generated.

[0124] The development options for Machine3 are:

[0125] "pkg":["n_pkg3", / / software package name;

[0126] "nodes":["n_node31", "n_node32"], / / node name;

[0127] "image":"Machine3_dev:latest", / / Container compilation;

[0128] "host":"192.168.1.33", / / remote deployment;

[0129] "launch":"", / / Automatically generated.

[0130] This step creates a new package based on the package template in the target scenario's JSON file. This involves copying the template package to the workspace's src directory and replacing the package template name and template node name. The required "new package name" and "new node name" can be passed into the function instead of being written in the JSON file.

[0131] S240: Compile the software package of the target scenario according to the development options of the target scenario.

[0132] Among them, for each computing device in the target scene, there are two cases according to the image compilation method in its development options.

[0133] If Machine1, Machine2, and Machine3 are in the same operating system environment, you can compile the entire workspace using colcon build .

[0134] If Machine1, Machine2, and Machine3 have different operating systems, and the ROS2 compilation environment does not exist for Machine2 and Machine3, you need to create Docker container images with the same operating environment for Machine2 and Machine3 and install the ROS2 compilation environment. Compile the software package in the container.

[0135] In the workspace root directory of Machine 1, execute the command line to compile the software package of the target scenario. In this embodiment, Machine 1 is compiled locally, and Machine 2 and Machine 3 are compiled in the container, compiling a total of three software packages.

[0136] S250: Generate a launch file according to the launch file name option in the development options of the target scene.

[0137] If a target computing device doesn't have a launch file in its launch file name options, a new launch.py ​​file can be created based on the package name and node name. If additional runtime parameters are required, these can also be passed in by writing a function. Once generated, the corresponding launch configuration is also updated. If a target computing device has a launch file in its launch file name options, that launch file is used directly. The launch file name option can also include a relative directory.

[0138] In this embodiment, the development items of Machine1, Machine2, and Machi ne3 do not include a launch file name. On the Machi ne1 operating command line, a launch file is created for Machine1, Machine2, and Machi ne3 respectively according to the software package name, node name, and the input operating parameters.

[0139] S260: Deploy the software package for each computing device according to the host address option in the development option of the target scenario.

[0140] If the host option of a computing device in the target scenario includes an address other than 127.0.0.1, the software package of the computing device is remotely deployed to a fixed directory of the computing device. If the host option of a computing device in the target scenario is empty or 127.0.0.1, the software package of the computing device is locally deployed to a fixed directory of the computing device.

[0141] Among them, on the command line of Machine1, the install directory and launch file under the workspace of Machine2 are distributed to the specified directory of Machi ne2 through ssh, and the install directory and launch file under the workspace of Machi ne3 are distributed to the specified directory of Machi ne3 through ssh.

[0142] S270: Start the software package of each computing device in the target scenario to start each node in the software.

[0143] Machine 1 runs the launch file for Machi ne1, launching the n_pkg1 package and starting two nodes in n_pkg1. Machi ne1 remotely connects to Machi ne2 in the target scenario, runs the launch file for Machi ne2, and starts the n_pkg2 package, starting one node in n_pkg2. Machine 1 remotely connects to Machi ne3 in the target scenario, runs the launch file for Machi ne3, and starts the n_pkg3 package, starting two nodes in n_pkg3.

[0144] In summary, a second embodiment of a program development method uses an existing robot scene as a reference scene, extracts a scene template software package and a scene template, generates a target scene based on the scene template during development, creates a software package for the target scene based on the scene template software package, and realizes the rapid creation, compilation, deployment and startup of a robot application on a computing device.

[0145] The following combination Figure 6 The following describes a first embodiment of a program development device according to the present application.

[0146] A program development apparatus embodiment 1 is deployed on a computing device and is used to develop robot applications using the ROS framework and execute the method described in embodiment 1 of a program development method with all its advantages.

[0147] Figure 6 The structure of a first embodiment of a program development device is shown, including: a template generation module 610 , a scenario generation module 620 and a software development module 630 .

[0148] The template generation module 610 is used to template the software package name and the running node name in the software package of each computing device in the reference scenario to obtain a scenario template software package. Its working principle and advantages can be referred to step S110 of the first embodiment of the program development method.

[0149] Scenario generation module 620 is used to obtain the software package for each computing device in the target scenario based on the scenario template software package, configure development options for each computing device, and create a ROS-based workspace for the target scenario. For its operating principles and advantages, please refer to step S120 of the first embodiment of a program development method.

[0150] The software development module 630 is used to call the ROS framework compilation component in the created workspace to compile the software package for each computing device based on the development options of each computing device in the target scenario. Its working principle and advantages are described in step S130 of the first embodiment of the program development method.

[0151] The following combination Figure 7 A second embodiment of a program development device of the present application is introduced.

[0152] A second embodiment of a program development apparatus is deployed on a computing device and is used to develop a robot application using a ROS framework, and executes the sending method described in the second embodiment of a program development method, with all its advantages.

[0153] Figure 7 The structure of a second embodiment of a program development device is shown, including: a software template module 710, a scenario template module 720, a scenario generation module 730, a software development module 740, a startup configuration module 750, a target deployment module 760 and a target startup module 770.

[0154] The software template module 710 is used to obtain a scenario template software package by referring to the scenario software package template. For its working principle and advantages, please refer to step S210 of the second embodiment of the program development method.

[0155] The scene template module 720 is used to reference scene templates to obtain scene templates. For its working principle and advantages, please refer to step S220 of the second embodiment of the program development method.

[0156] The scenario generation module 730 is used to generate a software package for a target scenario and configure the target scenario based on a scenario template. For its working principle and advantages, please refer to step S230 of the second embodiment of the program development method.

[0157] The software development module 740 is used to compile the software package of the target scenario according to the development options of the target scenario. For its working principle and advantages, please refer to step S240 of the second embodiment of the program development method.

[0158] The startup configuration module 750 is used to obtain a launch file according to the launch file name option in the development options of the target scenario. For its working principle and advantages, please refer to step S250 of the second embodiment of the program development method.

[0159] The target deployment module 760 is used to deploy the software package of each computing device according to the host address option in the development options of the target scenario. For its working principle and advantages, please refer to step S260 of the second embodiment of the program development method.

[0160] The target startup module 770 is used to start the software package of each computing device in the target scenario to start each node in the software. For its working principle and advantages, please refer to step S270 of the second embodiment of the program development method.

[0161] The present application embodiment also provides a computing device, Figure 8 Detailed introduction.

[0162] The computing device 800 includes a processor 810 , a memory 820 , a communication interface 830 , and a bus 840 .

[0163] It should be understood that the communication interface 830 in the computing device 800 shown in this figure can be used to communicate with other devices.

[0164] The processor 810 may be connected to a memory 820. The memory 820 may be used to store the program code and data. Therefore, the memory 820 may be a storage unit within the processor 810, an external storage unit independent of the processor 810, or a component including both a storage unit within the processor 810 and an external storage unit independent of the processor 810.

[0165] Optionally, computing device 800 may further include a bus 840. Memory 820 and communication interface 830 may be connected to processor 810 via bus 840. Bus 840 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, for example. Bus 840 may be classified as an address bus, a data bus, a control bus, and the like. For ease of illustration, the figure uses only one line, but this does not imply that there is only one bus or only one type of bus.

[0166] It should be understood that in the embodiment of the present application, the processor 810 can adopt a central processing unit (CPU). The processor can also be 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. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. Alternatively, the processor 810 adopts one or more integrated circuits to execute relevant programs to implement the technical solutions provided in the embodiment of the present application.

[0167] The memory 820 may include a read-only memory and a random access memory, and provides instructions and data to the processor 810. A portion of the processor 810 may also include a non-volatile random access memory. For example, the processor 810 may also store information about the device type.

[0168] When the computing device 800 is running, the processor 810 executes the computer-executable instructions in the memory 820 to perform the operating steps of each method embodiment.

[0169] It should be understood that the computing device 800 according to the embodiment of the present application can correspond to the corresponding subject in executing the method according to each embodiment of the present application, and the above-mentioned and other operations and / or functions of each module in the computing device 800 are respectively for implementing the corresponding processes of each method of the present embodiment. For the sake of brevity, they will not be repeated here.

[0170] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0171] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0172] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0173] The units described as separate components may or may not be physically separate, and 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 these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0174] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0175] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0176] An embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, it is used to perform the operating steps of each method embodiment.

[0177] The computer storage medium of the embodiment of the present application can adopt any combination of one or more computer-readable media.Computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium.Computer-readable storage medium can be, for example, but not limited to, a system, device or component of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof.More specific examples (non-exhaustive list) of computer-readable storage medium include, an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, a device or a device or used in combination with it.

[0178] A computer-readable signal medium may include a data signal transmitted in baseband or as part of a carrier wave, which carries computer-readable program code. Such a transmitted data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, transfer, or convey a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0179] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0180] The computer program code for performing the operation of the present application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., using an Internet service provider to connect via the Internet).

[0181] Note that the above are only preferred embodiments of the present application and the technical principles employed. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the scope of protection of the present application. Therefore, although the present application has been described in more detail through the above embodiments, the present application is not limited to the above embodiments and may include many other equivalent embodiments without departing from the scope of protection of the present application, all of which fall within the scope of protection of the present application.< / name> < / name>

Claims

1. A program development method, characterized in that: Developing a robotics application on a computing device using a ROS framework, the method comprising: Template the software package name and the running node name in the software package of each computing device in the reference scenario to obtain a scenario template software package; wherein the software package of the reference scenario is a software package developed based on the ROS framework, and the scenario template software includes the template software package of each computing device in the reference scenario; Obtaining a software package and development options for each computing device in the target scenario based on the scenario template software package, and creating a workspace based on the ROS framework for the target scenario, wherein the development options for each computing device include the software package and compilation method of the computing device; The compilation component of the ROS framework is called in the workspace to compile the software package of the computing device according to the development option of each computing device in the target scenario.

2. The method according to claim 1, characterized in that The compilation methods include local compilation and container compilation; When the compilation mode of a target computing device in the target scenario is container compilation, an operating system environment of the computing device is constructed for the workspace based on the container, and a compilation component of the ROS framework is called in the environment to compile the software package of the computing device.

3. The method according to claim 1, characterized in that For each computing device in the reference scenario, obtain a template software package for the computing device, specifically including: Define a software package template name for the computing device, and replace the software package name in the source code and file name of the computing device software package with the software package template name; A template node name is defined for each node of the software package of the computing device, and the node names in the source code and file names of the software package of the computing device are replaced with the template node name.

4. The method according to claim 3, characterized in that For each computing device in the target scenario, obtaining the software package of the computing device in the target scenario includes: Replacing the software package template name in the source code and file name of the template software package of the computing device with the software package name of the computing device; Each template node name in the source code and file name of the computing device software package is replaced with the corresponding node name in the computing device.

5. The method according to claim 1, characterized in that: Also includes: Template the reference scenario to obtain development options for each computing device in the reference scenario; The development options of each computing device in the target scenario are configured using the template scenario as a template, and a node in the software package of the computing device is added to the development options of each computing device in the target scenario.

6. The method according to claim 1, characterized in that The development options for each computing device include one of the following: a Launch file name option for the computing device, a host address option for the computing device; When a Launch file name option of a computing device in the target scene includes a Launch file, the method further includes: after compiling a software package of the computing device in the target scene, creating a Launch file for the computing device in the workspace according to the software package name and node name of the computing device; When the host address option of a computing device in the target scenario includes a host address, the method further includes: when deploying the software package of the computing device in the target scenario, sending the launch file of the computing device in the workspace and the files of the computing device in the install directory to the computing device according to the host address.

7. The method according to claim 1, characterized in that: The method is executed on a computing device in the target scene through a command line in the ROS framework.

8. A program development device, characterized in that: Deployed on a computing device for developing robot applications using the ROS framework, the device includes: A template generation module is used to template the software package name and the running node name in the software package of each computing device in the reference scenario to obtain a scenario template software package, wherein the software package of the reference scenario is a software package developed based on the ROS framework, and the scenario template software includes the template software package of each computing device in the reference scenario; A scenario generation module is configured to obtain a software package for each computing device in a target scenario based on the scenario template software package, create a workspace based on the ROS framework for the target scenario, and configure development options for each computing device, wherein the development options for each computing device include the software package and compilation method for the computing device; The software development module is used to compile a software package of each computing device for calling a compilation component of the ROS framework in the workspace according to the development options of the computing device in the target scenario.

9. A computing device, characterized in that include: bus; a communication interface connected to the bus; at least one processor connected to the bus; and at least one memory connected to the bus and storing program instructions, wherein when the program instructions are executed by the at least one processor, the at least one processor executes the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that Program instructions are stored thereon, and when the program instructions are executed by a computer, the computer is caused to execute the method according to any one of claims 1 to 7.