Device interaction method, device, system, and storage medium based on RPC protocol
Through the RPC protocol-based device interaction method, the problems of MQTT protocol in data synchronization and stability are solved, and more efficient communication reliability and system stability are achieved, ensuring the accuracy and real-time nature of patrol tasks.
Patent Information
- Application Number
- CN202411268633.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-09-11
AI Technical Summary
The existing MQTT protocol has data loss and synchronization problems in inter-device communication, resulting in low system stability, especially when processing large amounts of data, which is prone to data backlog and delay, affecting the real-time and reliability of patrol robots.
Using the RPC protocol-based device interaction method, we can ensure that each instruction can respond in a timely manner by responding to instruction information and returning task execution result information, and selecting corresponding interaction mechanisms based on the complexity and execution time of the task to improve communication reliability and stability.
It improves the reliability of command interaction between devices and system stability, avoids data backlog and delay problems, ensures the accuracy and real-timeness of inspection tasks, and enhances the degree of automation and intelligent control capabilities of the overall system.
Smart Images

Figure CN118827735B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure belongs to the field of communication technology, and more specifically, to a device interaction method and apparatus, system, and storage medium based on an RPC protocol. Background Art
[0002] Inspection robots integrate multiple technologies such as sensor technology, automatic control technology, communication technology, and artificial intelligence technology. By carrying various sensors, such as temperature sensors, humidity sensors, gas sensors, cameras, etc., they can collect information about the surrounding environment and equipment. Therefore, inspection robots are widely used in industrial pipeline corridors, power inspections and other fields.
[0003] In the existing inspection robot technology, the communication between the backend and the robot mainly relies on the MQTT protocol. However, the MQTT protocol has some significant defects, which leads to data synchronization problems between the backend and the robot, as shown below:
[0004] Data loss problem: The MQTT protocol uses a publish / subscribe model. Although it is lightweight and efficient, data loss often occurs in actual applications. This is because MQTT is sensitive to the network environment and connection status when transmitting data. Once the network is unstable or the connection is interrupted, the data packet may not be successfully transmitted.
[0005] Data synchronization issues: Due to data loss, data synchronization between the backend system and the inspection robot becomes unreliable. Especially in important inspection tasks, any data loss may lead to inaccurate inspection results, thus affecting the reliability and effectiveness of the entire system.
[0006] Low system stability: When the MQTT protocol processes large amounts of data, the system has poor stability and is prone to data backlogs and delays, which is a serious disadvantage for inspection robot applications with high real-time requirements. Summary of the invention
[0007] The purpose of the present disclosure is to provide a device interaction method and apparatus, system, and storage medium based on the RPC protocol to improve the reliability and stability of device interaction.
[0008] A first aspect of an embodiment of the present disclosure provides a device interaction method based on an RPC protocol, including:
[0009] In response to the first instruction information sent by the second device, first response information is returned, a first task corresponding to the first instruction information is executed, and second response information is returned; the first response information is used to indicate that the first device has received the first instruction information, and the second response information is used to indicate the execution result of the first task; the execution time of the first task corresponding to the first instruction information is greater than the first time;
[0010] In response to the second instruction information sent by the second device, execute the second task corresponding to the second instruction information, and return third response information; the third response information is used to indicate the execution result of the second task; the execution duration of the second task corresponding to the second instruction information is less than or equal to the first duration.
[0011] A second aspect of the embodiments of the present disclosure provides a device interaction apparatus based on the RPC protocol, including:
[0012] a first response module, configured to respond to the first instruction information sent by the second device, return the first response information, execute the first task corresponding to the first instruction information, and return the second response information; the first response information is used to indicate that the first device has received the first instruction information, and the second response information is used to indicate the execution result of the first task; the execution time of the first task corresponding to the first instruction information is greater than the first time;
[0013] The second response module is used to respond to the second instruction information sent by the second device, execute the second task corresponding to the second instruction information, and return a third response information; the third response information is used to indicate the execution result of the second task; the execution duration of the second task corresponding to the second instruction information is less than or equal to the first duration.
[0014] According to a third aspect of an embodiment of the present disclosure, a device interaction system based on the RPC protocol is provided, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the steps of the above-mentioned device interaction method based on the RPC protocol when executing the computer program.
[0015] According to a fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned device interaction method based on the RPC protocol are implemented.
[0016] The beneficial effects of the device interaction method, apparatus, system, and storage medium based on the RPC protocol provided by the embodiments of the present disclosure are:
[0017] In the disclosed embodiment, the first device may be an inspection robot, the second device may be a background server, and the first task corresponding to the first instruction information may be an inspection task, data collection, or other tasks that take a long time to execute. When receiving the first instruction information, the first device may first return a first response message to confirm that the first instruction information has been received, that is, each instruction of the second device can be responded to in a timely manner, thereby improving the reliability of instruction interaction. After that, the first device starts to execute the first task corresponding to the first instruction information, and returns a second response message to the second device after the task is executed.
[0018] The second task corresponding to the second instruction information may be an equipment operation instruction, such as closing a valve, cutting off a switch, etc. The execution time of the equipment operation instruction is usually short and can be completed immediately. Therefore, when the second instruction information is received, the first device may immediately execute the corresponding second task and return a third response information to the second device after the task is completed.
[0019] The disclosed embodiment selects corresponding interaction mechanisms based on the complexity and execution time of different tasks, thereby improving interaction efficiency while ensuring communication reliability and stability. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, 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 only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 A schematic diagram of a flow chart of a device interaction method based on the RPC protocol provided in an embodiment of the present disclosure;
[0022] Figure 2 A schematic diagram of a flow chart of a device interaction method based on the RPC protocol provided in another embodiment of the present disclosure;
[0023] Figure 3 A structural block diagram of a device interaction apparatus based on the RPC protocol provided in an embodiment of the present disclosure;
[0024] Figure 4 A schematic block diagram of a device interaction system based on the RPC protocol provided in one embodiment of the present disclosure. DETAILED DESCRIPTION
[0025] In the following description, specific details such as specific system structures and technologies are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present disclosure. However, it should be clear to those skilled in the art that the present disclosure may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obstructing the description of the present disclosure with unnecessary details.
[0026] In order to make the purpose, technical solutions and advantages of the present disclosure more clear, specific embodiments will be described below in conjunction with the accompanying drawings.
[0027] Please refer to Figure 1-Figure 2 , Figure 1 A schematic diagram of a flow chart of a device interaction method based on the RPC protocol provided in an embodiment of the present disclosure, the method is applied to a first device, and includes:
[0028] S101: In response to the first instruction information sent by the second device, return the first response information, execute the first task corresponding to the first instruction information, and return the second response information; the first response information is used to indicate that the first device has received the first instruction information, and the second response information is used to indicate the execution result of the first task; the execution duration of the first task corresponding to the first instruction information is greater than the first duration.
[0029] In this embodiment, the first device may be an inspection robot, and the second device may be a background server. The first device and the second device communicate based on the RPC protocol. The RPC protocol utilizes the multiplexing and binary frames of HTTP / 2 to make communication more efficient and faster. At the same time, the RPC protocol does not require message middleware, which greatly reduces the cost of service maintenance.
[0030] The first task corresponding to the first instruction information may be a task with a long execution time (greater than the first time length), such as an inspection task or data collection task. The first instruction information may include task type, task start time, and task parameters, etc. The task type refers to the specific type of work that the first device needs to perform. For example, the task type may be an environmental data collection task (such as temperature, humidity, noise level, etc.), or an equipment status inspection task (such as checking the operating status of power equipment, finding potential signs of failure, etc.). The task start time specifies the time to start executing the first task. Task parameters are specific data or conditions required to perform the task. Task parameters may include parameters such as inspection area and inspection target. Each first instruction information may be accompanied by a unique request code for easy tracking and confirmation. For example, the request code may be "TASK_REQ_001".
[0031] When receiving the first instruction information, the first device can first return the first response information to confirm that the first instruction information has been received, that is, each instruction of the second device can get a timely response, which improves the reliability of instruction interaction. After that, the first device starts to execute the first task corresponding to the first instruction information, and after the task is completed, it generates a second response information based on the execution result, and returns the second response information to the second device. Among them, the execution result includes the execution status and the corresponding result data. Taking the first instruction information as an inspection task as an example, the execution status may include execution completion or execution incomplete. When the execution status is execution completion, the result data may include various types of data obtained during the inspection process (such as temperature, humidity, pressure, current, etc.), photos or videos, etc. When the execution status is execution incomplete, the execution result may include exception code and exception reason.
[0032] S102: In response to the second instruction information sent by the second device, execute the second task corresponding to the second instruction information, and return third response information; the third response information is used to indicate the execution result of the second task; the execution duration of the second task corresponding to the second instruction information is less than or equal to the first duration.
[0033] In this embodiment, the second task corresponding to the second instruction information may be a device operation instruction, such as closing a valve, cutting off a switch, etc. The execution time of the device operation instruction is usually short and can be completed immediately. Therefore, when the second instruction information is received, the first device may immediately execute the corresponding second task, and after the task is executed, generate a third response information based on the execution result, and return the third response information to the second device. Taking the device operation instruction as an example, the execution result may include execution success or execution failure. If the execution fails, the execution result may also include an exception code and an exception reason.
[0034] It can be concluded from the above that this embodiment selects corresponding interaction mechanisms based on the complexity and execution time of different tasks, thereby improving interaction efficiency while ensuring communication reliability and stability.
[0035] In an embodiment of the present disclosure, the second device is provided with a log table, and the first response information is used to indicate the instruction status of the second device updating the first instruction information in the log table.
[0036] In this embodiment, a log table is provided in the second device to record the data transmission status of each communication, including successful and failed requests. In this way, even if a problem occurs during the data transmission process, the system can backtrack and retransmit through the log table to ensure the integrity and consistency of the data.
[0037] It can be concluded from the above that the setting of the log table in this embodiment enables the system to maintain high efficiency and stability when processing large amounts of data, avoiding data backlog and delay problems that may occur under the MQTT protocol. On this basis, the first device can complete the inspection task more accurately and in real time, improving the automation and intelligent control capabilities of the overall system.
[0038] In an embodiment of the present disclosure, the first instruction information includes a specified completion time, and the specified completion time is used to indicate the latest sending time of the second response information.
[0039] In this embodiment, the first device executes the first task according to the first instruction information, and sends the task execution result (i.e., the second response information) after completion. The first instruction information includes a specified completion time. If the second device does not receive the second response information within the specified completion time, it is determined that there may be a problem with the task execution, and the abnormal situation is recorded in the log table, and the abnormal handling process is triggered, such as re-sending the instruction, reallocating the task, etc.
[0040] During the execution of a task, if the robot detects that it cannot complete the task, it can also immediately report the exception code and reason. For example, the robot's mobile mechanism may fail, causing the robot to be unable to reach the designated inspection location and complete the inspection task. The robot can detect the failure of each mechanical component by monitoring the motion state, current, voltage and other parameters of each mechanical component in the mobile mechanism. If a mechanical component moves abnormally, the current is too large or the voltage is unstable, it can be determined that the mechanical component has failed and report the exception code and reason. The background server displays the task execution exception information on the front-end interface and updates the log table record.
[0041] Maintenance personnel can investigate and handle the abnormal information in the log table to ensure the smooth completion of the first task.
[0042] From the above, it can be concluded that, in this embodiment, by setting a specified completion time, the second device can quickly detect the task timeout. This timely feedback mechanism can greatly improve the response speed and reliability of the system, ensuring that quick action can be taken when problems arise, thereby reducing potential losses and risks.
[0043] In an embodiment of the present disclosure, the first instruction information includes a first priority of a first task, and executing the first task corresponding to the first instruction information includes:
[0044] The first task is executed in an order determined by a first priority; the first priority is determined based on a set second priority and an environmental parameter corresponding to the first task.
[0045] In this embodiment, executing the first tasks in the order determined by the first priority can ensure that the most important and urgent tasks are processed first when resources are limited.
[0046] Among them, the set second priority provides a basic reference value for determining the priority of the first task, and the second priority can be pre-set according to the importance of the task during the system design phase. For example, a higher second priority is set for key inspection areas, and a lower second priority is set for other areas. On this basis, considering that the environmental parameters corresponding to the first task will affect the urgency of the first task, for example, area A is a non-critical area and its second priority is lower, but if an inspection robot detects an abnormally high temperature in area A when passing through the area, this may indicate a potential equipment failure or safety risk. Therefore, the priority of the first task corresponding to area A needs to be increased.
[0047] Specifically, the inspection robot of this embodiment is used for the inspection of underground pipe corridors. The process of determining the first priority based on the set second priority and the environmental parameters corresponding to the first task can be described in detail as follows:
[0048] In response to the environmental parameter belonging to the first category of environmental parameters, and the change rate of the first category of environmental parameters is less than or equal to the first change threshold, the set second priority is determined as the first priority of the first task; in response to the environmental parameter belonging to the first category of environmental parameters, and the change rate of the first category of environmental parameters is greater than the first change threshold, the first priority of the first task is increased from the second priority to the third priority, and the third priority is higher than the second priority. The change rate of the first category of environmental parameters is the change amount of the detection value of the first category of environmental parameters relative to the first reference value.
[0049] In response to the environmental parameter belonging to the second type of environmental parameter and the change rate of the second type of environmental parameter being less than or equal to the second change threshold, the set second priority is determined as the first priority of the first task; in response to the environmental parameter belonging to the second type of environmental parameter and the change rate of the second type of environmental parameter being greater than the second change threshold, the first priority of the first task is increased from the second priority to the third priority, and the third priority is higher than the second priority. The change rate of the second type of environmental parameter is the change amount of the detection value of the second type of environmental parameter relative to the second reference value. Among them, the first change threshold is greater than the second change threshold.
[0050] In this embodiment, the first type of environmental parameter may be a parameter whose change speed is less than or equal to a set speed value, such as temperature, humidity and other parameters. The detection value of the first type of environmental parameter is a real-time detection value of temperature and humidity. The first reference value is the maximum limit of temperature and humidity. When the first type of environmental parameter exceeds the corresponding first reference value, it can be determined that the first type of environmental parameter is abnormal. The change rate of the first type of environmental parameter is used to characterize the degree to which the first type of environmental parameter exceeds the first reference value. The calculation process is: first, calculate the first difference of the first type of environmental parameter exceeding the first reference value, then calculate the first ratio of the first difference to the first reference value, and determine the first ratio as the change rate of the first type of environmental parameter.
[0051] Considering that the increase in temperature and humidity may cause equipment failure, but the development process is usually relatively slow, therefore, when the change in temperature and humidity is small, the impact of abnormal temperature and humidity on the first priority can be ignored; when the change in temperature and humidity exceeds the first change threshold, the impact of abnormal temperature and humidity on the first priority needs to be considered. For example, the first task is to inspect area A. If the humidity in area A exceeds the first reference value but is not particularly serious (the change is less than the first change threshold), the first priority of the first task does not need to be adjusted. If the change in humidity in area A is greater than the first change threshold, the first priority of the first task needs to be increased from the second priority to the third priority, and the first task needs to be executed as soon as possible to inspect area A.
[0052] The second type of environmental parameter can be a parameter whose change speed is greater than the set speed value, such as harmful gas concentration, water accumulation and other parameters. The second reference value is the maximum limit of harmful gas concentration and water accumulation. When the second type of environmental parameter exceeds the corresponding second reference value, the second type of environmental parameter can be determined to be abnormal. The change rate of the second type of environmental parameter is used to characterize the degree to which the second type of environmental parameter exceeds the second reference value. The calculation process is: first calculate the second difference between the second type of parameter and the second reference value, then calculate the second ratio of the second difference to the second reference value, and determine the second ratio as the change rate of the second type of environmental parameter. Still taking the first task of inspecting area A as an example, considering that the abnormal concentration of harmful gases and water accumulation in the corridor are both very serious problems, once it is found that there is an abnormality in the second type of environmental parameter in area A (the change rate of the second type of environmental parameter is greater than the second change threshold), the priority of the first task should be immediately increased, and area A should be inspected as soon as possible.
[0053] It can be concluded from the above that this embodiment sets different change thresholds for different environmental parameters, and then determines the first priority of the first task, and keeps the original inspection order unchanged as much as possible on the basis of ensuring the inspection reliability.
[0054] In an embodiment of the present disclosure, on the basis of determining the first priority based on the set second priority and the environmental parameters corresponding to the first task, the first priority may also be adjusted based on the change rate of the ground environmental parameters. The specific process may include:
[0055] In response to the environmental parameter belonging to the first type of environmental parameter and the change rate of the first type of environmental parameter being less than or equal to the first change threshold, determining the set second priority as the first priority of the first task;
[0056] In response to the first priority of the first task being the second priority, the change rate of the ground environment parameter being greater than the third change threshold, and the change rate of the ground environment parameter remaining constant within T1, the first priority of the first task is increased from the second priority to the third priority. The third change threshold is obtained based on the first change threshold and the attribute data of the underground pipe gallery. T1 is a preset constant, which can be set by those skilled in the art according to actual needs.
[0057] In this embodiment, the ground environment parameter is the ground environment parameter of the area where the underground pipe gallery is located, such as the ground temperature, etc. Considering that the underground environment has a certain thermal stability when the seasons change, the change of the ground temperature needs a period of time to more obviously affect the underground pipe gallery, resulting in a relatively slow change rate of the pipe gallery environment temperature. Accordingly, the change of the environmental parameter corresponding to the first task (that is, the pipe gallery environment parameter) can be predicted by detecting the change of the ground environment parameter. Taking the first task of inspecting area A as an example, when it is detected that the change rate of the ground environment parameter is greater than the third threshold value, and the change rate of the ground environment parameter remains constant within the T1 time (the fluctuation amplitude is less than the preset amplitude), it indicates that it has just changed from spring to summer, and it can be predicted that the temperature parameter corresponding to the first task is about to rise. Therefore, the first priority of the first task can be raised from the second priority to the third priority in advance, and the area A can be inspected in time to avoid abnormal equipment in area A caused by temperature increase.
[0058] The third change threshold can be obtained by subtracting the temperature difference between the ground temperature and the tunnel ambient temperature from the first change threshold. The temperature difference between the ground temperature and the tunnel ambient temperature can be obtained through the attribute parameters of the underground tunnel, which include the ground temperature fluctuation value, tunnel depth and tunnel ventilation volume. The tunnel ambient temperature can be calculated using the following formula:
[0059]
[0060] in, Indicates the temperature difference between the ground temperature and the ambient temperature of the tunnel. Indicates the ground temperature fluctuation value, Indicates the depth of the underground pipe gallery. Indicates the ventilation volume of the pipe gallery. and are preset adjustment coefficients. and is the preset power term, , , , It can be obtained by fitting based on the measured data; represents the third change threshold, represents the first change threshold, Indicates the maximum value of the pipe gallery ambient temperature.
[0061] The above formula shows that: the greater the ground temperature fluctuation value, the more drastic the change in the ground thermal environment, and the greater the temperature difference between the ground temperature and the ambient temperature of the corridor; as the depth of the corridor increases, the influence of the ground temperature fluctuation value on the temperature difference changes exponentially; the size of the ventilation volume will affect the heat exchange and air flow in the corridor, thereby affecting the ambient temperature of the corridor. At the same time, the degree of influence of the ventilation volume on the temperature difference is different at different corridor depths.
[0062] It can be concluded from the above that this embodiment adjusts the first priority based on the change rate of the ground environmental parameters to avoid delays in the change of the ambient temperature corresponding to the first task, which may cause the first task to fail to be executed in time.
[0063] In one embodiment of the present disclosure, the first task is multiple, and the device interaction method based on the RPC protocol further includes:
[0064] In response to the remaining battery power of the first device being less than a first threshold, a first alarm message is sent to the second device; the first alarm message is used to instruct the second device to determine a target location based on the location information of the first device; in response to the target location sent by the second device, the second device moves to the target location for charging.
[0065] In response to the remaining battery power of the first device being between a first threshold and a second threshold, a second alarm message is sent to the second device; the second alarm message is used to instruct the second device to determine a target task based on the first priority of each first task and the power consumption corresponding to each first task; in response to the target task sent by the second device, the target task is executed.
[0066] In this embodiment, the first device is usually powered by a battery, and a battery power monitoring module is provided inside the first device to monitor the remaining power of the battery. When the remaining power of the battery of the first device is too low (less than a preset first threshold), the first device can send a first alarm message to the second device. After receiving the first alarm message, the second device determines that the first device needs to be charged immediately. At this time, the second device can determine a nearest charging station as a target location based on the location information of the first device. The second device sends the target location to the first device, and the first device moves to the target location for charging, so as to avoid the first device from shutting down due to insufficient power.
[0067] When the remaining battery power of the first device is between the first threshold and the second threshold, the first device can send a second alarm message to the second device. After receiving the second alarm message, the second device determines that the remaining power of the first device can only sustain its work for a short time, but the first device may have multiple first tasks that have not been completed. At this time, the second device can adjust the task plan of the first device based on the first priority of each first task and the power consumption corresponding to each first task, that is, evaluate which first tasks the first device can still perform, and send these first tasks as target tasks (that is, the adjusted task plan) to the first device. The first device performs the target tasks according to the adjusted task plan, and other first tasks can be performed by other first devices. After the first device completes the target task, the remaining power at this time is less than the first threshold. The first device can send a first alarm message to the second device. After receiving the first alarm message, the second device determines that the first device needs to be charged immediately. At this time, the second device can determine a nearest charging station as the target location based on the location information of the first device. The second device sends the target location to the first device, and the first device moves to the target location for charging to avoid the first device from shutting down due to insufficient power.
[0068] It can be concluded from the above that this embodiment adjusts the task plan of the first device in combination with the task requirements of the first device and the remaining power of the first device, and maximizes the use of the remaining battery power while ensuring the reliability of the inspection.
[0069] In an embodiment of the present disclosure, the calculation process of the power consumption corresponding to each first task includes:
[0070] The power consumption reference value corresponding to each first task is adjusted based on the road condition information, temperature information and dust concentration corresponding to each first task to obtain the power consumption corresponding to each first task.
[0071] In this embodiment, the power consumption reference value corresponding to each first task is a preset constant, and the power consumption reference value corresponding to each first task can be calculated based on the expected execution time, data processing volume and data processing complexity of each first task. Specifically, the following calculation formula can be used:
[0072]
[0073] in, represents the reference value of power consumption corresponding to the i-th first task, represents the average power consumption of the first device, represents the estimated execution time of the first task, Indicates the data processing amount corresponding to the first task, Indicates the reference value of data processing volume, represents the data processing complexity coefficient corresponding to the first task, , and All are consistent with the preset adjustment coefficients, is a preset constant, and those skilled in the art can design it according to actual needs The specific value of .
[0074] in, It is used to characterize the data processing complexity corresponding to the first task. For relatively simple tasks, such as ambient temperature collection, the corresponding data processing complexity coefficient Set to a smaller first value (such as 1). For inspection tasks in non-critical areas, which may involve image acquisition and processing and require complex calculations, the corresponding data processing complexity coefficient can be Set to a larger second value (for example, 1.2). For inspection tasks in key areas, it is usually necessary to conduct detailed inspections and analyses of multiple devices. The task execution time will be longer. The corresponding data processing complexity coefficient can be Set to a second, larger value (e.g. 1.5).
[0075] Consider that the road condition information corresponding to the first task will affect the difficulty of movement and power consumption of the first device. For example, in areas with complex terrain such as slopes, curves, narrow passages, etc., the first device requires more energy to overcome these obstacles, resulting in increased power consumption. At the same time, the ambient temperature has an impact on the battery performance of the first device. In a high temperature environment, the internal resistance of the battery will increase, resulting in faster power consumption. In a low temperature environment, the activity of the battery will decrease, the output power will decrease, and more power may be required to maintain the normal operation of the first device. In addition, areas with large dust will also affect the performance of the electronic equipment of the first device and increase the power consumption of the device.
[0076] Therefore, on the basis of obtaining the power consumption reference value, this embodiment adjusts the power consumption reference value corresponding to each first task based on the road condition information, temperature information and dust concentration corresponding to each first task to obtain the power consumption corresponding to each first task. Specifically, the following calculation formula can be used:
[0077]
[0078] in, represents the power consumption corresponding to the i-th first task, Indicates the complexity of the road conditions corresponding to the first task, represents the ambient temperature corresponding to the first task, Indicates the minimum value of the pipe gallery ambient temperature. Indicates the maximum value of the ambient temperature of the pipe gallery. Indicates dust concentration, It is a preset constant, indicating the reference value of dust concentration.
[0079] From the above, it can be concluded that this embodiment calculates the power consumption reference value corresponding to each first task based on the estimated execution time, data processing volume and data processing complexity of each first task, and adjusts the power consumption reference value corresponding to each first task based on the road condition information, temperature information and dust concentration corresponding to each first task, so that the calculation of the power consumption corresponding to each first task is more in line with actual work needs.
[0080] In an embodiment of the present disclosure, a specific process of determining a target task based on the first priority of each first task and the power consumption corresponding to each first task includes:
[0081] The plurality of first tasks are sorted according to the first priority level, and the power consumption corresponding to each first task is calculated in sequence.
[0082] Perform multiple screening operations until the set conditions are met; the screening operations include:
[0083] If the power consumption corresponding to the i-th first task is less than the remaining battery power of the first device, the i-th first task is determined as the target task, and the remaining battery power of the first device is updated based on the power consumption corresponding to the i-th first task; wherein, i is a natural number, and when i=1, the i-th first task is the first task with the highest first priority.
[0084] The setting condition is: the remaining battery power of the first device is less than a first threshold.
[0085] In this embodiment, a specific implementation method for determining a target task based on the first priority of each first task and the power consumption corresponding to each first task is provided. The target task can be obtained by multiple screenings. In the first screening operation, the first first task is the first task with the highest first priority. If the power consumption of the first first task is less than the remaining battery power of the first device, the first first task is determined as the target task, and at the same time, the remaining battery power of the first device is subtracted from the power consumption of the first task to obtain the remaining battery power of the first device; in the second screening operation, the second first task is the first task with the first priority being 2, and if the power consumption of the second first task is greater than the remaining battery power of the first device, the second screening operation is stopped; in the third screening operation, the third first task is the first task with the first priority being 3, and if the power consumption of the third first task is less than the remaining battery power of the first device, the third first task is determined as the target task, and at the same time, the remaining battery power of the first device is subtracted from the power consumption of the first task to obtain the remaining battery power of the first device; and so on, until the remaining battery power of the first device is less than the first threshold. The multiple target tasks obtained from the multiple screening operations are determined as the tasks to be performed next by the first device.
[0086] It can be concluded from the above that this embodiment obtains the target task through multiple screening operations, so that the first device can make the best decision under limited battery power, ensure that high-priority tasks are executed, and maximize the working time of the robot.
[0087] Corresponding to the device interaction method based on the RPC protocol in the above embodiment, Figure 3 This is a structural block diagram of a device interaction apparatus based on the RPC protocol provided by an embodiment of the present disclosure. For ease of explanation, only the parts related to the embodiment of the present disclosure are shown. Figure 3 The device interaction apparatus 20 based on the RPC protocol includes: a first response module 21 and a second response module 22.
[0088] The first response module 21 is used to respond to the first instruction information sent by the second device, return the first response information, execute the first task corresponding to the first instruction information, and return the second response information; the first response information is used to indicate that the first device has received the first instruction information, and the second response information is used to indicate the execution result of the first task; the execution time of the first task corresponding to the first instruction information is greater than the first time;
[0089] The second response module 22 is used to respond to the second instruction information sent by the second device, execute the second task corresponding to the second instruction information, and return the third response information; the third response information is used to indicate the execution result of the second task; the execution time of the second task corresponding to the second instruction information is less than or equal to the first time.
[0090] In an embodiment of the present disclosure, the second device is provided with a log table, and the first response information is used to indicate the instruction status of the second device updating the first instruction information in the log table.
[0091] In an embodiment of the present disclosure, the first instruction information includes a specified completion time, and the specified completion time is used to indicate the latest sending time of the second response information.
[0092] In one embodiment of the present disclosure, the first response module 21 is specifically used to:
[0093] The first task is executed in an order determined by a first priority; the first priority is determined based on a set second priority and an environmental parameter corresponding to the first task.
[0094] In one embodiment of the present disclosure, the first response module 21 is specifically used to:
[0095] In response to the remaining battery power of the first device being less than a first threshold, a first alarm message is sent to the second device; the first alarm message is used to instruct the second device to determine a target location based on the location information of the first device; in response to the target location sent by the second device, the second device moves to the target location for charging.
[0096] In response to the remaining battery power of the first device being between a first threshold and a second threshold, a second alarm message is sent to the second device; the second alarm message is used to instruct the second device to determine a target task based on the first priority of each first task and the power consumption corresponding to each first task; in response to the target task sent by the second device, the target task is executed.
[0097] In one embodiment of the present disclosure, the first response module 21 is specifically used to:
[0098] The power consumption reference value corresponding to each first task is adjusted based on the road condition information, temperature information and dust concentration corresponding to each first task to obtain the power consumption corresponding to each first task.
[0099] In one embodiment of the present disclosure, the first response module 21 is specifically used to:
[0100] The plurality of first tasks are sorted according to the first priority level, and the power consumption corresponding to each first task is calculated in sequence.
[0101] Perform multiple screening operations until the set conditions are met; the screening operations include:
[0102] If the power consumption corresponding to the i-th first task is less than the remaining battery power of the first device, the i-th first task is determined as the target task, and the remaining battery power of the first device is updated based on the power consumption corresponding to the i-th first task; wherein, i is a natural number, and when i=1, the i-th first task is the first task with the highest first priority.
[0103] The setting condition is: the remaining battery power of the first device is less than a first threshold.
[0104] See also Figure 4 , Figure 4 A schematic block diagram of a device interaction system based on the RPC protocol provided by an embodiment of the present disclosure. Figure 4 The device interaction system 300 based on the RPC protocol in the embodiment shown may include: one or more processors 301, one or more input devices 302, one or more output devices 303 and one or more memories 304. The processors 301, input devices 302, output devices 303 and memories 304 communicate with each other via a communication bus 305. The memory 304 is used to store computer programs, which include program instructions. The processor 301 is used to execute the program instructions stored in the memory 304. The processor 301 is configured to call the program instructions to execute the functions of each module / unit in the above-mentioned device embodiments, such as Figure 3 The functions of modules 21 to 22 are shown.
[0105] It should be understood that in the embodiment of the present disclosure, the processor 301 may be a central processing unit (CPU), and the processor may 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. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0106] The input device 302 may include a touch panel, a fingerprint collection sensor (for collecting the user's fingerprint information and fingerprint direction information), a microphone, etc., and the output device 303 may include a display (LCD, etc.), a speaker, etc.
[0107] The memory 304 may include a read-only memory and a random access memory, and provide instructions and data to the processor 301. A portion of the memory 304 may also include a non-volatile random access memory. For example, the memory 304 may also store information about the device type.
[0108] In a specific implementation, the processor 301, input device 302, and output device 303 described in the embodiments of the present disclosure can execute the implementation methods described in the first and second embodiments of the device interaction method based on the RPC protocol provided in the embodiments of the present disclosure, and can also execute the implementation methods of the device interaction system based on the RPC protocol described in the embodiments of the present disclosure, which will not be repeated here.
[0109] In another embodiment of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by the processor, all or part of the processes in the above-mentioned embodiment method are implemented, and the computer program can also be completed by instructing the relevant hardware through the computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, the steps of each of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0110] The computer-readable storage medium may be an internal storage unit of the device interaction system based on the RPC protocol in any of the aforementioned embodiments, such as a hard disk or memory of the device interaction system based on the RPC protocol. The computer-readable storage medium may also be an external storage device of the device interaction system based on the RPC protocol, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the device interaction system based on the RPC protocol. Furthermore, the computer-readable storage medium may also include both an internal storage unit of the device interaction system based on the RPC protocol and an external storage device. The computer-readable storage medium is used to store computer programs and other programs and data required by the device interaction system based on the RPC protocol. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0111] Those of ordinary skill 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, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. 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 to be beyond the scope of this disclosure.
[0112] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device interaction system and unit based on the RPC protocol described above can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.
[0113] In the several embodiments provided in the present application, it should be understood that the disclosed device interaction system and method based on the RPC protocol can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces or units, or it can be an electrical, mechanical or other form of connection.
[0114] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present disclosure.
[0115] In addition, each functional unit in each embodiment of the present disclosure 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. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0116] The above are only specific embodiments of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present disclosure, and these modifications or replacements should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A device interaction method based on the RPC protocol, applied to a first device, characterized in that: include: In response to the first instruction information sent by the second device, returning first response information, executing the first task corresponding to the first instruction information, and returning second response information; The first response information is used to indicate that the first device has received the first instruction information, and the second response information is used to indicate the execution result of the first task; the execution duration of the first task corresponding to the first instruction information is greater than the first duration; In response to the second instruction information sent by the second device, execute the second task corresponding to the second instruction information, and return third response information; The third response information is used to indicate the execution result of the second task; the execution duration of the second task corresponding to the second instruction information is less than or equal to the first duration; The first instruction information includes a specified completion time, and the specified completion time is used to indicate the latest sending time of the second response information; The first instruction information includes a first priority of a first task, and executing the first task corresponding to the first instruction information includes: executing the first tasks in an order determined by the first priority; the first priority being determined based on a set second priority and an environmental parameter corresponding to the first tasks; The process of determining the first priority based on the set second priority and the environmental parameters corresponding to the first task is: In response to the environmental parameter belonging to the first category of environmental parameters, and the change rate of the first category of environmental parameters is less than or equal to the first change threshold, the set second priority is determined as the first priority of the first task; in response to the environmental parameter belonging to the first category of environmental parameters, and the change rate of the first category of environmental parameters is greater than the first change threshold, the first priority of the first task is increased from the second priority to the third priority, and the third priority is higher than the second priority; the change rate of the first category of environmental parameters is the change amount of the detection value of the first category of environmental parameters relative to the first reference value; In response to the environmental parameter belonging to the second type of environmental parameter, and the change rate of the second type of environmental parameter is less than or equal to the second change threshold, the set second priority is determined as the first priority of the first task; in response to the environmental parameter belonging to the second type of environmental parameter, and the change rate of the second type of environmental parameter is greater than the second change threshold, the first priority of the first task is increased from the second priority to the third priority, and the third priority is higher than the second priority; the change rate of the second type of environmental parameter is the change amount of the detection value of the second type of environmental parameter relative to the second reference value; wherein the first change threshold is greater than the second change threshold; On the basis of determining the first priority based on the set second priority and the environmental parameters corresponding to the first task, the first priority is further adjusted based on the change rate of the ground environmental parameters. The specific process includes: In response to the environmental parameter belonging to the first type of environmental parameter and the change rate of the first type of environmental parameter being less than or equal to the first change threshold, determining the set second priority as the first priority of the first task; In response to the first priority of the first task being the second priority, the change rate of the ground environment parameter being greater than the third change threshold, and the change rate of the ground environment parameter being constant within T1, the first priority of the first task is increased from the second priority to the third priority; wherein the third change threshold is obtained based on the first change threshold and the attribute data of the underground pipe gallery; wherein T1 is a preset constant, which is set by those skilled in the art according to actual needs; The third change threshold is obtained by subtracting the temperature difference between the ground temperature and the ambient temperature of the tunnel from the first change threshold; the temperature difference between the ground temperature and the ambient temperature of the tunnel is obtained through the attribute parameters of the underground tunnel, and the attribute parameters of the underground tunnel include the ground temperature fluctuation value, the tunnel depth and the tunnel ventilation volume; the ambient temperature of the tunnel is calculated using the following formula: in, Indicates the temperature difference between the ground temperature and the ambient temperature of the tunnel. Indicates the ground temperature fluctuation value, Indicates the depth of the underground pipe gallery. Indicates the ventilation volume of the pipe gallery. and are preset adjustment coefficients. and is the preset power term, , , , It is obtained by fitting based on the measured data; represents the third change threshold, represents the first change threshold, Indicates the maximum value of the pipe gallery ambient temperature.
2. The device interaction method based on the RPC protocol according to claim 1, characterized in that: The second device is provided with a log table, and the first response information is used to instruct the second device to update the instruction status of the first instruction information in the log table.
3. The device interaction method based on the RPC protocol according to claim 1, characterized in that: The first task is multiple, and the device interaction method based on the RPC protocol also includes: In response to the remaining battery power of the first device being less than a first threshold, sending a first alarm message to the second device; the first alarm message is used to instruct the second device to determine a target location based on the location information of the first device; and in response to the target location sent by the second device, move to the target location for charging; In response to the remaining battery power of the first device being between the first threshold and the second threshold, sending a second alarm message to the second device; the second alarm message is used to instruct the second device to determine a target task based on the first priority of each first task and the power consumption corresponding to each first task; in response to the target task sent by the second device, execute the target task.
4. The device interaction method based on the RPC protocol as claimed in claim 3, characterized in that: The calculation process of the power consumption corresponding to each first task includes: The power consumption reference value corresponding to each first task is adjusted based on the road condition information, temperature information and dust concentration corresponding to each first task to obtain the power consumption corresponding to each first task.
5. The device interaction method based on the RPC protocol as claimed in claim 3, characterized in that: The specific process of determining the target task based on the first priority of each first task and the power consumption corresponding to each first task includes: sorting the plurality of first tasks according to the first priority level, and calculating the power consumption corresponding to each first task in turn; Perform multiple screening operations until the set conditions are met; the screening operations include: If the power consumption corresponding to the i-th first task is less than the remaining battery power of the first device, determine the i-th first task as the target task, and update the remaining battery power of the first device based on the power consumption corresponding to the i-th first task; wherein i is a natural number, and when i=1, the i-th first task is the first task with the highest first priority; The setting condition is: the remaining battery power of the first device is less than a first threshold.
6. A device interaction apparatus based on RPC protocol, applied to a first device, characterized in that: include: A first response module, configured to respond to the first instruction information sent by the second device, return first response information, execute the first task corresponding to the first instruction information, and return second response information; The first response information is used to indicate that the first device has received the first instruction information, and the second response information is used to indicate the execution result of the first task; the execution duration of the first task corresponding to the first instruction information is greater than the first duration; A second response module, configured to respond to the second instruction information sent by the second device, execute the second task corresponding to the second instruction information, and return third response information; The third response information is used to indicate the execution result of the second task; the execution duration of the second task corresponding to the second instruction information is less than or equal to the first duration; The first instruction information includes a specified completion time, and the specified completion time is used to indicate the latest sending time of the second response information; The first instruction information includes a first priority of a first task, and executing the first task corresponding to the first instruction information includes: executing the first tasks in an order determined by the first priority; the first priority being determined based on a set second priority and an environmental parameter corresponding to the first tasks; The process of determining the first priority based on the set second priority and the environmental parameters corresponding to the first task is: In response to the environmental parameter belonging to the first category of environmental parameters, and the change rate of the first category of environmental parameters is less than or equal to the first change threshold, the set second priority is determined as the first priority of the first task; in response to the environmental parameter belonging to the first category of environmental parameters, and the change rate of the first category of environmental parameters is greater than the first change threshold, the first priority of the first task is increased from the second priority to the third priority, and the third priority is higher than the second priority; the change rate of the first category of environmental parameters is the change amount of the detection value of the first category of environmental parameters relative to the first reference value; In response to the environmental parameter belonging to the second type of environmental parameter, and the change rate of the second type of environmental parameter is less than or equal to the second change threshold, the set second priority is determined as the first priority of the first task; in response to the environmental parameter belonging to the second type of environmental parameter, and the change rate of the second type of environmental parameter is greater than the second change threshold, the first priority of the first task is increased from the second priority to the third priority, and the third priority is higher than the second priority; the change rate of the second type of environmental parameter is the change amount of the detection value of the second type of environmental parameter relative to the second reference value; wherein the first change threshold is greater than the second change threshold; On the basis of determining the first priority based on the set second priority and the environmental parameters corresponding to the first task, the first priority is further adjusted based on the change rate of the ground environmental parameters. The specific process includes: In response to the environmental parameter belonging to the first type of environmental parameter and the change rate of the first type of environmental parameter being less than or equal to the first change threshold, determining the set second priority as the first priority of the first task; In response to the first priority of the first task being the second priority, the change rate of the ground environment parameter being greater than the third change threshold, and the change rate of the ground environment parameter being constant within T1, the first priority of the first task is increased from the second priority to the third priority; wherein the third change threshold is obtained based on the first change threshold and the attribute data of the underground pipe gallery; wherein T1 is a preset constant, which is set by those skilled in the art according to actual needs; The third change threshold is obtained by subtracting the temperature difference between the ground temperature and the ambient temperature of the tunnel from the first change threshold; the temperature difference between the ground temperature and the ambient temperature of the tunnel is obtained through the attribute parameters of the underground tunnel, and the attribute parameters of the underground tunnel include the ground temperature fluctuation value, the tunnel depth and the tunnel ventilation volume; the ambient temperature of the tunnel is calculated using the following formula: in, Indicates the temperature difference between the ground temperature and the ambient temperature of the tunnel. Indicates the ground temperature fluctuation value, Indicates the depth of the underground pipe gallery. Indicates the ventilation volume of the pipe gallery. and are preset adjustment coefficients. and is the preset power term, , , , It is obtained by fitting based on the measured data; represents the third change threshold, represents the first change threshold, Indicates the maximum value of the pipe gallery ambient temperature.
7. A device interaction system based on the RPC protocol, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Intelligent station panoramic data monitoring and analyzing system and method
CN110943870A
Service calling method and device, electronic equipment and storage medium
CN112714180A
Data transmitting and receiving method, data transmitting and receiving device, server and storage medium
CN113556294A
Inspection robot control system and method based on ZMQ communication distributed architecture
CN116000921A
