A control system for ROS test instruments
The distributed node control system designed through the ROS architecture solves the scalability and access problems of traditional test instrument control systems, and realizes flexible and real-time instrument control and data interaction, which is suitable for large-scale testing and high-demand application scenarios. .
Patent Information
- Application Number
- CN202311003120.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-10
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2043-08-10
AI Technical Summary
Due to the integrated design of traditional test instrument control systems, the scalability and independence of the system are limited, making it difficult to meet the needs of large-scale testing and data processing, and there are difficulties in accessing and integrating test instruments in ROS.
Using ROS architecture design, a flexible and dynamic instrument control ecosystem is built through distributed node design. The control system is divided into control end and interface end. The ROS communication framework is used to realize asynchronous and distributed data transmission and interaction, and supports modular design and System extension.
It realizes flexible and scalable control of test instruments in ROS, improves system performance and response speed, meets high requirements real-time application scenarios, and supports remote control and system expansion.
Smart Images

Figure CN117872825B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of instrument science and technology, and in particular relates to a control system applied to a ROS test instrument. Background Art
[0002] Traditional test instrument control systems often adopt an integrated design. Due to the tight coupling between components, the scalability and independence of the system are limited. At the same time, the tight coupling between the test instrument and the control end increases the complexity of the system and the difficulty of development. In terms of large-scale testing and data processing, the control software under the traditional method is difficult to meet the requirements.
[0003] In recent years, ROS, as an open source robot operating system framework, has become an emerging research direction in the field of test instruments. With its loose coupling, distributed node and message communication characteristics, ROS has brought new ideas and solutions to test instrument control. However, in the current ROS, there are still some challenges in the access and integration of test instruments. Since test instruments usually have different hardware interfaces and communication protocols, it is difficult to directly access the test instrument as a ROS node. In addition, the connection status display, operation instruction transmission and measurement result reading of the test instrument also require special processing. Summary of the invention
[0004] In view of the shortcomings of the integration and use of existing test instruments in ROS, the present invention discloses a test instrument control system applied to ROS. By drawing on the design concept of the ROS architecture, the instrument control system is designed in a distributed node manner, a more flexible and dynamic instrument control ecosystem is constructed, and the intelligent practical application in the field of instrument measurement and control is promoted.
[0005] A test instrument control system applied to ROS, the main architecture of the control system includes:
[0006] (1) Control end: Establish multiple nodes to: ① Receive control instructions from the interface end nodes and parse these instructions into a format recognizable by the test instrument; ② Issue control instructions to the test instrument; ③ Receive instrument measurement data and transmit the data to the interface end nodes through the ROS communication framework;
[0007] (2) Interface side: establish an interactive interface and multiple nodes for: ① human-computer interaction, providing a friendly user interface; ② receiving control commands input by the user and transmitting these commands to the control end node through the ROS communication framework; ③ receiving the measurement data transmitted by the control end; ④ displaying or further processing the measurement data so that the user can monitor and analyze the instrument measurement results in real time;
[0008] (3) Control computer: executes complex algorithms to realize display and control functions; at the same time, as the ROS master and slave, it is responsible for coordinating the communication and data exchange between each node, ensuring the coordination and synchronization between components such as sensors and actuators.
[0009] As a preferred option, the control computer can use Qt 5.9 to complete the development and deployment of the control end and the interface end based on the ROS melodic architecture of the Ubuntu 18.04 system;
[0010] A test instrument control system applied to ROS can be networked and run in parallel on multiple computers to improve the performance and scalability of the system: multiple control-end and interface-end nodes can work simultaneously to collaboratively complete the control and data processing tasks of the test instrument. By utilizing the computing resources and communication capabilities of multiple computers, the system's throughput and response speed can be effectively improved to meet high-demand real-time application scenarios.
[0011] Furthermore, the network integration is achieved by setting the ROS host and slave, and the specific steps are as follows:
[0012] (1) Select the computer running the interface as the host and the computer running the control as the slave, and place the two computers in the same local area network;
[0013] (2) Modify / etc / hosts on the host and slave respectively, adding the IP addresses and host names of both parties;
[0014] (3) Set the slave machine's ROS_HOSTNAME to the slave machine's IP address and ROS_MASTER_URI to the master machine's IP address.
[0015] A test instrument control system applied to ROS can realize data transmission and interaction between nodes on the control end and nodes on the interface end through the ROS publish-subscribe communication framework. It is based on the publisher-subscriber model and supports asynchronous and distributed communication methods. This flexible communication mechanism enables the control end and the interface end to be independently developed and deployed, and can decouple and expand the functions of the system.
[0016] A test instrument control system applied to ROS can be controlled by following the steps below:
[0017] S1. Instrument connection;
[0018] S2. Distributed instructions are issued;
[0019] S3. Distributed data backhaul;
[0020] S4. Close and disconnect.
[0021] Further, the instrument connection described in step S1 refers to the node at the control end realizing the instrument connection and sending the connection status to the node at the interface end; after the node at the interface end receives the connection status, it displays the real-time connection status on the interactive interface; the specific implementation method is:
[0022] S11. Place the control computer running the control end node and the instrument in the same LAN to ensure that they can be pinged;
[0023] S12. Start the interface end and the control end, and then automatically start the interactive interface and each node;
[0024] S13. The control end issues an instrument connection instruction, establishes a publishing node Sta_publisher, and publishes the instrument connection status topic Sta; according to the instrument connection status receipt, Sta_publisher publishes the instrument connection status "1" or "0" at a frequency of 1Hz, and the data format is std_msg::String;
[0025] S14. The interface end establishes a receiving node Sta_subscriber for subscribing to the topic Sta, and displays the instant connection status on the interactive interface.
[0026] Furthermore, the receiving node Sta_subscriber established at the interface end in step S14 and the interactive interface at the interface end belong to two independent threads, so that the subscription of topic data will not cause the blocking of the interactive interface event loop. As a preferred embodiment, a branch thread class can be added, named QSubNode, which inherits from QThread; in addition, since the subscribed data needs to be taken out from the ROS library callback function (CALLBACK), but the callback function is a static function outside the QSubNode class and cannot be directly connected to the interactive interface object, the data must first be sent to the ordinary member function in the branch thread QSubNode through the signal slot, and then sent by the ordinary member function to the slot function of the interactive interface object through the signal slot for real-time display.
[0027] Furthermore, the distributed instruction delivery in step S2 can be implemented as follows:
[0028] S21. The interface end establishes a command publishing node Cmd_publisher, publishes the topic Cmd; the control end establishes a command receiving node Cmd_subscriber, subscribes to the topic Cmd;
[0029] S22. Use the control on the operation interface to trigger the command publishing: Cmd_publisher publishes the command "read data", and the data format is std_msg::String;
[0030] S23. The control end node Cmd_subscriber receives the command "read data", converts it into a command recognizable by the instrument (such as a SCPI command) and sends it down;
[0031] S24. After the command is sent, the instrument only responds once. If continuous measurement is to be achieved, it needs to be sent continuously at a certain frequency.
[0032] Furthermore, the distributed data transmission in step S3 can be implemented as follows:
[0033] S31. The control end establishes a Dat_publisher node and publishes the two-dimensional discrete data measured by the instrument through the topic Dat in the format of geometry_msgs::Point;
[0034] S32. After the Dat_subscriber node on the interface subscribes to the data, it passes the data to the main thread of the interface to complete the display;
[0035] S33. If the Dat_publisher node on the control side publishes data at a certain frequency, the Dat_subscriber node on the interface side needs to set the node callback function monitoring frequency to be consistent when receiving data, that is, ros::Rate loop_rate().
[0036] Furthermore, the instrument disconnection in step S4 means that after the interactive interface is closed, the software needs to complete the following operations:
[0037] S41. The interface end Cmd_publisher node issues the command "disconnect";
[0038] S42. After receiving the command, the control end issues a command to disconnect the instrument;
[0039] S43. Close all nodes on the control end and the interface end.
[0040] The present invention proposes a test instrument control system applied to ROS. Through the transmission mechanism of ROS topics, the interface end can issue corresponding operation instructions, such as starting measurement, setting parameters, etc., and the control end receives these instructions and sends them to the instrument for execution. At the same time, it is also responsible for reading back the measurement results of the instrument and passing the results to the interface end through the ROS topic for real-time display. By adopting the above test instrument control method, we can make the test instrument more flexible and scalable in ROS, and can interact with other ROS nodes for data, which is of great significance for the development and application of test instruments. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0042] Figure 1 is The overall flow chart of the present invention;
[0043] Figure 2 is Architecture diagram of the control system;
[0044] Figure 3 is Node, topic, and data interaction diagram of the spectrum analyzer control system;
[0045] Figure 4 is Node, topic, and data interaction diagram of microwave signal source control system;
[0046] Figure 5 is Node, topic, and data interaction diagram of a digital oscilloscope control system. DETAILED DESCRIPTION
[0047] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It will be appreciated that the specific embodiments described herein are only used to explain the relevant inventions and are not intended to limit the invention. It should also be noted that, for ease of description, only portions related to the relevant inventions are shown in the accompanying drawings. It should be noted that, in the absence of conflict, the embodiments in this application and the features in the embodiments may be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in conjunction with the embodiments. Example 1
[0048] Figure 1 A schematic flow chart of a spectrum analyzer control system applied to ROS provided in Embodiment 1 of the present invention is characterized in that the control system architecture is as follows Figure 2 The architecture diagram shows the main components and relationships of the system, which are divided into layers, including the application layer, the underlying dependency layer, and the hardware layer, among which:
[0049] The application layer includes the interface end and the control end, which are mainly composed of the interactive interface and multiple nodes established by each, and are used for the compilation, management, execution, and interaction between ROS nodes, interfaces, and devices;
[0050] The underlying dependency layer includes the ROS communication framework and the spectrum analyzer control driver, which are used to provide a publish-subscribe communication mechanism to realize data interaction between nodes; and to communicate with the spectrum analyzer to realize the transmission of control instructions.
[0051] The hardware layer includes the control computer and spectrum analyzer. By combining with the underlying dependency layer, it forms a complete system architecture, enabling software and hardware to work together to achieve control and data exchange of the spectrum analyzer.
[0052] Through the above architecture, the control end and the interface end realize the separation and division of functions, so that they can focus on control and user interaction respectively, and realize efficient data transmission through the ROS communication framework; the underlying dependency layer provides the communication and driver support required by the system and interacts with the hardware layer. The design of the entire system makes the system flexible and scalable, convenient for integration with other smart devices, and suitable for application scenarios in the Internet of Things environment.
[0053] Figure 3 Embodiment 1 of the present invention is a spectrum analyzer test instrument control system applied to ROS, and the nodes, topics, and data flow directions in its publish-subscribe communication architecture are specifically:
[0054] The Sta topic is used to publish instrument connection status information. The corresponding nodes are Sta_publisher and Sta_subscriber, and the data format is std_msg::String. The Cmd topic is used to publish control instructions. The corresponding nodes are Cmd_publisher and Cmd_subscriber, and the data format is std_msg::String. The Dat topic is used to publish two-dimensional discrete spectrum data. The corresponding nodes are Dat_publisher and Dat_subscriber, and the data format is geometry_msgs::Point.
[0055] When the program or instruction is executed on a computer, a test instrument control system applied to ROS as described in the claims is implemented. Example 2
[0056] Figure 4 Embodiment 2 of the present invention provides a microwave signal source control system applied to ROS, wherein the nodes, topics, and data flow directions in the publish-subscribe communication architecture include:
[0057] The Sigsta topic is used to publish instrument connection status information, and the corresponding nodes are Sigcmd_publisher and Sigcmd_subscriber; the Sigcmd topic is used to publish control instructions, and the corresponding nodes are Sigsta_subscriber and Sigsta_publisher.
[0058] When the program or instruction is executed on a computer, a test instrument control system applied to ROS as provided in Example 1 is implemented. Example 3
[0059] Figure 5 Embodiment 3 of the present invention provides an oscilloscope control system applied to ROS, wherein the nodes, topics, and data flow directions in the publish-subscribe communication architecture include:
[0060] The DSODat topic is used to publish waveform sampling data, and the corresponding nodes are DSODat_pub and DSODat_sub; the DSOCmd topic is used to publish control instructions, and the corresponding nodes are DSOCmd_sub and DSOCmd_pub; the DSOSta topic is used to publish instrument connection status, and the corresponding nodes are DSOSta_sub and DSOSta_pub. When the program or instruction is run on a computer, a test instrument control system applied to ROS as provided in Example 1 is implemented.
[0061] The beneficial effects of the above three embodiments include:
[0062] (1) Modular design: A modular system design is achieved by separating the nodes on the control side and the interface side. This design makes the system more flexible and allows the control side and the interface side nodes to be developed and updated separately without modifying the entire system.
[0063] (2) Real-time and response speed: The ROS publish-subscribe communication framework is adopted to achieve efficient data interaction. This asynchronous, distributed communication method can provide fast real-time data transmission and processing, thereby improving the real-time and response speed of the system.
[0064] (3) Flexible system expansion: Due to the adoption of the ROS communication framework, the control system supports easy addition of new functional nodes or modification of existing nodes to meet changing needs. This flexibility makes the system easier to expand and adapt to new application scenarios.
[0065] (4) Convenience of remote control: By using the spectrum analyzer control system applied to ROS, control instructions can be sent from the node on the interface end to the spectrum analyzer to realize remote control function. This remote control implementation reduces the need for manual operation and improves the convenience and flexibility of operation.
[0066] In summary, the test instrument control system applied to ROS realizes a more flexible, efficient and scalable test control solution through modular design, real-time data interaction, flexible system expansion and convenient remote control, which is convenient for integration with other smart devices and suitable for application scenarios in the Internet of Things environment.
[0067] The above specifically describes the preferred implementation of the present invention, but the invention is not limited to the described embodiments. Those skilled in the art may make equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications and substitutions are all included in the scope defined by the claims of this application.
Claims
1. A test instrument control system applied to ROS, characterized in that Mainly include: (1) Control end: Establish multiple nodes to: ① Receive control instructions from the interface end node and parse these instructions into a format recognizable by the test instrument; ② Issue control instructions to the test instrument; ③ Receive instrument measurement data and transmit the data to the interface end node through the ROS communication framework; (2) Interface side: establish an interactive interface and multiple nodes for: ① human-computer interaction, providing a friendly user interface; ② receiving control commands input by the user and transmitting these commands to the control end node through the ROS communication framework; ③ receiving the measurement data transmitted by the control end; ④ displaying or further processing the measurement data so that the user can monitor and analyze the instrument measurement results in real time; (3) Control computer: It can execute complex algorithms to realize display and control functions. At the same time, as the ROS host, it is responsible for coordinating the communication and data exchange between various nodes, ensuring the coordination and synchronization between components such as sensors and actuators. The control system is implemented by following the steps below: S1. Instrument connection; S2. Distributed instructions are issued; S3. Distributed data backhaul; S4. Close and disconnect; The distributed instruction issuance in step S2 is implemented as follows: S21. The interface end establishes a command publishing node Cmd_publisher, publishes the topic Cmd; the control end establishes a command receiving node Cmd_subscriber, subscribes to the topic Cmd; S22. The control on the operation interface triggers the publishing command: Cmd_publisher publishes the command "read data", and the data format is std_msg::String; S23. The control end node Cmd_subscriber receives the command "read data", converts it into a command recognizable by the instrument and sends it down; S24. After the command is issued, the instrument only responds once. If continuous measurement is to be achieved, it needs to be issued continuously at a certain frequency. The distributed data transmission in step S3 is implemented as follows: S31. The control end establishes a Dat_publisher node and publishes the two-dimensional discrete data measured by the instrument through the topic Dat in the format of geometry_msgs::Point; S32. After the Dat_subscriber node on the interface subscribes to the data, it passes the data to the interactive interface to complete the display; S33. If the Dat_publisher node on the control end follows a certain frequency If the data is published, the interface end Dat_subscriber needs to set the node callback function monitoring frequency to be consistent when receiving data, that is, .
2. The control system according to claim 1, characterized in that: The control system can be networked and run in parallel on multiple computers.
3. The control system according to claim 1, characterized in that: The instrument connection in step S1 refers to the node at the control end realizing the instrument connection and sending the connection status to the node at the interface end. After the node at the interface end receives the connection status, the real-time connection status is displayed on the interactive interface. The specific implementation method is as follows: S11. Place the control computer running the control end node and the instrument in the same LAN to ensure that they can be pinged; S12. Start the interface end and the control end, and then automatically start the corresponding nodes; S13. The control end issues an instrument connection instruction, establishes a publishing node Sta_publisher, and publishes the instrument connection status topic Sta; according to the instrument connection status receipt, Sta_publisher publishes the instrument connection status "1" or "0" at a frequency of 1Hz, and the data format is std_msg::String; S14. The interface end establishes a receiving node Sta_subscriber for subscribing to the topic Sta, and displays the instant connection status on the interactive interface.
4. The control system according to claim 1, characterized in that: The disconnection in step S4 means that after the interactive interface is closed, the following operations need to be completed: S41. Sta_publisher on the interface side issues the command "disconnect"; S42. After receiving the command, the control terminal sends an instruction for the instrument to recognize and disconnect the instrument; S43. Close all nodes on the control end and the interface end.
