A method and device for monitoring program internal operation status based on IROS
By encapsulating the message communication function and program state machine of IROS into an API, real-time monitoring of the internal running status of the software is realized, which solves the problem of being unable to monitor the running status of the software in real time in the existing technology and improves the efficiency and security of software management. .
Patent Information
- Application Number
- CN202210057908.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-19
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2042-01-19
AI Technical Summary
The existing technology cannot realize real-time monitoring of the internal operating status of the software, making it difficult for software managers to quickly locate and discover security risks when problems occur during software operation.
By encapsulating the message communication function and program state machine of IROS into a public API, the main program creates and maintains an independent state machine, and publishes the status information to the program's internal status monitoring topic. The monitoring terminal realizes the internal running status of the program by subscribing to this topic. real-time monitoring.
It realizes real-time monitoring of the internal running status of the software, can quickly locate problems and discover security risks, and avoids being informed of problems only when the software exits or results are different.
Smart Images

Figure CN114443428B
Abstract
Description
Technical Field
[0001] The invention discloses a method and a device, and relates to the technical field of distributed program monitoring, in particular to an IROS-based program internal running state monitoring method and a device. Background Art
[0002] With the explosive growth of social data, people have higher and higher requirements for the coordination and cooperation between software, such as distributed deployment, software collaborative data processing, etc. At the same time, with the popularization of autonomous driving and intelligent robots, people have put forward higher requirements for the long-term and high-reliability operation of software.
[0003] In most cases, software managers will only be aware of software problems when the software exits during operation or when there is a large discrepancy between the actual result and the expected result. However, there is currently no perfect method to achieve real-time monitoring of the internal operating status of the software, making it impossible to quickly locate the problem and discover safety hazards in the software operation. Summary of the invention
[0004] In view of the problems of the prior art, the present invention provides a method and device for monitoring the internal running status of a program based on IROS, which encapsulates the message communication function and program state machine of IROS into a public API. The main program creates and maintains an independent state machine by calling the API, and sends the internal running status of the main program to a pre-established program internal status monitoring topic (Program Internal Status Monitor Topic, abbreviated as PISMT). Real-time monitoring of the internal running status of the program is achieved by subscribing to the topic through a monitoring terminal.
[0005] The specific scheme proposed by the present invention is:
[0006] A method for monitoring the internal running status of a program based on IROS, which creates and maintains a program state machine of a device by calling a device API, and reflects the internal running status of the program through the state information of the program state machine.
[0007] The state information of the program state machine is published to the program internal state monitoring topic PISMT through the device API using the distributed IROS communication function.
[0008] The monitoring terminal subscribes to the program internal status monitoring topic PISMT to obtain the program internal running status information and display it.
[0009] Furthermore, the method for monitoring the internal running status of a program based on IROS, creating a program state machine of the device by calling a device API, includes:
[0010] In the program initialization phase, the corresponding interface of the device API is called to create a program state machine, and during the creation process, the program name, the randomly generated program UUID, and the program running device information are passed in.
[0011] Furthermore, the method for monitoring the internal running status of a program based on IROS includes maintaining the program state machine of the device by calling the device API, including:
[0012] The state information of the program state machine is added, deleted and modified through the corresponding interface of the device API.
[0013] Furthermore, the method for monitoring the internal running status of a program based on IROS includes adding the status information of the program state machine through the corresponding interface of the device API, including:
[0014] When the state information of the program state machine cannot meet the need to reflect the program running state, the adding interface of the device API is called to add new state information to the program state machine and save it.
[0015] Furthermore, the method for monitoring the internal running status of a program based on IROS includes: deleting the status information of the program state machine through the corresponding interface of the device API, including:
[0016] When the state information of the program state machine no longer reflects the needs of the program, the deletion interface of the device API is called to delete the state information in the program state machine.
[0017] Furthermore, the method for monitoring the internal running status of a program based on IROS includes modifying the status information of the program state machine through the corresponding interface of the device API, including:
[0018] When the internal running state of the program of the device changes, the state information of the program state machine is changed by calling the modification interface of the device API.
[0019] Furthermore, the method for monitoring the internal running status of a program based on IROS includes maintaining the program state machine of the device by calling the device API, including:
[0020] Start the timer thread and send the program state machine information reflecting the current program internal running status to PISMT according to the preset heartbeat frequency.
[0021] The present invention also provides a program internal running status monitoring device based on IROS, including an interface calling module, an information publishing module and a display module.
[0022] The interface calling module creates and maintains the device's program state machine by calling the device API, and reflects the program's internal running state through the state information of the program state machine.
[0023] The information publishing module publishes the status information of the program state machine to the program internal status monitoring topic PISMT through the device API using the distributed IROS communication function.
[0024] The display module obtains the program internal running status information in the program internal status monitoring topic PISMT and displays it.
[0025] The benefits of the present invention are:
[0026] The present invention provides a method for monitoring the internal running status of a program based on IROS, which encapsulates the message communication function and program state machine of IROS into a device API. The program creates and maintains an independent program state machine by calling the API, and sends the internal running status of the program to a program internal status monitoring topic (Program Internal Status MonitorTopic, PISMT for short). By subscribing to the topic, real-time monitoring of the internal running status of the program is achieved, so that the software manager can be informed of the problem of the software only when the software exits during operation or there is a large error between the actual result and the expected result, and the problem can be quickly located to discover the safety hazards in the software operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] 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 or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0028] Figure 1 It is a schematic diagram of the overall application architecture of the present invention.
[0029] Figure 2 The present invention is a schematic diagram of the monitoring terminal composition.
[0030] Figure 3 It is a state transition diagram of a state machine involved in the present invention.
[0031] Figure 4 It is a flow chart of the method of the present invention sending information to PISMT by calling API.
[0032] Figure 5 It is a schematic diagram of the process of obtaining information from PISMT through the monitoring terminal in the method of the present invention. DETAILED DESCRIPTION
[0033] Intelligent Robot Operating System (IROS) is a secondary operating system that runs on Linux. IROS supports distributed deployment and provides a simple and easy-to-use external interface. By calling the API provided by IROS, you can quickly obtain, transmit and send messages.
[0034] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.
[0035] The present invention provides a method for monitoring the internal running status of a program based on IROS, which creates and maintains a program state machine of a device by calling a device API, and reflects the internal running status of the program through the state information of the program state machine.
[0036] The state information of the program state machine is published to the program internal state monitoring topic PISMT through the device API using the distributed IROS communication function.
[0037] The monitoring terminal subscribes to the program internal status monitoring topic PISMT to obtain the program internal running status information and display it.
[0038] In the method of the present invention, an independent program state machine is created and maintained by calling the device API. The state information of the program state machine is published to PISMT by using the IROS message publishing function in the API. The monitoring terminal obtains the internal running state of the program by subscribing to PISMT and displays it through a visual interface. And because IROS supports distributed deployment, it is only necessary to run the master control node and the message processing node in the monitoring terminal to monitor the internal running state of the program running on each distributed device, thereby realizing centralized monitoring of distributed running programs.
[0039] In specific applications, in some embodiments of the method of the present invention, the message communication function and program state machine of IROS are encapsulated into a public API of the device by taking advantage of the characteristics of simple deployment, high efficiency of real-time communication, and support for distributed deployment. The main program creates and maintains an independent program state machine by calling the API. The program state machine can be understood as a way of organizing code, which can ensure that the object knows its state and the operations to be performed at any time. And each state of the program state machine is an independent code block, separated from other states, so as to facilitate the addition of new states and the maintenance of old states. The public API provides state machine management, such as adding, deleting and modifying states through addState, delState and modifyState. At the same time, the public API pre-defines several common states, including WAITING, ACTIVE, PENDING, THREAD, DONE, EXITING and EXITED. When the program starts, the program state machine state is first set to WAITING. When the program is started, the state machine state is set to ACTIVE or PENDING, indicating that the program enters the task processing or suspended state. When the program uses multiple threads to process tasks, the state is set to THREAD. After the task is processed, the program state machine state is set to DONE. If the program continues to wait for other tasks, the state is changed to WAITING. If the program exits, it is changed to EXITING and EXITED. For reference, Figure 3 .
[0040] Based on the above description, when the internal running status of the program based on IROS is monitored in the embodiment of the present invention, the init interface of the public API is called in the program initialization phase to create the program state machine of the device. During the creation process, the name of the program, the UUID of the randomly generated program, and the program running device information need to be passed in, and the state of the program state machine is initialized to WAITING.
[0041] After the program is initialized, the program state machine is started and the state of the program state machine is set to ACTIVE. At the same time, the timer thread is started, and the current state information of the program state machine is sent to PISMT according to the preset heartbeat frequency. The monitoring terminal subscribes to the topic to realize real-time monitoring of the internal running status of the program.
[0042] Based on the above implementation process, in other embodiments of the method of the present invention, when the internal running status of the program is monitored based on IROS, the status information of the program state machine is added, deleted and modified through the corresponding interface of the device API, as follows:
[0043] When the state information of the program state machine cannot meet the needs of reflecting the program running status, call the addState interface of the device's public API to add new state information to the program state machine. The newly added state can be saved in the local storage device in the form of an XML file. When the program is started again to create a state machine, the state will be automatically loaded into the newly created program state machine.
[0044] When the state information of the program state machine no longer reflects the needs of the program, the delState interface of the device API is called to delete the state information in the program state machine;
[0045] When the internal running state of the device's program changes, the state information of the program state machine is changed by calling the modifyState interface of the device API, and the publish interface in IROS is called through the public API to actively send the internal state information of the program to PISMT. When there are multiple threads in the process, the program state machine needs to be locked. Only when the current state of the program state machine is published to PISMT can other threads continue to obtain the program state machine and modify the state.
[0046] In other embodiments of the present invention, it is specifically described that information is obtained from PISMT and displayed through a monitoring terminal, wherein the monitoring terminal needs to have a visual display device, can run the master control node and message control node of IROS, and has sufficient space to create and save PISMT and its internal messages. In addition, the monitoring terminal can realize communication links through 4G, 5G, WIFI and various program running devices, which can be referred to Figure 2 .
[0047] After the program's internal running status information is actively or periodically sent to PISMT, the terminal monitoring machine obtains the main program's internal running status information from PISMT through the IROS subscribe interface.
[0048] After obtaining the internal running status information of the program through the monitoring terminal, the name and UUID of the main program are extracted, and compared with the program internal running information monitoring table maintained in the monitoring machine. If it exists, the relevant information in the program internal running information monitoring table is updated. If it does not exist, the program information is added to the program internal running information monitoring table and the status information is updated;
[0049] Update the display information on the human-computer interaction interface through the monitoring terminal;
[0050] When the status information of a program in the program internal operation information monitoring table is not updated for more than a threshold time, the monitoring terminal can prompt that the program may be offline.
[0051] At the same time, the present invention also provides a program internal running status monitoring device based on IROS, including an interface calling module, an information publishing module and a display module.
[0052] The interface calling module creates and maintains the device's program state machine by calling the device API, and reflects the program's internal running state through the state information of the program state machine.
[0053] The information publishing module publishes the status information of the program state machine to the program internal status monitoring topic PISMT through the device API using the distributed IROS communication function.
[0054] The display module obtains the program internal running status information in the program internal status monitoring topic PISMT and displays it.
[0055] The information interaction, execution process and other contents between the modules in the above-mentioned device are based on the same concept as the embodiment of the method of the present invention. For the specific contents, please refer to the description in the embodiment of the method of the present invention, and no further description is given here.
[0056] Similarly, the device of the present invention realizes real-time monitoring of the internal running status of the program, avoiding the situation where the software administrator can only be informed of the software problem when the software exits during operation or there is a large error between the actual result and the expected result, and can quickly locate the problem and discover the safety hazards in the software operation.
[0057] It should be noted that not all steps and modules in the above-mentioned processes and device structures are necessary, and some steps or modules can be ignored according to actual needs. The execution order of each step is not fixed and can be adjusted as needed. The system structure described in the above-mentioned embodiments can be a physical structure or a logical structure, that is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or some components in multiple independent devices may be implemented together.
[0058] The above-described embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or changes made by those skilled in the art based on the present invention are within the protection scope of the present invention. The protection scope of the present invention shall be subject to the claims.
Claims
1. A method for monitoring the internal running status of a program based on IROS, characterized in that The program state machine of the device is created by calling the device API, including: calling the corresponding interface of the device API in the program initialization stage to create the program state machine, and passing in the name of the program, the randomly generated UUID of the program and the program running device information during the creation process; IROS is an intelligent robot operating system, which is a secondary operating system and runs on the Linux system. IROS supports distributed deployment and provides an external interface. By calling the API provided by IROS, the acquisition, transmission and distribution of messages are realized. According to the distributed deployment of IROS, the message communication function and program state machine of IROS are encapsulated into the public API of the device. By calling the public API, an independent program state machine is created and maintained. The program state machine is a way of organizing code. The program state machine is used to ensure that the object knows its state and the operations to be performed at any time, and each state of the program state machine is an independent code block, separated from other states, so as to facilitate the addition of new states and the maintenance of old states. Maintaining the program state machine of the device by calling the device API includes: adding, deleting and modifying the state information of the program state machine through the corresponding interface of the device API, The state information of the program state machine is added through the corresponding interface of the device API, including: when the state information of the program state machine cannot meet the need to reflect the program running state, calling the adding interface of the device API to add new state information to the program state machine and save it, The state information of the program state machine is deleted through the corresponding interface of the device API, including: when the state information of the program state machine no longer reflects the needs of the program, calling the deletion interface of the device API to delete the state information in the program state machine, The state information of the program state machine is modified through the corresponding interface of the device API, including: when the internal running state of the program of the device changes, the state information of the program state machine is changed by calling the modification interface of the device API; The state information of the program state machine reflects the internal running state of the program. The state information of the program state machine is published to the program internal state monitoring topic PISMT through the device API using the distributed IROS communication function. The monitoring terminal subscribes to the program internal status monitoring topic PISMT to obtain the program internal running status information and display it.
2. The method for monitoring the internal running status of a program based on IROS according to claim 1, characterized in that Maintaining the program state machine of the device by calling the device API includes: Start the timer thread and send the program state machine information reflecting the current program internal running status to PISMT according to the preset heartbeat frequency.
3. A program internal operation status monitoring device based on IROS, characterized in that It includes interface calling module, information publishing module and display module. IROS is an intelligent robot operating system, which is a secondary operating system and runs on Linux system. IROS supports distributed deployment and provides external interface. By calling the API provided by IROS, the acquisition, transmission and distribution of messages are realized. According to the distributed deployment of IROS, the message communication function and program state machine of IROS are encapsulated into the public API of the device. By calling the public API, an independent program state machine is created and maintained. The program state machine is a way of organizing code. The program state machine is used to ensure that the object knows its state and the operations to be performed at any time. Moreover, each state of the program state machine is an independent code block, separated from other states, so as to facilitate the addition of new states and the maintenance of old states. The interface calling module creates and maintains the program state machine of the device by calling the device API, including: calling the corresponding interface of the device API in the program initialization phase, creating the program state machine, and passing in the program name, the randomly generated program UUID and the program running device information during the creation process; The interface calling module maintains the program state machine of the device by calling the device API, including: adding, deleting and modifying the state information of the program state machine through the corresponding interface of the device API, The interface calling module performs an adding operation on the state information of the program state machine through the corresponding interface of the device API, including: when the state information of the program state machine cannot meet the need to reflect the program running state, calling the adding interface of the device API to add new state information to the program state machine and save it, The interface calling module performs a deletion operation on the state information of the program state machine through the corresponding interface of the device API, including: when the state information of the program state machine no longer reflects the program needs, calling the deletion interface of the device API to delete the state information in the program state machine, The interface calling module performs a modification operation on the state information of the program state machine through the corresponding interface of the device API, including: when the internal running state of the program of the device changes, the state information of the program state machine is changed by calling the modification interface of the device API; The state information of the program state machine reflects the internal running state of the program. The information publishing module publishes the status information of the program state machine to the program internal status monitoring topic PISMT through the device API using the distributed IROS communication function. The display module obtains the program internal running status information in the program internal status monitoring topic PISMT and displays it.
Citation Information
Patent Citations
Method and system for tracking and monitoring computer applications
CN101553769A
Method and apparatus for monitoring the running of program
CN101853205A
Method, system and mobile terminal for monitoring application program
CN101859275A
Method for monitoring software running state
CN101996106A
Method for dynamically tracking program running state and rear panel device
CN102004680A
