CN115857911A - Real-time simulation method and device for robot software architecture based on ROS code meta-information - Google Patents

Real-time simulation method and device for robot software architecture based on ROS code meta-information Download PDF

Info

Publication number
CN115857911A
CN115857911A CN202111125757.XA CN202111125757A CN115857911A CN 115857911 A CN115857911 A CN 115857911A CN 202111125757 A CN202111125757 A CN 202111125757A CN 115857911 A CN115857911 A CN 115857911A
Authority
CN
China
Prior art keywords
node
information
ros
robot software
software architecture
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111125757.XA
Other languages
Chinese (zh)
Inventor
郭耀
臧振宇
蔡奕丰
张子祺
王远鹏
陈向群
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Peking University
Original Assignee
Peking University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Peking University filed Critical Peking University
Priority to CN202111125757.XA priority Critical patent/CN115857911A/en
Publication of CN115857911A publication Critical patent/CN115857911A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a robot software architecture real-time simulation method and device based on ROS code meta-information, comprising the following steps: acquiring at least one Roslaunch configuration file from robot software, and analyzing node information, wherein the node information comprises: a node name; finding out an executable file corresponding to the node name from the file system, and generating a static robot software architecture; starting the node according to the configuration file; running an ROS application program according to the parameters and the node information in the configuration file to generate an ROS calculation graph; extracting calculation graph level meta-information from the ROS calculation graph, wherein the calculation graph level meta-information comprises services and topics; generating the contact among the nodes, the service and the topic, and generating a dynamic robot software architecture; and simulating the robot software architecture by combining the static robot software architecture and the dynamic robot software architecture. The invention can obtain more complete ROS code meta-information, thereby greatly improving the simulation effect of the robot software architecture, reducing the burden of developers and reducing the development period.

Description

