Disclosure of Invention
The invention provides a pilot reelecting method, a pilot reelecting device and a storage medium for unmanned ship formation, which improve the stability of unmanned ship formation when executing tasks.
The embodiment of the invention provides a pilot reelecting method for unmanned ship formation, which comprises the following steps:
performing downtime monitoring on pilot nodes in unmanned ship formation and performing communication failure monitoring on follower nodes;
When the follower node is monitored to be a communication failure node, the node number of the communication failure node is broadcasted to a first follower node so as to invalidate the election information sent by the communication failure node.
Further, the election information sent by the communication failure node is invalidated, specifically:
And after receiving the election information sent by the communication failure node, the first follower node sends the communication failure information to the communication failure node, wherein the first follower node is a follower node with normal communication.
Further, the downtime monitoring is carried out on the pilot, and the method comprises the following steps:
when any follower node in the unmanned ship formation does not receive the pilot information sent by the pilot node within a first preset time, judging that the pilot node is down, wherein the first preset time is the upper limit of the time when the follower node receives the pilot information sent by the pilot node.
Further, after judging that the pilot node is down, a second follower node waits for a second preset time and then sends election information to a third follower node, wherein the second follower node is the follower node which does not receive the pilot information in the first preset time, and the third follower node is the follower node which does not comprise the second follower node;
Comparing the target distance, namely comparing the target distances of the third follower node and the second follower node after the third follower node receives the election information sent by the second follower node, keeping silent when the target distance of the third follower node is more than or equal to the target distance of the second follower node, sending the election information to a fourth follower node when the target distance of the third follower node is less than the target distance of the second follower node, and sending non-election information to the second follower node, wherein the fourth follower node is a follower node which does not send the election information in a fourth preset time;
Setting the third follower node as a second follower node, setting the fourth follower node as a third follower node, and repeatedly executing the step of comparing the target distance to the target distance until any follower node sends election information and then sends election information when the non-election information is not received within the first preset time, and then electing the follower node which does not receive the non-election information within the first preset time as a new pilot node.
Further, the fourth preset time is equal to n times of the first preset time, and n is the total number of nodes formed by the unmanned ship.
Further, the communication failure monitoring is performed on the follower node, specifically:
and when the pilot node does not receive the following information replied by the follower node within a third preset time, judging that the follower node is a communication failure node, wherein the third preset time is 4 times of maximum information transmission delay time.
Further, the first preset time is calculated according to the following formula:
T=t1+3t2;
Wherein t1 is a fixed time interval for the pilot to send pilot information, and t2 is a maximum information transmission delay time.
The invention further provides a pilot reelecting device for unmanned ship formation, which comprises a downtime monitoring module and a reelecting module;
The downtime monitoring module is used for performing downtime monitoring on pilot nodes in unmanned ship formation and performing communication failure monitoring on follower nodes;
The re-election module is used for electing a follower node with the shortest target distance as a new pilot node when the pilot node is down, and broadcasting the node number of the communication failure node to a first follower node when the follower node is monitored to be the communication failure node so as to invalidate the election information sent by the communication failure node.
Another embodiment of the present invention provides a readable storage medium, where the readable storage medium includes a stored computer program, and when the computer program is executed, controls a device where the readable storage medium is located to execute the pilot reselection method for unmanned ship formation according to any one of the method embodiments of the present invention.
The embodiment of the invention has the following beneficial effects:
the invention provides a pilot re-election method, a device and a storage medium for unmanned ship formation, wherein the method monitors downtime of pilot nodes in unmanned ship formation and monitors communication failure of follower nodes, when the downtime of the pilot nodes is monitored, the follower node with the shortest target distance is elected to serve as a new pilot node, and when the communication failure node of the follower node is monitored, the node number of the communication failure node is broadcasted to a first follower node, so that election information sent by the communication failure node is invalid. Therefore, the invention monitors the downtime of the pilot node, guides the re-election process of the pilot node by using the downtime monitoring result, realizes the timely discovery of the downtime of the pilot node and the timely election of the new pilot node, and improves the stability and safety of unmanned ship formation when executing tasks.
Detailed Description
The following description of the embodiments of the present invention will be made more apparent and fully hereinafter with reference to the accompanying drawings, in which some, but not all embodiments of the invention are shown. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
As shown in fig. 1 and 3, the pilot reselection method for unmanned ship formation provided by an embodiment of the invention includes the following steps:
And step S101, performing downtime monitoring on pilot nodes in unmanned ship formation and performing communication failure monitoring on follower nodes. The pilot node sends pilot information to the follower nodes of the unmanned ship formation at fixed time intervals, and the follower nodes reply the following information to the pilot node after receiving the pilot information.
As one embodiment, the pilot node sends pilot information, specifically a heartbeat signal, to all the follower nodes once every t1 time to prove that the pilot node is operating normally. After receiving the pilot information, the follower node replies the following information to the pilot node, wherein the following information is specifically an acknowledgement signal;
If the pilot node does not receive the following information replied by the follower node after the second preset time, the pilot information is sent again to the follower node which does not reply the following information, the second preset time is 2 times of maximum information transmission delay time, and the pilot information is sent to the follower node which does not reply the following information repeatedly only once.
Step S102, when the pilot node is down, the follower node with the shortest target distance is selected as a new pilot node, and when the follower node is monitored to be a communication failure node, the node number of the communication failure node is broadcasted to a first follower node so as to invalidate the election information sent by the communication failure node.
According to the embodiment of the invention, the node number of the communication failure node is broadcast to the first follower node to tell the first follower node that the election information sent by the communication failure node is invalid information, and when all the first follower nodes receive the election information from the communication failure node, the communication failure information is replied to prompt the communication failure of the first follower node, wherein the communication failure information is a heart beat signal.
As one embodiment, when the pilot node does not receive the following information replied by the follower node within a third preset time, the follower node is judged to be a communication failure node, wherein the third preset time is 4 times of maximum information transmission delay time;
The election information sent by the communication failure node is invalidated, specifically, the first follower node sends the communication failure information to the communication failure node after receiving the election information sent by the communication failure node;
The follower node, upon receiving the communication failure information, returns to the ground station's locus (or dock) for repair.
As one embodiment, the step S102 includes the following substeps:
And S1021, judging that the pilot node is down when any follower node in unmanned ship formation does not receive pilot information sent by the pilot node in a first preset time.
Calculating the first preset time according to the following formula:
T=t1+3t2;
wherein t1 is a fixed time interval for the pilot to send pilot information, and t2 is a maximum information transmission delay time. The first preset time is the upper time limit of the receiving of the pilot information sent by the pilot node by the follower node.
Sub-step S1022 is that the second follower node waits for a second preset time (i.e. 2t2) and then sends election information to the third follower node, wherein the second follower node is the follower node which does not receive the pilot information within the first preset time, and the third follower node is the follower node which does not comprise the second follower node.
Step S1023, comparing the target distance, namely comparing the target distances of the third follower node and the second follower node after the third follower node receives the election information sent by the second follower node, keeping silent when the target distance of the third follower node is greater than or equal to the target distance of the second follower node, sending the election information to the fourth follower node when the target distance of the third follower node is smaller than the target distance of the second follower node, and sending the non-election information to the second follower node, wherein the fourth follower node is a follower node which does not send the election information within a fourth preset time, the fourth preset time is equal to n times of the first preset time (namely, nt1), and n is the total number of the unmanned ship formation nodes (namely, the unmanned ship formation nodes comprise pilot nodes and follower nodes).
And step S1024, setting the third follower node as a second follower node, setting the fourth follower node as a third follower node, and repeatedly executing the step of comparing the target distance (namely, step S1023) until any follower node does not receive the non-selected information within the first preset time after sending the selected information, and then selecting the follower node which does not receive the non-selected information within the first preset time as a new pilot node after sending the selected information.
As one embodiment, the method comprises the steps of selecting a follower node with the shortest target distance as a new pilot node, wherein the 3-type information comprises selection information, answer information and selection information, the selection information is used for announcing the selection, the follower node comprises a node number of the follower node and the distance between the follower node and an enemy plane when sending the selection information, the answer information is used for replying the selection information, particularly, the answer information is used for replying non-selection information to the non-selection follower node, and the selection information is used for announcing the node number of the new pilot node.
As one example, pi represents an unmanned ship node i, which includes a pilot node and a follower node, di represents a distance between the unmanned ship node i and a target point (such as an enemy plane), and selectedi is used to record (or identify) the current pilot node of the unmanned ship node i;
When a follower node pi receives a selection message, the follower node pi records the node number j of the pilot node in the selection message in an selectedi variable;
When the follower node pi receives an election message, comparing the target distance of the follower node pk and the target distance of the follower node pi contained in the election message, keeping silent the follower node pi when the target distance of the follower node pi is greater than or equal to the target distance of the follower node pk, sending the election message to a fourth follower node when the target distance of the follower node pi is smaller than the target distance of the follower node pk, and sending non-elected message to the follower node pk, wherein the fourth follower node is a follower node which does not send the election message within a fourth preset time, the fourth preset time is equal to n times of the first preset time, and n is the total number of nodes (including the pilot node and the follower node) of the unmanned ship formation.
The invention solves the problem that unmanned ship formation is out of control when a pilot fails, is down and is knocked down in formation, and improves fault tolerance mechanism, improves system robustness and reduces downtime loss by introducing a pilot down detection method and a reselection method for recovering system operation capability.
On the basis of the embodiment of the invention, the invention correspondingly provides an embodiment of the device item, as shown in fig. 2;
The invention further provides a pilot reelecting device for unmanned ship formation, which comprises a downtime monitoring module 101 and a reelecting module 102;
The downtime monitoring module is used for performing downtime monitoring on pilot nodes in unmanned ship formation and performing communication failure monitoring on follower nodes;
The re-election module is used for electing a follower node with the shortest target distance as a new pilot node when the pilot node is down, and broadcasting the node number of the communication failure node to a first follower node when the follower node is monitored to be the communication failure node so as to invalidate the election information sent by the communication failure node.
For convenience and brevity of description, the embodiments of the apparatus of the present invention include all the embodiments of the pilot reselection method applied to unmanned ship formation described above, and are not described herein again.
On the basis of the embodiment of the invention, the invention correspondingly provides a readable storage medium embodiment, and another embodiment of the invention provides a readable storage medium which comprises a stored computer program, and when the computer program is executed, the equipment where the readable storage medium is located is controlled to execute the pilot reselection method of the unmanned ship formation according to any one of the method embodiments of the invention.
The computer program may be divided into one or more modules, which are stored in the memory and executed by the processor to accomplish the present invention, for example. The one or more modules may be a series of computer program instruction segments capable of performing specific functions for describing the execution of the computer program in the terminal device.
The terminal equipment can be computing equipment such as a desktop computer, a notebook computer, a palm computer, a cloud server and the like. The terminal device may include, but is not limited to, a processor, a memory.
The Processor may be a central processing unit (Central Processing Unit, CPU), other general purpose Processor, digital signal Processor (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), off-the-shelf Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like, which is a control center of the terminal device, and which connects various parts of the entire terminal device using various interfaces and lines.
The memory may be used to store the computer program and/or module, and the processor may implement various functions of the terminal device by running or executing the computer program and/or module stored in the memory and invoking data stored in the memory. The memory may mainly include a storage program area which may store an operating system, an application program required for at least one function (such as a sound playing function, an image playing function, etc.), etc., and a storage data area which may store data created according to the use of the cellular phone (such as audio data, a phonebook, etc.), etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as a hard disk, memory, plug-in hard disk, smart memory card (SMART MEDIA CARD, SMC), secure Digital (SD) card, flash memory card (FLASH CARD), at least one disk storage device, flash memory device, or other volatile solid-state storage device.
Wherein the terminal device integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium, i.e. the above-mentioned readable storage medium. Based on such understanding, the present invention may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth.
It should be noted that the above-described apparatus embodiments are merely illustrative, and the units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the drawings of the embodiment of the device provided by the invention, the connection relation between the modules represents that the modules have communication connection, and can be specifically implemented as one or more communication buses or signal lines. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
While the foregoing is directed to the preferred embodiments of the present invention, it will be appreciated by those skilled in the art that changes and modifications may be made without departing from the principles of the invention, such changes and modifications are also intended to be within the scope of the invention.
Those skilled in the art will appreciate that implementing all or part of the above-described embodiments may be accomplished by way of computer programs, which may be stored on a computer readable storage medium, which when executed may comprise the steps of the above-described embodiments. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a random-access Memory (Random Access Memory, RAM), or the like.