System and method for collaborative positioning and automatic subscription based on MQTT
Through the mqtt protocol and back-end server dynamic management message theme, the problem of real-time information subscription and unbinding in the unmanned device collaborative system is solved, and efficient coordinated positioning and precise strikes of unmanned device clusters are realized.
Patent Information
- Application Number
- CN202211652307.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-16
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2042-12-16
AI Technical Summary
In the multi-unmanned device collaborative system platform, due to network instability and bandwidth limitations, it is difficult for the existing technology to realize dynamic subscription and unbinding of unmanned device information on the server side, resulting in insufficient real-time and efficient collaborative positioning processing.
The mqtt protocol is used to combine unmanned equipment clusters, and the addition, deletion and modification of message themes are dynamically managed through the back-end server, and the route is planned based on heartbeat information and location feedback, so as to realize the coordinated combat of unmanned equipment clusters.
It improves the real-time and efficient collaborative cooperation between unmanned equipment, and achieves a precise blow to the goal.
Smart Images

Figure CN116132510B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer information processing, and particularly relates to a system and method for collaborative positioning and automatic subscription based on MQTT. Background Art
[0002] MQTT is an Internet of Things transmission protocol that provides real-time and reliable message services for remotely connected devices with only minimal code and limited bandwidth. As an instant messaging protocol with low overhead and low bandwidth occupancy, it has a wide range of applications in the Internet of Things, small devices, mobile applications, etc.
[0003] In a multi-unmanned device (drone, unmanned vehicle) collaborative system platform, due to network instability and bandwidth limitations, the MQTT protocol is generally selected as the interaction method between the server side and the device side. However, since the message topics (topics) sent by unmanned devices to the outside change dynamically with the device information, and at the same time the server side needs to flexibly subscribe to and unbind different topics for message processing, and on this basis build a cluster of unmanned devices to achieve precise strikes on the target. Therefore, the server side needs to implement dynamic subscription and unbinding based on MQTT to timely obtain device information for collaborative positioning processing. Summary of the Invention
[0004] To solve the above problems, the present invention provides a system and method for collaborative positioning and automatic subscription based on MQTT, which combines MQTT with a cluster of unmanned devices, and automatically adds, deletes, and modifies message topics according to the devices that have been dynamically added, deleted, and modified in the system platform. The server side receives the heartbeat information and related position operation feedback packets of each unmanned device, and plans the route information of the device cluster in the task for collaborative operations.
[0005] The present invention provides a system for collaborative positioning and automatic subscription based on MQTT, and the specific technical solution is as follows:
[0006] The system includes unmanned devices, an MQTT server, a backend server, a frontend server, and a database;
[0007] The unmanned devices are connected to the MQTT server and send messages to the MQTT server, and the backend server is respectively connected to the MQTT server and the frontend server;
[0008] The MQTT server is used for message distribution according to different topics;
[0009] The backend server is used for receiving and processing the messages sent by the unmanned devices distributed by the MQTT server;
[0010] The front-end server provides an interactive interface for performing operations of adding, deleting, and modifying unmanned devices and outputting the status information of unmanned devices;
[0011] The database is connected to the front-end server and stores the added device information.
[0012] The present invention also provides a method for collaborative positioning and automatic subscription based on MQTT. Based on the above system, the method is as follows:
[0013] S1: Initialize the MQTT server, the back-end server, and the front-end server;
[0014] S2: The unmanned aerial vehicle device constructs a topic according to its own device type and sends a message to the MQTT server based on this topic;
[0015] S3: The back-end server constructs a connection factory with the MQTT server, queries the database to determine the device types added by the front-end server, and subscribes to the topics corresponding to the existing device types according to the query results;
[0016] S4: The back-end server starts a timing service. Every set time, it queries the device information table in the database and constructs a CurrentHashMap with the device ID and the device type and stores it in the cache;
[0017] The CurrentHashMap is modified synchronously according to the addition, deletion, and modification of unmanned devices in the front-end server;
[0018] S5: The back-end server constructs the subscribed topics according to the CurrentHashMap;
[0019] S6: The back-end server parses the device information according to different topics and sends the position information of the unmanned device cluster to the front-end server;
[0020] S7: The front-end server binds the unmanned device cluster to be executed according to the corresponding task mode. The back-end server calculates the flight paths of each unmanned device to be executed through an algorithm according to the corresponding task mode and sends them back to the front-end server for confirmation;
[0021] S8: After the front-end server confirms the flight path, the back-end server sends it to each topic through the MQTT server to issue the flight path command.
[0022] Further, in step S3, the MQTT connection factory of the back-end server instantiates and injects the bean object MessageProducer created during initialization in the bean object of MqttConsumer in a lazy loading manner.
[0023] Further, in step S5, when the device information given in the front-end server is modified, the process of the back-end server dynamically subscribing to the topic is as follows:
[0024] S501: MqttConsumer queries the name field of the topic to be subscribed in the CurrentHashMap cache;
[0025] S502: Add or delete the topic through the topic addition or deletion program of MessageProducer.
[0026] Further, in step S6, the back-end server sends the location information of the unmanned device cluster to the front-end server through the webSocket method.
[0027] Further, in step S6, after the front-end server receives the location information of the unmanned device cluster, it displays and outputs the location information and status information on the map, and outputs a warning prompt signal through the interaction interface when the device is offline.
[0028] Further, in step S8, after the front-end server receives the flight path, it performs a confirmation operation through the interaction interface.
[0029] Further, after the unmanned device receives the route instruction, it feeds back the route instruction reception result to the mqtt server, and the back-end server receives the feedback result published by the mqtt server, parses it and then transmits it back to the front-end server.
[0030] The beneficial effects of the present invention are as follows:
[0031] The system includes unmanned devices, an mqtt server, a back-end server, a front-end server, and a database. The unmanned device, as a message subscriber and receiver, sends messages such as heartbeats and command feedbacks to the mqtt server. The mqtt server is responsible for receiving and forwarding messages of different topics. The back-end server receives and processes the unmanned device messages through the mqtt broker, and then dynamically adjusts according to the changes to the device by the front-end server, that is, the interaction interface, and timely constructs the unmanned device cluster, plans the routes and operations of each device, realizes the precise cooperative strike on the target, and improves the real-time performance and efficiency of the cooperative cooperation among traditional unmanned devices. Description of the Drawings
[0032] Figure 1 It is a schematic diagram of the overall process of the method. Detailed Embodiments
[0033] In the following description, the technical solutions in the embodiments of the present invention are clearly and completely described. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts belong to the scope of protection of the present invention.
[0034] In the description of the embodiments of the present invention, it should be noted that the orientation or positional relationship indicated is based on the orientation or positional relationship shown in the drawings, or the orientation or positional relationship in which the product of the invention is usually placed during use, or the orientation or positional relationship commonly understood by those skilled in the art, or the orientation or positional relationship in which the product of the invention is usually placed during use. It is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation to the present invention. In addition, the terms "first" and "second" are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance.
[0035] In the description of the embodiments of the present invention, it should also be noted that unless otherwise clearly defined and limited, the terms "set" and "connect" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a direct connection or an indirect connection through an intermediate medium. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0036] Embodiment 1
[0037] Embodiment 1 of the present invention discloses a system for collaborative positioning and automatic subscription based on MQTT, including unmanned devices, an MQTT server, a backend server, a frontend server, and a database;
[0038] The unmanned device is connected to the MQTT server and sends messages to the MQTT server. The backend server is respectively connected to the MQTT server and the frontend server;
[0039] The MQTT server is used for message distribution according to different topics;
[0040] The backend server is used for receiving and processing the messages sent by the unmanned device distributed by the MQTT server;
[0041] The frontend server provides an interactive interface for performing operations of adding, deleting, and modifying unmanned devices and outputting the status information of unmanned devices. In this embodiment, the interactive interface is a web interface;
[0042] The database is connected to the front-end server and stores the added device information.
[0043] Embodiment 2
[0044] Embodiment 2 of the present invention discloses a method for collaborative positioning and automatic subscription based on MQTT, based on the system described in Embodiment 1 above;
[0045] The method is as follows:
[0046] S1: Deploy unmanned devices to form an unmanned device cluster, and initialize the MQTT server, back-end server, and front-end server.
[0047] S2: The unmanned aerial vehicle device constructs a topic according to its own device type, and sends device information to the MQTT server based on this topic.
[0048] S3: The back-end server constructs a connection factory with the MQTT server, and queries the database during initialization to determine the device types added by the front-end server. According to the query results, when constructing the connection factory with the MQTT server, subscribe to the topics corresponding to the existing device types;
[0049] In this embodiment, the MQTT connection factory of the back-end server instantiates and injects the bean object MessageProducer created during initialization into the bean object of MqttConsumer in a lazy loading manner.
[0050] S4: After the back-end server completes initialization, start a timing service. Every 10 minutes, query the device information table in the database, and construct a CurrentHashMap with the device ID and device type and store it in the cache;
[0051] The CurrentHashMap is modified synchronously according to the addition, deletion, and modification of unmanned devices in the front-end server.
[0052] S5: The back-end server constructs the subscribed topics according to the CurrentHashMap;
[0053] The specific format is topic name = "id + {device type}";
[0054] When the device information given in the front-end server is modified, the CurrentHashMap will also be modified, and the modification of the topic name will be triggered;
[0055] After the device information in the front-end server is modified, the back-end server performs dynamic topic subscription in the following manner
[0056] The MqttConsumer queries the topic name to be subscribed. The topic can be dynamically subscribed by adding or removing topics through the addTopic(String...topic) or removeTopic(String...topic) methods of the MessageProducer.
[0057] S6: The backend server parses the device information according to different topics and sends the location information of the unmanned device cluster to the front-end server.
[0058] In this embodiment, the backend server sends the location information of the unmanned device cluster to the front-end server via the webSocket method.
[0059] After receiving the location information of the unmanned device cluster, the front-end server displays and outputs the location information and status information on the map, and outputs a warning prompt signal through the interaction interface when the device is offline.
[0060] S7: The front-end server constructs the corresponding task mode and binds the unmanned device cluster to be executed. The backend server calculates the flight paths of each unmanned device for the task to be executed through the corresponding algorithm and sends them back to the front-end server for confirmation.
[0061] After receiving the flight paths, the staff performs a click confirmation operation through the interaction interface.
[0062] S8: After the front-end server confirms the flight paths, the backend server sends them to each topic through the mqtt server to issue the flight path commands.
[0063] After receiving the flight path command, the unmanned device feeds back the result of successful or failed reception of the flight path command to the mqtt server. The backend server receives the feedback result published by the mqtt server, parses it, and sends it back to the front-end server.
[0064] The present invention is not limited to the foregoing specific embodiments. The present invention extends to any new feature or any new combination disclosed in this specification, as well as any new method or process step or any new combination disclosed.
Claims
1. A method for collaborative positioning and automatic subscription based on MQTT, applied to a system for collaborative positioning and automatic subscription based on MQTT, characterized in that, The system includes an unmanned device, an MQTT server, a backend server, a frontend server, and a database; The unmanned device is connected to the MQTT server and sends messages to the MQTT server. The backend server is respectively connected to the MQTT server and the frontend server; The MQTT server is used for message distribution according to different topics; The backend server is used to receive and process the messages sent by the unmanned device distributed by the MQTT server; The frontend server provides an interaction interface for performing operations of adding, deleting, and modifying unmanned devices and outputting the status information of unmanned devices; The database is connected to the frontend server and stores the added device information; The method includes: S1: Initialize the MQTT server, the backend server, and the frontend server; S2: The unmanned aerial vehicle device constructs a topic according to its own device type and sends a message to the MQTT server based on this topic; S3: The backend server constructs a connection factory with the MQTT server, queries the database to determine the device types added by the frontend server, and subscribes to the topics corresponding to the existing device types according to the query results; S4: The backend server starts a timing service. Every set time, it queries the device information table in the database and constructs a CurrentHashMap with the device ID and device type and stores it in the cache; The CurrentHashMap is modified synchronously according to the addition, deletion, and modification of unmanned devices in the frontend server; S5: The backend server constructs the subscribed topics according to the CurrentHashMap; S6: The backend server parses the device information according to different topics and sends the location information of the unmanned device cluster to the frontend server; S7: The frontend server binds the unmanned device cluster to be executed according to the corresponding task mode. The backend server calculates the flight paths of each unmanned device to be executed through an algorithm according to the corresponding task mode and sends them back to the frontend server for confirmation; S8: After the frontend server confirms the flight path, the backend server sends it to each topic through the MQTT server to issue the flight path command.
2. The method for collaborative positioning and automatic subscription based on MQTT according to claim 1, characterized in that, In step S3, the MQTT connection factory of the backend server instantiates and injects the bean object MessageProducer created during initialization into the bean object MqttConsumer in a lazy loading manner.
3. The method for collaborative positioning and automatic subscription based on MQTT according to claim 1, characterized in that, In step S5, when the device information given in the frontend server is modified, the process of the backend server dynamically subscribing to topics is as follows: S501: MqttConsumer queries the name field of the topic to be subscribed in the CurrentHashMap cache; S502: Add or delete the topic through the topic addition or deletion program of MessageProducer.
4. The method for collaborative positioning and automatic subscription based on MQTT according to claim 1, characterized in that, In step S6, the backend server sends the location information of the unmanned device cluster to the frontend server through the webSocket method.
5. The method for collaborative positioning and automatic subscription based on MQTT according to claim 1, characterized in that, In step S6, after the front-end server receives the location information of the unmanned device cluster, it displays and outputs the location information and status information on the map, and outputs a warning prompt signal through the interaction interface when the device is offline.
6. The method for collaborative positioning and automatic subscription based on MQTT according to claim 1, characterized in that, In step S8, after the front-end server receives the flight path, it performs a confirmation operation through the interaction interface.
7. The method for collaborative positioning and automatic subscription based on MQTT according to claim 1, characterized in that, After the unmanned device receives the route instruction, it feeds back the route instruction reception result to the mqtt server. The back-end server receives the feedback result published by the mqtt server, parses it and then transmits it back to the front-end server.
Citation Information
Patent Citations
Unmanned intelligent road sweeper dynamic monitoring system based on Internet of Things technology
CN111901368A