Real-time simulation method and device for robot software architecture based on ROS code meta-information
Technical Field
The invention provides a real-time simulation method of a robot software architecture, and particularly relates to a real-time simulation method of a robot software architecture based on ROS code meta-information.
Background
The robot has wide application coverage and complex scene, the development of the robot is often influenced by a specific generation environment, and a software architecture needs to be modified in a targeted manner aiming at a field environment. However, due to the cost limitation, a robot application developer cannot test the robot application developed by the developer in all environments, and therefore it is very important to simulate a robot software architecture through software.
Meanwhile, the specifications and application scenarios of the robot are very wide and are constantly changed, so that it is not easy to write general software for the robot. Meanwhile, different robots have completely different hardware, so that it is very difficult to improve the code reuse rate of robot software. In addition, the robot software must include all levels from underlying drivers, logical abstractions to concrete applications, which far exceed the development capabilities of a single developer.
Therefore, the robotics researchers have designed many frameworks to manage robot software, and have born many robot software systems for academic research and industry. The problems in the field of robotics are very broad, a single solution cannot cope with all the problems, and each frame is designed to achieve a specific purpose.
ROS (ROS) is also one of these frameworks. ROS was originally a swashplate (switchyard) project built by stanford artificial intelligence laboratories to support stanford intelligent robot STAIR, designed to solve the problem of developing large-scale service robot applications. The resulting frame is versatile in other robotic applications. It provides a series of libraries and tools to help software developers create robotic applications. It provides a number of functions including hardware abstraction, device drivers, function libraries, visualization tools, message passing, and software package management. The ROS follows the BSD open source licensing protocol. Its open source license and active community make it widely adopted in many robotic fields.
The ROS is a set of architecture specially designed for robot software development. It is an open source meta-level operating system (post-os) that provides os-like services including hardware abstraction description, underlying driver management, shared function execution, inter-program messaging, program distribution package management, and it also provides tools and libraries for acquiring, building, writing, and executing multi-machine converged programs.
More meta-information of the ROS code needs to be acquired to simulate the robot software architecture. The meta-information for a typical ROS application can be divided into two levels, a file system level and a computational graph level. At present, the existing open source code library of the robot only provides information obtained after static analysis is carried out on an ROS package, but the flexible framework of the ROS causes that the calculation chart level information of the ROS program cannot be obtained by using the static analysis.
The calculated map level information of the ROS is less readily available than the file system level information. This information is typically generated dynamically by the ROS program based on the runtime environment and parameters. Without running nodes, to obtain their meta-information, only documents can be consulted or the source code can be directly viewed. However, this method of referring to static files has high requirements for developers, is time-consuming and error-prone, and requires developers to be familiar with their own code and third-party code.
Disclosure of Invention
The invention aims to provide a robot software architecture real-time simulation method based on ROS code meta-information, which is used for simulating a robot software architecture in real time.
The technical scheme of the invention is as follows: a robot software architecture real-time simulation method based on ROS code meta-information comprises the following steps:
acquiring at least one Roslaunch configuration file from robot software, and analyzing node information, wherein the node information comprises: a node name;
finding out an executable file corresponding to the node name from the file system, and generating a static robot software architecture;
starting a node according to the configuration file;
running an ROS application program according to the parameters and the node information in the configuration file to generate an ROS calculation graph;
extracting calculation graph level meta-information from the ROS calculation graph, wherein the calculation graph level meta-information comprises services and topics;
generating the contact among the nodes, the service and the topic, and generating a dynamic robot software architecture;
and simulating a robot software architecture by combining the static robot software architecture and the dynamic robot software architecture.
The method for acquiring at least one Roslaunch configuration file from robot software and analyzing the node architecture comprises the following steps:
and if a plurality of Roslaunch configuration files are read, analyzing the node information in sequence, combining the same node names and ignoring repeated nodes.
The node information further includes node characteristics, including: the topic type published by the node, the topic type subscribed by the node and the service type provided by the node.
The starting the node according to the configuration file comprises the following steps:
traversing the node information acquired from the configuration file, and judging whether the ROS main node is started;
if not, the main node is started first, and then other nodes are started in sequence.
The generating of the association among the nodes, the services and the topics, the generating of the dynamic robot software architecture, comprises:
based on the traversed node information and the corresponding topics and services registered in the ROS main node, the relation between the nodes and the topics and the services is generated, the characteristics of the nodes are generated, and the dynamic robot software architecture is simulated in real time.
The invention also provides a robot software architecture real-time simulation device based on ROS code meta-information, which comprises:
the ROS meta-information extractor module is used for acquiring at least one Roslaunch configuration file from robot software and analyzing node information, and the node information comprises: node name and node characteristics; finding an executable file corresponding to the node name from a file system;
the robot software architecture simulator module is used for reading the information extracted by the ROS meta-information extractor module and starting a node according to the configuration file; running an ROS application program according to the parameters and the node information in the configuration file to generate an ROS calculation graph; extracting calculation graph level meta-information from the ROS calculation graph, wherein the calculation graph level meta-information comprises services and topics; and generating the relation among the nodes, the services and the topics, and simulating a robot software architecture.
The ROS meta-information extractor module is further to: and if a plurality of Roslaunch configuration files are read, analyzing the node information in sequence, combining the same node names and ignoring repeated nodes.
The robot software architecture simulator module is further to:
traversing the node information acquired from the configuration file, and judging whether the ROS main node is started or not;
if not, the main node is started first, and then other nodes are started in sequence.
The robot software architecture simulator module is further to:
based on the traversed node information and the corresponding topics and services registered in the ROS main node, the relation between the nodes and the topics and the services is generated, the characteristics of the nodes are generated, and the dynamic robot software architecture is simulated in real time.
The technical scheme of the invention has the advantages that:
by combining the file system level information obtained by static analysis and the calculation chart level information obtained by dynamic analysis, more complete ROS code meta-information can be obtained, so that the simulation effect of the robot software architecture is improved to a great extent, the burden of a developer is reduced, and the development period is shortened.
Drawings
FIG. 1 is a robot software architecture real-time simulation architecture of the present invention.
Detailed Description
The robot software architecture consists of a static architecture and a dynamic architecture. The static architecture can be obtained by traditional static architecture methods, with the ROS application consisting of a number of nodes that communicate in a point-to-point fashion with the ROS master node acting as a name server and a parameter database. This network design, referred to as the ROS computation graph, can be reconfigured at runtime. Nodes can start up and join or leave the network at any time without disrupting or affecting the functionality of the entire network. Enabling such highly dynamic modification mechanisms on running applications can greatly increase development speed and improve fault tolerance of the system. But at the same time, ROS nodes are implicitly connected by topics or services, which results in dynamically generated topics and services being difficult to obtain through static analysis.
On the other hand, a complete ROS program usually contains multiple nodes. To facilitate starting and configuring multiple nodes at once, the ROS is accompanied by a tool Roslaunch. The configuration file of roslaunch uses XML format for describing all or part of the content of the ROS application. This configuration mainly includes the necessary nodes and their namespace (namespace) hierarchy, configuration, startup parameters and distribution over available hosts. During execution, the roslaunch starts each node according to the configuration without a specific order.
This configuration format can be viewed as the basic architectural description language of the ROS application, since it models the composition and configuration of components in the application, as well as the structural elements of namespaces and hosts. However, this profile is incomplete: it does not explicitly model the communication channel. The primary communication forms in both the services and topics, are not described in a declarative manner, but are created dynamically by the nodes at runtime.
The real-time simulation method of the robot software architecture provided by the invention comprises the steps of firstly obtaining file system-level information through static analysis, and on the basis, extracting missing theme and service information through dynamically analyzing an ROS (reactive oxygen species) calculation chart during running, and further carrying out real-time simulation on the robot software architecture by combining the static analysis and the dynamic analysis. Practice shows that when the life cycle of the node follows a general structure and topics and services do not depend on the operating environment or sensor data, a good result can be obtained, and the calculation graph-level information obtained through simulation is basically consistent with the information in actual production. When the above condition is not satisfied, satisfactory effects can also be obtained by executing roslaunch to simulate the running environment to the maximum extent.
The robot software architecture real-time simulation tool is divided into two modules, namely an ROS meta-information extractor and a robot software architecture simulator.
The ROS meta-information extractor module is developed based on the roslaunch, and on one hand, a roslaunch configuration file and file system level meta-information are obtained from a file system of the ROS package through static analysis; and on the other hand, the ROS application program is operated according to the parameters and the structural information in the configuration file, an ROS calculation graph is generated, and calculation graph-level meta-information including services and topics is extracted from the ROS calculation graph through dynamic analysis. And transmitting the acquired ROS meta-information to the robot software architecture simulator in real time on the basis.
The robot software architecture simulator module reads the ROS meta-information generated by the ROS meta-information extractor, so that the relation between the nodes and topics and services is generated, and the robot software architecture is simulated in real time and comprises a static architecture and a dynamic architecture.
As shown in fig. 1, the embodiment of the present invention is as follows:
ROS meta information extractor module
The ROS meta-information extractor reads the Roslaunch configuration file at first, analyzes the node architecture, finds the executable file corresponding to the node from the file system, and starts the nodes according to the Roslaunch configuration file. In this process, if the ROS master node has not already started, it will start the ROS master node first, and then start the other nodes in turn.
If a plurality of Roslaunch configuration files are read, the ROS meta-information extractor analyzes sequentially, merges the same name space, ignores repeated nodes, and then starts the nodes sequentially. And after all the nodes are started, generating an ROS calculation graph, and extracting calculation graph-level meta-information from the ROS calculation graph through dynamic analysis, wherein the calculation graph-level meta-information comprises services and topics. And transmitting the obtained ROS meta-information to a robot software architecture simulator in real time on the basis.
2. Robot software architecture simulator module
The robot software architecture simulator module reads the ROS meta-information generated by the ROS meta-information extractor, so that the relation between the nodes and topics and services is generated, and the robot software architecture is simulated in real time and comprises a static architecture and a dynamic architecture. In the static architecture, nodes obtained from the configuration information are traversed; in the dynamic architecture, a software architecture simulator is communicated with the ROS main node, and based on traversed node information and corresponding topics and services registered in the ROS main node, the contact among the nodes, the topics and the services is generated, the characteristics of the nodes are generated, and then the robot software architecture is simulated in real time.
The node characteristics include three items: the topic type published by the node, the topic type subscribed by the node and the service type provided by the node. All types are selected here, i.e. only one topic of the same type will be kept. The purpose of this is to simplify the model.
And writing a dynamic analysis tool by using Python, and adding a package list file so as to conform to the ROS package specification for distribution in the ROS community. The tool is currently used for assisting the extraction of the computational graph-level information of the robot open source code library, and can also be independently operated for analyzing ROS codes.
The procedure requires the introduction of four ROS-related modules: roslaunch, rospy, rosgraph, rossview.
The Roslaunch module is used for analyzing a Roslaunch configuration file and starting a node according to the configuration file;
the rospy is used for recording the running state and outputting information to a log file;
the rossgraph encapsulates the method for communicating with the ROS master node, thereby obtaining node and topic information;
the rosservice is used to obtain service information.
And in addition, a ServerProxy class is required to be introduced into the xmlrpc. Client module and used for acquiring the relevant information of the process where the node is located. The ROS master node only records the content related to the ROS calculation graph, but does not record process related information such as Pid and the like. Here, the ServerProxy class is used to acquire the process information. This information is not used directly for dynamic analysis, but for debugging.
Program logic is based on design, and the core functions are divided into three functions:
meta_extractor(launchfile)
analyze_graph(launch)
gen_features(nodes,topics,services)
the meta _ extractor (launchfile) accepts the Roslaunch configuration file as a parameter, calls the analyze _ graph (launch) in the middle, and finally returns (nodes, topics, services) triples, and the returned results are the complete name indexes of the nodes, topics and services respectively.
The analyze _ graph (launch) accepts launch as a parameter and contains parsed roslaunch profile information. And finally, returning nodes, topics and services, wherein the returned results are the example lists of the nodes, the topics and the services respectively.
gen _ features (nodes, topics, services) receive the returned result of the ROS meta-information extractor, including static information and dynamic information; and deleting repeated topic types and service types for each node, and returning a feature _ fact which contains node-node characteristic key value pairs.
The invention is further illustrated by the following examples.
Example 1: robot software architecture for real-time simulation according to ROS robot example program
The generated results are shown here by taking the example of talker _ list.launch in the course package rossy _ tunnels provided by the ROS authority.
the computational graph of talker _ list. Launch contains only two nodes, talker. Py publishes information to the topic chat every second, listener py subscribes to the topic chat, and prints the received messages to the screen.
The ROS meta-information extractor reads a roslaunch configuration file talker _ listener.
2. The robot software architecture simulator module generates a static robot software architecture based on the node information acquired through traversal;
3. starting an ROS main node;
4. starting a node in a static software architecture according to parameters in a talker _ listener.
5. The robot software architecture simulator module reads the configuration information generated by the ROS meta-information extractor and acquires the complete names of all the nodes from the configuration information;
6. communicating with the ROS main node, traversing all nodes and corresponding topics and services registered in the ROS main node through the node names acquired from the configuration information;
7. generating a link between the node and the topic and the service, namely a dynamic robot software architecture;
8. and (3) combining the static architecture in the step (2) with the dynamic architecture in the step (7), namely realizing a real-time simulation robot software architecture.

Claims (9)

1. A robot software architecture real-time simulation method based on ROS code meta-information is characterized by comprising the following steps:
acquiring at least one Roslaunch configuration file from robot software, and analyzing node information, wherein the node information comprises: a node name;
finding out an executable file corresponding to the node name from the file system, and generating a static robot software architecture;
starting a node according to the configuration file;
running an ROS application program according to the parameters and the node information in the configuration file to generate an ROS calculation graph;
extracting calculation graph-level meta-information from the ROS calculation graph, wherein the meta-information comprises services and topics;
generating the contact among the nodes, the service and the topic, and generating a dynamic robot software architecture;
and simulating a robot software architecture by combining the static robot software architecture and the dynamic robot software architecture.
2. The method of claim 1, wherein obtaining at least one roslaunch profile from the robot software, parsing node information, comprises:
and if a plurality of Roslaunch configuration files are read, analyzing the node information in sequence, combining the same node names and ignoring repeated nodes.
3. The method of claim 1, wherein the node information further includes node characteristics, the node characteristics including: the topic type published by the node, the topic type subscribed by the node and the service type provided by the node.
4. The method of claim 1, wherein the launching a node according to the configuration file comprises:
traversing the node information acquired from the configuration file, and judging whether the ROS main node is started or not;
if not, the main node is started first, and then other nodes are started in sequence.
5. The method of claim 4, wherein generating the associations between nodes, services, and topics generates a dynamic robot software architecture comprising:
based on the traversed node information and the corresponding topics and services registered in the ROS main node, the relation between the nodes and the topics and services is generated, the characteristics of the nodes are generated, and then the dynamic robot software architecture is simulated in real time.
6. A robot software architecture real-time simulation device based on ROS code meta-information is characterized by comprising:
the ROS meta-information extractor module is used for acquiring at least one Roslaunch configuration file from the robot software and analyzing node information, and the node information comprises: node name and node characteristics; finding an executable file corresponding to the node name from a file system;
the robot software architecture simulator module is used for reading the information extracted by the ROS meta-information extractor module and starting a node according to the configuration file; running an ROS application program according to the parameters and the node information in the configuration file to generate an ROS calculation graph; extracting calculation graph level meta-information from the ROS calculation graph, wherein the calculation graph level meta-information comprises services and topics; generating the contact among the nodes, the service and the topic, and generating a dynamic robot software architecture; and simulating a robot software architecture by combining the static robot software architecture and the dynamic robot software architecture.
7. The apparatus of claim 6, wherein the ROS meta-information extractor module is further to:
and if a plurality of Roslaunch configuration files are read, analyzing the node information in sequence, combining the same node names and ignoring repeated nodes.
8. The apparatus of claim 6, wherein the robot software architecture simulator module is further to:
traversing the node information acquired from the configuration file, and judging whether the ROS main node is started or not;
if not, the main node is started first, and then other nodes are started in sequence.
9. The apparatus of claim 8, wherein the robot software architecture simulator module is further to:
based on the traversed node information and the corresponding topics and services registered in the ROS main node, the contact between the nodes and the topics and services is generated, the characteristics of the nodes are generated, and then the dynamic robot software framework is generated.
CN202111125757.XA 2021-09-24 2021-09-24 Real-time simulation method and device for robot software architecture based on ROS code meta-information Pending CN115857911A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111125757.XA CN115857911A (en) 2021-09-24 2021-09-24 Real-time simulation method and device for robot software architecture based on ROS code meta-information

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111125757.XA CN115857911A (en) 2021-09-24 2021-09-24 Real-time simulation method and device for robot software architecture based on ROS code meta-information

Publications (1)

Publication Number Publication Date
CN115857911A true CN115857911A (en) 2023-03-28

Family

ID=85652681

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111125757.XA Pending CN115857911A (en) 2021-09-24 2021-09-24 Real-time simulation method and device for robot software architecture based on ROS code meta-information

Country Status (1)

Country Link
CN (1) CN115857911A (en)

Similar Documents

Publication Publication Date Title
US9256516B2 (en) Business process execution language program simulation
Borshchev et al. Distributed simulation of hybrid systems with AnyLogic and HLA
CN110008113B (en) Test method and device and electronic equipment
Bertolino et al. Deriving test plans from architectural descriptions
CN113419946A (en) Ice interface test case and test script automatic generation method
CN111930365B (en) Qt-based application program rapid development framework, development method and operation method
Arcaini et al. ASM-based formal design of an adaptivity component for a Cloud system
Haberl et al. Model-level debugging of embedded real-time systems
Kraemer et al. Automated encapsulation of UML activities for incremental development and verification
CN111258707A (en) Distributed simulation method and system based on DDS service encapsulation
Barros et al. Model-checking distributed components: The vercors platform
CN109710513B (en) Engine for automatic test of CBTC (communication based train control) system
Craggs et al. Agedis case studies: Model-based testing in industry
JP2004118842A (en) Method of providing enhanced dynamic system simulation ability outside original modelling environment
CN115857911A (en) Real-time simulation method and device for robot software architecture based on ROS code meta-information
Hine et al. Scalable emulation of enterprise systems
CN112394912B (en) Robot application data dynamic extraction method based on ROS (reactive oxygen species) calculation graph
CN116126710A (en) Vehicle-mounted software simulation method, device, equipment and medium
CN115857889A (en) ROS (reactive oxygen species) calculation graph-based robot communication architecture automatic generation method and device
Liu et al. A Co-Simulation-and-Test Method for CAN Bus System.
Brasse et al. A component architecture for federate development
Andersen et al. Distributed protocol combinators
CN111414632B (en) AST self-synthesis-based embedded program data stream security verification method
Bardaro et al. From models to software through automatic transformations: An AADL to ROS end-to-end toolchain
Wahba et al. A ros-simulink real-time communication bridge using udp with a driver-in-the-loop application

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination