A method for managing shared messages
By introducing a shared message management module and an asynchronous data transmission mechanism into the autonomous driving system, the communication blocking problem under the synchronous communication mechanism is solved, the system robustness is improved and data precipitation is facilitated.
Patent Information
- Application Number
- CN202210674849.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-15
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2042-06-15
AI Technical Summary
In traditional autonomous driving systems, the synchronous data transmission mechanism can easily lead to communication blockage in high concurrency states, affecting the robustness of the system.
A shared message management module is introduced in the autonomous driving system, and an asynchronous shared message publish-subscribe mechanism is adopted, and a shared message drop-down, backup and destruction mechanism is provided through this module to deal with data transmission problems between modules.
It solves the communication blocking problem, improves the system's robustness, and accumulates a large amount of road test data for system simulation and data playback.
Smart Images

Figure CN115114048B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a method for managing shared messages. Background Art
[0002] The internal modules of an autonomous driving system include various sensor modules, perception modules, prediction modules, planning modules, and control modules. These various sensor modules can be further categorized by sensor type, such as ultrasonic sensor modules, lidar sensor modules, millimeter wave sensor modules, inertial measurement unit sensor modules, global positioning system sensor modules, camera modules, and vehicle chassis modules. Traditional autonomous driving systems use a synchronous data transmission mechanism to handle data transmission between internal modules. However, this synchronization mechanism has a significant problem: it can easily cause communication congestion under high concurrency conditions. Summary of the Invention
[0003] The purpose of the present invention is to address the shortcomings of the existing technology and provide a shared message management method, electronic device, and computer-readable storage medium. First, a shared message management module is added to the autonomous driving system so that it can be connected to the system main control module and each working module respectively. Then, an asynchronous shared message publish-subscribe mechanism provided by the shared message management module is used to handle data transmission issues between modules. At the same time, the shared message management module provides shared message storage, backup, and destruction processing mechanisms to solve the local backup, remote backup, and space release issues of shared messages. Through this invention, not only can the communication congestion problem caused by traditional synchronous communication mechanisms be solved, thereby achieving the goal of improving the overall robustness of the system, but it can also accumulate a large amount of road test data, which facilitates system simulation and data playback.
[0004] To achieve the above objectives, a first aspect of an embodiment of the present invention provides a method for managing shared messages, the method comprising:
[0005] During system initialization, the shared message management module of the autonomous driving system establishes connections with the system main control module and each working module in the system; and initializes the corresponding message queue, cache queue and hash table for each working module;
[0006] After the system initialization is completed, the instructions sent by each of the working modules are continuously listened to and the corresponding shared message publishing or subscription operations are performed according to the received sending instructions; the connection status of each of the working modules is continuously judged and the corresponding shared message local backup operations are performed according to the judgment results; the instructions sent by the system main control module are listened to and the corresponding shared message disk or remote backup operations are performed according to the received sending instructions; and expired messages of each of the working modules are regularly destroyed.
[0007] Preferably, the working module includes at least an ultrasonic sensor module, a lidar sensor module, a millimeter wave sensor module, an inertial measurement unit sensor module, a global positioning system sensor module, a camera module, a vehicle chassis module, a perception module, a prediction module, a planning module and a control module;
[0008] The message queue includes a plurality of first message records; the first message record includes a first module name, a first message identifier, a first message length, a first message timestamp and a first message body; the first message length is the total length of the corresponding first message record;
[0009] The cache queue includes a plurality of first cache records; the first cache record includes a first aggregate quantity, a second message timestamp and a first message address;
[0010] The hash table includes a plurality of first hash table records; the first hash table records include a second message address, a first cache address and a first message state; the first message state includes a publishing state and a subscribing state;
[0011] The message queue, the cache queue and the hash table are all circular queues that meet the first-in-first-out principle.
[0012] Preferably, the initialization of the corresponding message queue, cache queue and hash table for each working module specifically includes:
[0013] On the volatile storage medium of the system, memory space division processing is performed for the working module according to the preset message queue, cache queue and hash table memory space configuration parameters; if the memory space division processing is successful, the corresponding message queue, cache queue and hash table are created in the divided memory space, and the created message queue, cache queue and hash table are initialized to empty queues; if the memory space division processing fails, an initialization failure warning is given and the connection with the working module is disconnected.
[0014] Preferably, the continuously monitoring the instructions sent by each of the working modules and performing corresponding shared message publishing or subscription operations according to the received sending instructions specifically includes:
[0015] Continuously monitoring the sending instructions of each working module, and taking the latest sending instruction received through monitoring as the current receiving instruction; the current receiving instruction includes an instruction code and an instruction body;
[0016] When the instruction code is a message publishing instruction code, a shared message publishing operation is performed according to the instruction body; if the shared message publishing operation is successful, a message publishing success receipt is sent back to the current working module;
[0017] When the instruction code is a message subscription instruction code, a shared message subscription operation is performed according to the instruction body to generate a corresponding subscription message record set; and the subscription message record set is sent back to the current working module.
[0018] Furthermore, the shared message publishing operation according to the instruction body specifically includes:
[0019] Extracting an aggregate quantity N from the instruction body, where N ≥ 1; and receiving the production data of the aggregate quantity N subsequently continuously sent by the current working module one by one; each time receiving the production data, extracting the production data length, working module name, production data identifier, production data timestamp, and production data content from the current production data as the corresponding first message length, first module name, first message identifier, first message timestamp, and first message body to form a corresponding first message record; and the obtained first message records of the aggregate quantity N constitute a corresponding first message record set;
[0020] Performing a message module name check on the first message record set, specifically: confirming that the message module name check is successful if all the first module names in the first message record set match the real module name of the current working module;
[0021] If the message module name check is successful, a message time check is performed on the first message record set, specifically: obtaining the second message timestamp of the first cache record with the earliest time in the cache queue as the first time; and using the first message timestamp of the first message record received earliest in the first message record set as the second time; if the second time is not earlier than the first time, confirming that the message time check is successful;
[0022] If the message time check is successful, the message queue corresponding to the current working module is used as the current message queue, and whether the aggregation number N is 1 is identified; if the aggregation number N is 1, the only first message record in the first message record set is written into the current message queue as the latest message record of the queue, and the storage address and the first message timestamp of the latest message record are extracted as the corresponding first message address and the second message timestamp; if the aggregation number N is greater than 1, the first message records of the aggregation number N in the first message record set are written into the current message queue in sequence, and the storage address and the first message timestamp of the first first message record written into the current message queue are extracted as the corresponding first message address and the second message timestamp;
[0023] The aggregation quantity N is used as the corresponding first aggregation quantity; the obtained first aggregation quantity, the second message timestamp, and the first message address are used to form the corresponding first cache record; the first cache record is written into the cache queue corresponding to the current working module as the latest cache record of the queue; and the storage address of the latest cache record is extracted as the corresponding first cache address;
[0024] Use the first message address as the corresponding second message address; set the corresponding first message status to the publishing status; and form the corresponding first hash table record by the obtained second message address, the first cache address and the first message status; and write the first hash table record into the hash table corresponding to the current working module as the latest hash table record of the queue; and confirm that the shared message publishing operation is successful when the latest hash table record is written successfully.
[0025] Furthermore, performing a shared message subscription operation according to the instruction body to generate a corresponding subscription message record set specifically includes:
[0026] Extracting the subscription message module name and subscription message identifier from the instruction body; and using the message queue, the cache queue, and the hash table of the working module corresponding to the subscription message module name as the corresponding current message queue, current cache queue, and current hash table;
[0027] Traversing each of the first hash table records of the current hash table; during the traversal, taking the first hash table record currently being traversed as the current hash table record; if the first message state of the current hash table record is the published state, taking the first message record whose storage address in the current message queue matches the second message address of the current hash table record as the current matching message record; if the first message identifier of the current matching message record matches the subscription message identifier, stopping the traversal and extracting the first cache address of the current hash table record as the corresponding current cache address;
[0028] The first cache record whose storage address in the current cache queue matches the current cache address is used as the current matching cache record; and the first aggregation quantity and the first message address of the current matching cache record are extracted as the corresponding current aggregation quantity M and current message address;
[0029] The first message record whose storage address in the current message queue matches the current message address is used as the starting message record; and the current aggregated number M of the first message records are continuously read downward from the starting message record to form the corresponding subscription message record set;
[0030] After obtaining the subscription message record set, the subscription message record set is output and the first message state of the current hash table record is changed to a subscription state.
[0031] Preferably, the continuously judging the connection status of each working module and performing the corresponding local backup operation of the shared message according to the judgment result specifically includes:
[0032] The connection status of each working module is continuously judged to generate a corresponding first judgment result; and when the first judgment result is disconnected, the message queue, the cache queue and the hash table corresponding to the working module are read out to form the corresponding shared message disk data and written into a pre-designated disk space.
[0033] Preferably, the step of monitoring the instructions sent by the system main control module and performing the corresponding shared message storage or remote backup operation according to the received instructions specifically includes:
[0034] Continuously monitoring the sending instructions of the system main control module, and taking the latest sending instruction received through monitoring as the current receiving instruction; the current receiving instruction includes an instruction code and an instruction body;
[0035] When the instruction code is a full message write instruction code, the message queues, the cache queues, and the hash table corresponding to all the working modules are written into a pre-specified disk space; and after the write operation is completed, all the message queues, the cache queues, and the hash table are deleted;
[0036] When the instruction code is an abnormal event disk-storage instruction code, the shared message of the abnormal event is stored in the disk according to the instruction body;
[0037] When the instruction code is a remote backup instruction code, the remote server address is extracted from the instruction body; the message queue, the cache queue and the hash table corresponding to each working module are combined into a corresponding first working module backup data packet; and all the obtained first working module backup data packets are combined into a corresponding remote backup data packet; and the remote backup data packet is sent to the remote server address.
[0038] Furthermore, the operation of writing the shared message of the abnormal event to disk according to the instruction body specifically includes:
[0039] Extracting a first abnormality type from the instruction body; the first abnormality type includes a vehicle collision type and a sensor abnormality type;
[0040] When the first exception type is a vehicle collision type, a first collision time and a first time interval are extracted from the instruction body; from the message queue, the cache queue and the hash table corresponding to each of the working modules, all the first message records, the first cache records and the first hash table records whose time intervals with the first collision time do not exceed the first time interval are extracted to form a corresponding first module sub-message queue, a first module sub-cache queue and a first module sub-hash table; and the first module sub-message queue, the first module sub-cache queue and the first module sub-hash table corresponding to each working module form corresponding first exception data; and all the first exception data form a corresponding first exception data set; and the first exception data set is written into a pre-designated disk space;
[0041] When the first exception type is a sensor exception type, the first working module name, the first exception time and the second time interval are extracted from the instruction body; and from the message queue, the cache queue and the hash table corresponding to the working module matching the first working module name, all the first message records, the first cache records and the first hash table records whose time interval with the first exception time does not exceed the second time interval are extracted to form the corresponding second module sub-message queue, the second module sub-cache queue and the second module sub-hash table; and the obtained second module sub-message queue, the second module sub-cache queue and the second module sub-hash table form the corresponding first sensor exception data; and the first sensor exception data is written to a pre-designated disk space; and after the write operation is completed, all the first message records, the first cache records and the first hash table records corresponding to the first sensor exception data in the message queue, the cache queue and the hash table are deleted.
[0042] Preferably, the periodic destruction of expired messages for each of the working modules specifically includes:
[0043] Each of the working modules is traversed at a preset time interval; during the traversal, the working module currently traversed is recorded as the current working module, and the message queue, the cache queue and the hash table corresponding to the current working module are recorded as the corresponding current message queue, the current cache queue and the current hash table; and the first hash table records in the current hash table whose first message status is the subscription status are all recorded as expired hash records; and the first message record and the first cache record pointed to by the second message address of each expired hash record and the first cache address are recorded as corresponding expired message records and expired cache records; and all the expired hash records, the expired message records and the expired cache records in the current message queue, the current cache queue and the current hash table are deleted.
[0044] A second aspect of an embodiment of the present invention provides an electronic device, including: a memory, a processor, and a transceiver;
[0045] The processor is configured to be coupled to the memory, read and execute instructions in the memory, so as to implement the method steps described in the first aspect above;
[0046] The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.
[0047] A third aspect of an embodiment of the present invention provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed by a computer, the computer executes the instructions of the method described in the first aspect.
[0048] An embodiment of the present invention provides a shared message management method, electronic device, and computer-readable storage medium. First, a shared message management module is added to the autonomous driving system so that it can connect to the system's main control module and each working module. The shared message management module then provides an asynchronous shared message publish-subscribe mechanism to handle inter-module data transmission issues. Furthermore, the shared message management module provides shared message storage, backup, and destruction mechanisms to address local and remote backup and space release issues for shared messages. This invention not only solves the communication congestion issues inherent in traditional synchronous communication mechanisms and improves the overall robustness of the system, but also allows the accumulation of large amounts of road test data, facilitating system simulation and data playback. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 A schematic diagram of a method for managing shared messages provided in Example 1 of the present invention;
[0050] Figure 2This is a structural diagram of an electronic device provided in Embodiment 2 of the present invention. DETAILED DESCRIPTION
[0051] To make the objectives, technical solutions, and advantages of the present invention more apparent, the present invention will be further described in detail below with reference to the accompanying drawings. It should be understood that the embodiments described herein are merely some, rather than all, of the present invention. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without inventive effort are intended to fall within the scope of protection of the present invention.
[0052] In the first embodiment of the present invention, a shared message management module is added to the autonomous driving system to manage shared information. This shared message management module, through the shared message management method provided in the first embodiment of the present invention, provides an asynchronous shared message publish-subscribe mechanism to handle data transmission issues between modules. It also provides a shared message storage, backup, and destruction processing mechanism to address local and remote backup and space release issues for shared messages. Figure 1 A schematic diagram of a method for managing shared messages provided in the first embodiment of the present invention is shown as follows: Figure 1 As shown, this method mainly includes the following steps:
[0053] Step 1: During system initialization, the shared message management module of the autonomous driving system establishes connections with the system main control module and each working module in the system; and initializes the corresponding message queue, cache queue, and hash table for each working module.
[0054] Among them, the working module includes at least an ultrasonic sensor module, a lidar sensor module, a millimeter wave sensor module, an inertial measurement unit sensor module, a global positioning system sensor module, a camera module, a vehicle chassis module, a perception module, a prediction module, a planning module and a control module;
[0055] The message queue includes multiple first message records; the first message record includes a first module name, a first message identifier, a first message length, a first message timestamp and a first message body; the first message length is the total length of the corresponding first message record; the cache queue includes multiple first cache records; the first cache record includes a first aggregation quantity, a second message timestamp and a first message address; the hash table includes multiple first hash table records; the first hash table record includes a second message address, a first cache address and a first message status; the first message status includes a publishing status and a subscribing status; the message queue, cache queue and hash table are all circular queues that meet the First Input First Output (FIFO) principle.
[0056] Here, the message queue is used to store the production data continuously generated by the corresponding working module; each first message record consists of a first module name, a first message identifier, a first message length, a first message timestamp and a first message body; the first message length is the overall data length of the first message record; the first module name is the name of the corresponding working module; each working module of the autonomous driving system of the embodiment of the present invention will assign a unique data identifier to each piece of production data generated, and the first message identifier corresponds to this unique data identifier; the first message timestamp is the time when the production data is generated; the first message body is the actual production data content, such as point cloud data of various radar sensors, images or video data captured by cameras, etc., which will not be detailed here;
[0057] Each first cache record in the cache queue corresponds to a first message record in the message queue or an aggregated message record composed of multiple first message records; if the first aggregation quantity is 1, it means that the current first cache record corresponds to a first message record, the first message address is the storage address of the corresponding first message record in the message queue, and the second message timestamp is the first message timestamp of the corresponding first message record; if the first aggregation quantity is greater than 1, it means that the current first cache record corresponds to an aggregated message record, the first message address is the storage address of the first first message record in the aggregated message record in the message queue, and the second message timestamp is the first message timestamp of the first first message record in the aggregated message record;
[0058] The hash table consists of multiple first hash table records, each first hash table record corresponds to a first message record or an aggregate message record; when the first hash table record corresponds to a first message record, the second message address is the storage address of the first message record in the message queue, and the first cache address is the storage address of the first cache record corresponding to the first message record in the cache queue; when the first hash table record corresponds to an aggregate message record, the second message address is the storage address of the first first message record in the aggregate message record in the message queue, and the first cache address is the storage address of the first cache record corresponding to the aggregate message record in the cache queue; when the first message status is the publishing status, it indicates that the corresponding shared message has not expired, and when the first message status is the subscription status, it indicates that the corresponding shared message has expired.
[0059] In step 1, the corresponding message queue, cache queue and hash table are initialized for each working module, specifically including: on the system's volatile storage medium, the memory space is divided for the working module according to the preset message queue, cache queue and hash table memory space configuration parameters; if the memory space division is successful, the corresponding message queue, cache queue and hash table are created in the divided memory space, and the created message queue, cache queue and hash table are initialized to empty queues; if the memory space division fails, an initialization failure warning is given and the connection with the working module is disconnected.
[0060] Here, the volatile storage medium (Random Access Memory, RAM) is what is commonly referred to as memory; when the shared message management module performs memory space division processing, it applies to the storage management unit of the autonomous driving system for matching memory space to create and store corresponding message queues, cache queues and hash tables based on a pre-set set of maximum message queue, cache queue and hash table memory space configuration parameters; if the memory capacity is sufficient, the storage management unit will return a corresponding memory space. At this time, the shared message management module will confirm that the memory space division processing is successful, and create corresponding message queues, cache queues and hash tables on the obtained memory space, and initialize the newly created message queues, cache queues and hash tables into empty circular queues; if the memory capacity is insufficient, the storage management unit will return an insufficient memory error message. At this time, the shared message management module will confirm that the memory space division processing has failed, and actively disconnect from the working module, and at the same time send an initialization failure warning message to its upper control module, that is, the system main control module.
[0061] Step 2: After the system is initialized, it continuously listens to the instructions sent by each working module and performs the corresponding shared message publishing or subscription operations based on the received instructions. It also continuously determines the connection status of each working module and performs the corresponding shared message local backup operations based on the determination results. It also listens to the instructions sent by the system main control module and performs the corresponding shared message disk or remote backup operations based on the received instructions. It also regularly destroys expired messages from each working module.
[0062] Here, after the shared message management module initializes a set of message queues, cache queues, and hash tables corresponding to each working module, it can implement asynchronous data transmission between modules through a shared message publish-subscribe management mechanism. It also uses a shared message storage and backup management mechanism to accumulate drive test data, and a shared message destruction management mechanism to release the memory space occupied by expired information.
[0063] Specifically comprising: step 21, continuously listening to the instructions sent by each working module and performing corresponding shared message publishing or subscription operations according to the received sending instructions;
[0064] Specifically, step 211 includes continuously monitoring the sending instructions of each working module, and taking the latest sending instruction received through monitoring as the current receiving instruction;
[0065] The currently received instruction includes an instruction code and an instruction body;
[0066] Step 212: When the command code is a message publishing command code, a shared message publishing operation is performed according to the command body; if the shared message publishing operation is successful, a message publishing success receipt is sent back to the current working module;
[0067] Here, when the instruction code is a message publishing instruction code, it indicates that the sender currently receiving the instruction, that is, the current working module, is uploading production data to the shared message management module. After receiving the uploaded production data, the shared message management module will regard it as a shared message to be published, that is, the first message record, and store it in the message queue. It will also create corresponding first cache records and first hash table records in the cache queue and hash table respectively, and set the first message state of the newly created first hash table record to the published state.
[0068] The shared message publishing operation is performed according to the instruction body, specifically including:
[0069] Step A1: Extract the aggregate quantity N from the instruction body, where N ≥ 1; and receive the aggregate quantity N of production data subsequently continuously sent by the current working module one by one; each time a piece of production data is received, extract the production data length, working module name, production data identifier, production data timestamp, and production data content from the current production data as the corresponding first message length, first module name, first message identifier, first message timestamp, and first message body, and form a corresponding first message record; and the obtained first message records of the aggregate quantity N constitute a corresponding first message record set;
[0070] The production data shall at least include the production data length, work module name, production data identifier, production data timestamp and production data content;
[0071] Here, the data structure of production data is production data length + working module name + production data identifier + production data timestamp + production data content. The production data length is the data length of the data sequence {production data length, working module name, production data identifier, production data timestamp, production data content}; the working module name is the name of the current working module; the production data identifier is the unique data identifier assigned by the current working module or the autonomous driving system to the current production data content; the production data timestamp is the time when the current working module generates the production data content; the production data content is specific data content, such as point cloud data of various radar sensors, images or video data captured by cameras, etc., which are not detailed here.
[0072] Here, when N=1, the first message record set includes only one first message record; when N>1, a first message record set with N first message records is generated every time N production data are received. In this case, the first message record set is actually an aggregated message record;
[0073] It should be noted that when the current working module is a camera module, the production data uploaded by it is the image or video data captured by the camera. The embodiment of the present invention stipulates that the time interval between two adjacent images or video data sent by the same camera module should be greater than a preset first interval threshold (the first interval threshold defaults to 10ms). To ensure that the shared message finally released can meet this time interval requirement, a message record screening process for a single camera module is specifically provided. That is, when the current working module is a camera module, the first message record set of the current working module is screened according to the preset first interval threshold. Specifically, the time interval between two adjacent first message records in the first message record set is calculated to generate a corresponding first interval (first interval = |first message timestamp of the previous first message record - first message timestamp of the next first message record|). If the first interval is less than the first interval threshold, the previous first message record is deleted; the above steps are repeated until the time interval of any pair of adjacent first message records in the first message record set is not less than the first interval threshold, and the subsequent step A2 is continued;
[0074] It should also be noted that in actual applications, there are application scenarios in which data from multiple working modules are bound to each other. For example, four camera modules that perform 360-degree shooting of the same scene will be bound into a group of four-way camera modules. The actual application stipulates that the time interval of the same batch production data of these four camera modules cannot exceed a preset second interval threshold (the second interval threshold defaults to 100ms). In order to ensure that the shared message finally released can meet this time interval requirement, a message record set screening process for multi-way camera modules is specifically given, that is, when the current working module is a camera module and has a binding relationship with multiple other camera modules, the first message record sets of all bound camera modules are screened according to the preset second interval threshold, specifically: the latest first message record sets of the other k-1 camera modules bound to the current camera module are respectively recorded as first sets P1, P2...P k-1 , and record the latest first message record set of the current camera module as the first set P k , where the first set P1, P2...P k The number of the first message records in is equal, k is a positive integer greater than 1; and the first set P1, P2...P k Extract k first message records with equal message record indexes to form a corresponding first message record sequence; if the time interval between two first message records in any first message record sequence exceeds the second interval threshold, then all first sets P1, P2...P of bound camera modules are k All are discarded and subsequent steps are stopped; if there is no time interval between two first message records in all first message record sequences that exceeds the second interval threshold, the first set of all bound camera modules P1, P2...P k Keep all and proceed to step A2;
[0075] Step A2: Check the message module name on the first message record set;
[0076] Specifically, if all first module names in the first message record set match the real module name of the current working module, then the message module name check is confirmed to be successful;
[0077] Here, the first module names of all first message records in the same first message record set should be the same; if not all first module names in the first message record set match the actual module name of the current working module, it indicates that an assembly error occurred during data reception, and the corresponding embodiment of the present invention will confirm that the message module name check has failed and stop executing subsequent operations;
[0078] Step A3: If the message module name check is successful, then perform a message time check on the first message record set;
[0079] Specifically, the method includes: obtaining the second message timestamp of the earliest first cache record in the cache queue as the first time; and obtaining the first message timestamp of the earliest received first message record in the first message record set as the second time; and confirming that the message time check is successful if the second time is not earlier than the first time;
[0080] Here, the second message timestamp of the earliest first cache record in the cache queue is also the first message timestamp of the earliest first message record in the message queue, that is, the earliest message time among all shared messages of the current working module. Under normal circumstances, the time of the newly sent production data of the current working module, that is, the second time, must not be earlier than the first time; if the second time is earlier than the first time, it means that the clock or timer of the current working module has an error. The corresponding embodiment of the present invention will confirm that the message time check has failed and stop executing subsequent operations;
[0081] Step A4: If the message time check is successful, the message queue corresponding to the current working module is used as the current message queue, and whether the aggregation number N is 1 is identified; if the aggregation number N is 1, the only first message record in the first message record set is written into the current message queue as the latest message record of the queue, and the storage address and first message timestamp of the latest message record are extracted as the corresponding first message address and second message timestamp; if the aggregation number N is greater than 1, the first message record of the aggregation number N in the first message record set is written into the current message queue in sequence, and the storage address and first message timestamp of the first message record written into the current message queue are extracted as the corresponding first message address and second message timestamp;
[0082] For example, if the aggregation quantity N=1, and there is only one first message record 11 in the first message record set, the first message address finally obtained is the storage address s11 of the first message record 11 in the message queue, and the second message timestamp is the first message timestamp t11 of the first message record 11;
[0083] For another example, if the aggregation quantity N=10, and there are 10 first message records in the first message record set, namely first message records 21, 22, 23, ..., 30, after first message records 21, 22, 23, ..., 30 are sequentially written into the message queue, the resulting first message address is the storage address s21 of first message record 21 in the message queue, and the second message timestamp is the first message timestamp t21 of first message record 21;
[0084] It should be noted that if a write error occurs during a write operation on a message queue, all data modified by the write operation will be restored to the original data before the write operation, and subsequent steps will be stopped.
[0085] Step A5: Use the aggregate quantity N as the corresponding first aggregate quantity; and form a corresponding first cache record with the obtained first aggregate quantity, the second message timestamp, and the first message address; and write the first cache record into the cache queue corresponding to the current working module as the latest cache record of the queue; and extract the storage address of the latest cache record as the corresponding first cache address;
[0086] For example, when the aggregation number N = 1, the first message address obtained is the storage address s11, and the second message timestamp obtained is t11; then, the first aggregation number of the first cache record = 1, the second message timestamp = t11, and the first message address = s11; the first cache address obtained after storing the first cache record in the cache queue is set as the storage address s3;
[0087] For another example, when the aggregation number N = 10, the first message address obtained is the storage address s21, and the second message timestamp obtained is t21; then, the first aggregation number of the first cache record = 10, the second message timestamp = t21, and the first message address = s21; the first cache address obtained after storing the first cache record in the cache queue is set as the storage address s4;
[0088] It should be noted that if a write error occurs during a write operation on the cache queue, all data modified by the write operation on the cache queue will be restored to the original data before the write operation. At the same time, all data modified by the write operation on the message queue in step A4 will be restored to the original data before the modification, and subsequent steps will be stopped.
[0089] Step A6: Use the first message address as the corresponding second message address; set the corresponding first message state to the published state; and form a corresponding first hash table record with the obtained second message address, the first cache address, and the first message state; and write the first hash table record into the hash table corresponding to the current working module as the latest hash table record of the queue; and confirm that the shared message publishing operation is successful when the latest hash table record is written successfully;
[0090] For example, when the aggregation number N=1, the first message address is the storage address s11, and the first cache address is the storage address s3. Then, the corresponding first hash table record has the following values: second message address = s11, first cache address = s3, and first message status = published status.
[0091] For another example, when the aggregation number N=10, the first message address is the storage address s21, and the first cache address is the storage address s4. Then, the corresponding first hash table record has the second message address = s21, the first cache address = s4, and the first message status = published status.
[0092] It should be noted that if a write error occurs during the write operation to the hash table, all data modified by the current write operation to the hash table will be restored to the original data before the current write operation. At the same time, all data modified by the cache queue write operation in step A5 will be restored to the original data before the modification, and all data modified by the message queue write operation in step A4 will be restored to the original data before the modification, and the execution of subsequent steps will be stopped.
[0093] Step 213: When the instruction code is a message subscription instruction code, a shared message subscription operation is performed according to the instruction body to generate a corresponding subscription message record set; and the subscription message record set is sent back to the current working module;
[0094] Here, when the instruction code is a message subscription instruction code, it means that the sender of the current instruction, that is, the current working module, is applying for production data from the shared message management module. The shared message management module will then continuously query the hash table, cache queue, and message queue according to the application parameters given in the instruction body to obtain the shared message that matches the application parameters, that is, the subscription message record set;
[0095] The shared message subscription operation is performed according to the instruction body to generate a corresponding subscription message record set, specifically including:
[0096] Step B1: extract the subscription message module name and subscription message identifier from the instruction body; and use the message queue, cache queue, and hash table of the working module corresponding to the subscription message module name as the corresponding current message queue, current cache queue, and current hash table;
[0097] Step B2: traverse each first hash table record of the current hash table; during the traversal, use the first hash table record currently being traversed as the current hash table record; if the first message status of the current hash table record is the published status, use the first message record in the current message queue whose storage address matches the second message address of the current hash table record as the current matching message record; if the first message identifier of the current matching message record matches the subscription message identifier, stop traversal and extract the first cache address of the current hash table record as the corresponding current cache address;
[0098] For example, there are 11 messages stored in the message queue, namely the first message record 11, the first message record 21, 22, 23, ... 30; the storage address of the first message record 11 is s11, and the first message identifier is m1; the storage address of the first message record 21 is s21, and the first message identifier is m2;
[0099] There are two first cache records 1 and 2 stored in the cache queue; first cache record 1 is {first aggregation number = 1, second message timestamp = t11, first message address = s11}, and first message record 2 is {first aggregation number = 10, second message timestamp = t21, first message address = s21}; the storage address of first cache record 1 is s3, and the storage address of first cache record 2 is s4;
[0100] The hash table stores two first hash table records 1 and 2, where the first hash table record 1 is {second message address = s11, first cache address = s3, first message status = published state}, and the first hash table record 2 is {second message address = s21, first cache address = s4, first message status = published state};
[0101] Assume that the subscription message identifier is m2, and traverse each first hash table record of the current hash table;
[0102] When the current hash table record is the first hash table record 1, because the first message state is the published state, the current matching message record is the first message record 11 whose storage address in the message queue matches the second message address = s11 of the current hash table record; because the first message identifier = m1 of the first message record 11 does not match the subscription message identifier m2, the traversal continues to the next first hash table record 2;
[0103] When the current hash table record is the first hash table record 2, because the first message state is the published state, the current matching message record is the first message record 21 whose storage address in the message queue matches the second message address = s21 of the current hash table record; because the first message identifier = m2 of the first message record 21 matches the subscription message identifier m2, the traversal is stopped and the first cache address = s4 of the first hash table record 2 is extracted as the corresponding current cache address, that is, the current cache address = s4;
[0104] Step B3: taking the first cache record in the current cache queue whose storage address matches the current cache address as the current matching cache record; and extracting the first aggregation quantity and the first message address of the current matching cache record as the corresponding current aggregation quantity M and current message address;
[0105] For example, the current cache address = s4, and the current matching cache record in the cache queue that matches the current cache address = s4 is the first cache record 2; then, the current aggregation quantity M should be 10, and the current message address should be s21;
[0106] Step B4: taking the first message record in the current message queue whose storage address matches the current message address as the starting message record; and continuously reading the current aggregated number M of first message records from the starting message record downward to form a corresponding subscription message record set;
[0107] For example, if the current message address is s21 and the first message record in the current message queue whose storage address matches the current message address s21 is first message record 21, then the subscription message record set consisting of the current aggregated number M=10 first message records read from first message record 21 should be {first message record 21, first message record 22, first message record 23 ... first message record 30};
[0108] Step B5: After obtaining the subscription message record set, the subscription message record set is output and the first message state of the current hash table record is changed to the subscription state;
[0109] Here, once the subscription message record set is successfully output, it means that the corresponding shared message has been successfully read by the working module that needs it. At this time, the shared message becomes expired data. Changing the first message status of the current hash table record to the subscription status is to mark the data as expired;
[0110] For example, while outputting the subscription message record set {first message record 21, first message record 22, first message record 23...first message record 30}, the first message state of the first hash table record 2 pointed to by the current hash table record in the hash table will be changed to the subscription state; in the modified hash table: the first hash table record 1 is {second message address = s11, first cache address = s3, first message state = publishing state}, and the first hash table record 2 is {second message address = s21, first cache address = s4, first message state = subscription state};
[0111] Step 22: Continuously judge the connection status of each working module and perform corresponding local backup operations of the shared message according to the judgment results;
[0112] Specifically, the method includes: continuously judging the connection status of each working module to generate a corresponding first judgment result; and when the first judgment result is disconnected, reading the message queue, cache queue, and hash table corresponding to the working module to form the corresponding shared message disk data and writing it into a pre-specified disk space;
[0113] Here, the shared message management module provides a publish-subscribe management mechanism for shared messages in step 21 to implement asynchronous data transmission between modules. In addition, the shared message management module provides an active local backup mechanism for shared messages in step 22 to back up the message queue, cache queue, and hash table of disconnected working modules using a local non-volatile storage medium (such as a disk). This is done to ensure that drive test data generated by each working module in memory is promptly stored.
[0114] Step 23: Listen to the instructions sent by the system main control module and perform corresponding shared message storage or remote backup operations according to the received instructions;
[0115] Specifically, step 231 includes continuously monitoring the sending instructions of the system main control module, and taking the latest sending instruction received through monitoring as the current receiving instruction;
[0116] The currently received instruction includes an instruction code and an instruction body;
[0117] Step 232: When the instruction code is a full message write instruction code, the message queues, cache queues, and hash tables corresponding to all working modules are written to the pre-specified disk space; and after the write operation is completed, all message queues, cache queues, and hash tables are deleted.
[0118] Here, while processing steps 21 and 22 above, the shared message management module also provides a controlled (controlled by the system main control module) shared message disk processing mechanism to use local non-volatile storage media (such as disk) to back up the message queues, cache queues, and hash tables of all working modules;
[0119] Step 233: When the command code is an abnormal event disk-storage command code, the shared message of the abnormal event is stored in disk according to the command body;
[0120] Here, while processing steps 21, 22, and 232 above, the shared message management module also provides a controlled (controlled by the system main control module) shared message disk processing mechanism for abnormal events, using local non-volatile storage media (such as disk) to back up the message queue, cache queue, and hash table related to the specific abnormal event;
[0121] Specifically comprising: step 2331, extracting a first exception type from the instruction body;
[0122] The first abnormality type includes a vehicle collision type and a sensor abnormality type;
[0123] Here, if the first abnormality type is a vehicle collision type, it means that the vehicle has been involved in a collision accident; if the first abnormality type is a sensor abnormality type, it means that a sensor has experienced data abnormality;
[0124] Step 2332: When the first exception type is a vehicle collision type, extract the first collision time and the first time interval from the instruction body; extract all first message records, first cache records, and first hash table records whose time intervals with the first collision time do not exceed the first time interval from the message queues, cache queues, and hash tables corresponding to the respective working modules to form a corresponding first module sub-message queue, a first module sub-cache queue, and a first module sub-hash table; and form corresponding first exception data from the first module sub-message queues, the first module sub-cache queues, and the first module sub-hash table corresponding to the respective working modules; and form a corresponding first exception data set from all the first exception data; and write the first exception data set into a pre-designated disk space;
[0125] Here, the first exception type is a vehicle collision type, indicating that the vehicle has experienced a collision accident. In order to retain the accident characteristic data, an embodiment of the present invention specifically stipulates that the message queues, cache queues, and hash tables of all working modules within the specified time interval before and after the accident time, that is, the first collision time, that is, within the first time interval, are backed up; for example, the first collision time is t1, the first time interval is 100s, and the total number of working modules is 23 modules, then the first exception data set should include 23 first exception data, each first exception data includes the first module sub-message queue, the first module sub-cache queue, and the first module sub-hash table generated by the corresponding working module in the time period [t1-100, t1+100];
[0126] Step 2333: When the first exception type is a sensor exception type, extract the first working module name, the first exception time, and the second time interval from the instruction body; and extract all first message records, first cache records, and first hash table records whose time interval with the first exception time does not exceed the second time interval from the message queue, cache queue, and hash table corresponding to the working module matching the first working module name to form a corresponding second module sub-message queue, a second module sub-cache queue, and a second module sub-hash table; and form the corresponding first sensor exception data from the obtained second module sub-message queue, the second module sub-cache queue, and the second module sub-hash table; and write the first sensor exception data into a pre-designated disk space; and after the write operation is completed, delete all first message records, first cache records, and first hash table records corresponding to the first sensor exception data from the message queue, cache queue, and hash table;
[0127] Here, the first exception type is a sensor exception type, indicating that a data abnormality has occurred in a certain sensor. In order to retain the sensor abnormality characteristic data, the embodiment of the present invention specifically stipulates that the message queue, cache queue and hash table of the working module where the error occurs within the specified time interval before and after the accident time, that is, the second time interval; and after the backup is completed, the error data is deleted from the message queue, cache queue and hash table in the memory to avoid causing error effects on other working modules that call data; for example, the first abnormal time is t2, the second time interval is 60s, and the name of the first working module is the camera module, then the first sensor abnormality data is the second module sub-message queue, the second module sub-cache queue and the second module sub-hash table generated by the camera module in the time period [t2-60, t2+60]; after completing the backup of the first sensor abnormality data, the second module sub-message queue, the second module sub-cache queue and the second module sub-hash table need to be deleted from the message queue, the cache queue and the hash table;
[0128] Step 234: When the instruction code is a remote backup instruction code, the remote server address is extracted from the instruction body; the message queue, cache queue, and hash table corresponding to each working module are combined into a corresponding first working module backup data packet; all the obtained first working module backup data packets are combined into a corresponding remote backup data packet; and the remote backup data packet is sent to the remote server address;
[0129] Here, while processing the above steps 21, 22, 232, and 233, the shared message management module also provides a controlled (controlled by the system main control module) shared message remote backup processing mechanism to use the storage medium of the remote server to back up the message queues, cache queues, and hash tables of all working modules;
[0130] Step 24: Periodically destroy expired messages for each work module;
[0131] Here, while processing the above steps 21, 22, 232, 233, and 234, the shared message management module also provides a proactive expired message destruction processing mechanism to release the memory space occupied by expired shared information;
[0132] Specifically, it includes: traversing each working module at a preset time interval; during the traversal, recording the currently traversed working module as the current working module, and recording the message queue, cache queue and hash table corresponding to the current working module as the corresponding current message queue, current cache queue and current hash table; and recording the first hash table records with the first message status of the subscription status in the current hash table as expired hash records; and recording the first message record and the first cache record pointed to by the second message address and the first cache address of each expired hash record as the corresponding expired message record and expired cache record; and deleting all expired hash records, expired message records and expired cache records in the current message queue, current cache queue and current hash table.
[0133] Figure 2 This is a schematic diagram of the structure of an electronic device provided in the second embodiment of the present invention. The electronic device may be the aforementioned terminal device or server, or may be a terminal device or server connected to the aforementioned terminal device or server to implement the method of the embodiment of the present invention. Figure 2 As shown, the electronic device may include: a processor 301 (such as a CPU), a memory 302, and a transceiver 303; the transceiver 303 is coupled to the processor 301, and the processor 301 controls the transceiver 303's transceiver actions. Various instructions may be stored in the memory 302 for completing various processing functions and implementing the processing steps described in the aforementioned method embodiment. Preferably, the electronic device involved in the embodiment of the present invention further includes: a power supply 304, a system bus 305, and a communication port 306. The system bus 305 is used to realize communication connections between components. The above-mentioned communication port 306 is used for connection and communication between the electronic device and other peripherals.
[0134] exist Figure 2 The system bus 305 mentioned in the figure can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 2 The use of a single bold line in the diagram does not necessarily imply a single bus or type of bus. Communication interfaces enable communication between the database access device and other devices (e.g., clients, read-write libraries, and read-only libraries). Memory may include random access memory (RAM) and non-volatile memory (NVM), such as at least one disk drive.
[0135] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), a graphics processing unit (GPU), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0136] It should be noted that an embodiment of the present invention further provides a computer-readable storage medium, which stores instructions. When the computer-readable storage medium is run on a computer, it enables the computer to execute the methods and processing procedures provided in the above embodiments.
[0137] An embodiment of the present invention further provides a chip for executing instructions, which is used to execute the processing steps described in the above method embodiment.
[0138] An embodiment of the present invention provides a shared message management method, electronic device, and computer-readable storage medium. First, a shared message management module is added to the autonomous driving system so that it can connect to the system's main control module and each working module. The shared message management module then provides an asynchronous shared message publish-subscribe mechanism to handle inter-module data transmission issues. Furthermore, the shared message management module provides shared message storage, backup, and destruction mechanisms to address local and remote backup and space release issues for shared messages. This invention not only solves the communication congestion issues inherent in traditional synchronous communication mechanisms and improves the overall robustness of the system, but also allows the accumulation of large amounts of road test data, facilitating system simulation and data playback.
[0139] Professionals should also be further aware 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 above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians 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 the present invention.
[0140] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0141] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for managing shared messages, characterized in that: The method comprises: During system initialization, the shared message management module of the autonomous driving system establishes connections with the system main control module and each working module in the system; and initializes the corresponding message queue, cache queue and hash table for each working module; After the system is initialized, it continuously listens to the instructions sent by each working module and performs the corresponding shared message publishing or subscription operations according to the received instructions; it continuously judges the connection status of each working module and performs the corresponding shared message local backup operation according to the judgment result; it also listens to the instructions sent by the system main control module and performs the corresponding shared message disk or remote backup operation according to the received instructions; and it regularly destroys expired messages of each working module; The message queue includes a plurality of first message records; the first message record includes a first module name, a first message identifier, a first message length, a first message timestamp, and a first message body; the first message length is the total length of the corresponding first message record; The cache queue includes a plurality of first cache records; the first cache record includes a first aggregate quantity, a second message timestamp and a first message address; The hash table includes a plurality of first hash table records; the first hash table records include a second message address, a first cache address and a first message state; the first message state includes a publishing state and a subscribing state; The continuously monitoring the instructions sent by each working module and performing corresponding shared message publishing or subscription operations according to the received sending instructions specifically includes: Continuously monitoring the sending instructions of each working module, and taking the latest sending instruction received through monitoring as the current receiving instruction; the current receiving instruction includes an instruction code and an instruction body; When the instruction code is a message publishing instruction code, a shared message publishing operation is performed according to the instruction body, the shared message to be published is stored in the message queue as the first message record, and corresponding first cache records and first hash table records are created in the cache queue and the hash table respectively, and the first message state of the newly created first hash table record is set to the publishing state; if the shared message publishing operation is successful, a message publishing success receipt is sent back to the current working module; When the instruction code is a message subscription instruction code, performing a shared message subscription operation according to the instruction body to generate a corresponding subscription message record set; and sending the subscription message record set back to the current working module; The step of performing a shared message subscription operation according to the instruction body to generate a corresponding subscription message record set specifically includes: Extracting the subscription message module name and subscription message identifier from the instruction body; and using the message queue, the cache queue, and the hash table of the working module corresponding to the subscription message module name as the corresponding current message queue, current cache queue, and current hash table; Traversing each of the first hash table records of the current hash table; during the traversal, taking the first hash table record currently being traversed as the current hash table record; if the first message state of the current hash table record is the published state, taking the first message record whose storage address in the current message queue matches the second message address of the current hash table record as the current matching message record; if the first message identifier of the current matching message record matches the subscription message identifier, stopping the traversal and extracting the first cache address of the current hash table record as the corresponding current cache address; The first cache record whose storage address in the current cache queue matches the current cache address is used as the current matching cache record; and the first aggregation quantity and the first message address of the current matching cache record are extracted as the corresponding current aggregation quantity M and current message address; The first message record whose storage address in the current message queue matches the current message address is used as the starting message record; and the current aggregated number M of the first message records are continuously read downward from the starting message record to form the corresponding subscription message record set; After obtaining the subscription message record set, the subscription message record set is output and the first message state of the current hash table record is changed to a subscription state.
2. The method for managing shared messages according to claim 1, wherein: The working modules include at least an ultrasonic sensor module, a lidar sensor module, a millimeter wave sensor module, an inertial measurement unit sensor module, a global positioning system sensor module, a camera module, a vehicle chassis module, a perception module, a prediction module, a planning module and a control module; The message queue, the cache queue and the hash table are all circular queues that meet the first-in-first-out principle.
3. The method for managing shared messages according to claim 1, wherein: Initializing the corresponding message queue, cache queue and hash table for each working module specifically includes: On the volatile storage medium of the system, memory space division processing is performed for the working module according to the preset message queue, cache queue and hash table memory space configuration parameters; if the memory space division processing is successful, the corresponding message queue, cache queue and hash table are created in the divided memory space, and the created message queue, cache queue and hash table are initialized to empty queues; if the memory space division processing fails, an initialization failure warning is given and the connection with the working module is disconnected.
4. The method for managing shared messages according to claim 1, wherein: The shared message publishing operation according to the instruction body specifically includes: Extracting an aggregate quantity N from the instruction body, where N ≥ 1; and receiving the production data of the aggregate quantity N subsequently continuously sent by the current working module one by one; each time receiving the production data, extracting the production data length, working module name, production data identifier, production data timestamp, and production data content from the current production data as the corresponding first message length, first module name, first message identifier, first message timestamp, and first message body to form a corresponding first message record; and the obtained first message records of the aggregate quantity N constitute a corresponding first message record set; Performing a message module name check on the first message record set, specifically: confirming that the message module name check is successful if all the first module names in the first message record set match the real module name of the current working module; If the message module name check is successful, a message time check is performed on the first message record set, specifically: obtaining the second message timestamp of the first cache record with the earliest time in the cache queue as the first time; and using the first message timestamp of the first message record received earliest in the first message record set as the second time; if the second time is not earlier than the first time, confirming that the message time check is successful; If the message time check is successful, the message queue corresponding to the current working module is used as the current message queue, and whether the aggregation number N is 1 is identified; if the aggregation number N is 1, the only first message record in the first message record set is written into the current message queue as the latest message record of the queue, and the storage address and the first message timestamp of the latest message record are extracted as the corresponding first message address and the second message timestamp; if the aggregation number N is greater than 1, the first message records of the aggregation number N in the first message record set are written into the current message queue in sequence, and the storage address and the first message timestamp of the first first message record written into the current message queue are extracted as the corresponding first message address and the second message timestamp; The aggregation quantity N is used as the corresponding first aggregation quantity; the obtained first aggregation quantity, the second message timestamp, and the first message address are used to form the corresponding first cache record; the first cache record is written into the cache queue corresponding to the current working module as the latest cache record of the queue; and the storage address of the latest cache record is extracted as the corresponding first cache address; Use the first message address as the corresponding second message address; set the corresponding first message status to the publishing status; and form the corresponding first hash table record by the obtained second message address, the first cache address and the first message status; and write the first hash table record into the hash table corresponding to the current working module as the latest hash table record of the queue; and confirm that the shared message publishing operation is successful when the latest hash table record is written successfully.
5. The method for managing shared messages according to claim 1, wherein: The continuously judging the connection status of each working module and performing the corresponding local backup operation of the shared message according to the judgment result specifically includes: The connection status of each working module is continuously judged to generate a corresponding first judgment result; and when the first judgment result is disconnected, the message queue, the cache queue and the hash table corresponding to the working module are read out to form the corresponding shared message disk data and written into a pre-designated disk space.
6. The method for managing shared messages according to claim 1, wherein: The step of listening to the command sent by the system main control module and performing the corresponding shared message storage or remote backup operation according to the received command specifically includes: Continuously monitoring the sending instructions of the system main control module, and taking the latest sending instruction received through monitoring as the current receiving instruction; the current receiving instruction includes an instruction code and an instruction body; When the instruction code is a full message write instruction code, the message queues, the cache queues, and the hash table corresponding to all the working modules are written into a pre-specified disk space; and after the write operation is completed, all the message queues, the cache queues, and the hash table are deleted; When the instruction code is an abnormal event disk-storage instruction code, the shared message of the abnormal event is stored in the disk according to the instruction body; When the instruction code is a remote backup instruction code, the remote server address is extracted from the instruction body; the message queue, the cache queue and the hash table corresponding to each working module are combined into a corresponding first working module backup data packet; and all the obtained first working module backup data packets are combined into a corresponding remote backup data packet; and the remote backup data packet is sent to the remote server address.
7. The method for managing shared messages according to claim 6, wherein: The operation of writing the shared message of the abnormal event to disk according to the instruction body specifically includes: Extracting a first abnormality type from the instruction body; the first abnormality type includes a vehicle collision type and a sensor abnormality type; When the first exception type is a vehicle collision type, a first collision time and a first time interval are extracted from the instruction body; from the message queue, the cache queue and the hash table corresponding to each of the working modules, all the first message records, the first cache records and the first hash table records whose time intervals with the first collision time do not exceed the first time interval are extracted to form a corresponding first module sub-message queue, a first module sub-cache queue and a first module sub-hash table; and the first module sub-message queue, the first module sub-cache queue and the first module sub-hash table corresponding to each working module form corresponding first exception data; and all the first exception data form a corresponding first exception data set; and the first exception data set is written into a pre-designated disk space; When the first exception type is a sensor exception type, the first working module name, the first exception time and the second time interval are extracted from the instruction body; and from the message queue, the cache queue and the hash table corresponding to the working module matching the first working module name, all the first message records, the first cache records and the first hash table records whose time interval with the first exception time does not exceed the second time interval are extracted to form the corresponding second module sub-message queue, the second module sub-cache queue and the second module sub-hash table; and the obtained second module sub-message queue, the second module sub-cache queue and the second module sub-hash table form the corresponding first sensor exception data; and the first sensor exception data is written to a pre-designated disk space; and after the write operation is completed, all the first message records, the first cache records and the first hash table records corresponding to the first sensor exception data in the message queue, the cache queue and the hash table are deleted.
8. The method for managing shared messages according to claim 1, wherein: The periodic destruction of expired messages of each working module specifically includes: Each of the working modules is traversed at a preset time interval; during the traversal, the working module currently traversed is recorded as the current working module, and the message queue, the cache queue and the hash table corresponding to the current working module are recorded as the corresponding current message queue, the current cache queue and the current hash table; and the first hash table records in the current hash table whose first message status is the subscription status are all recorded as expired hash records; and the first message record and the first cache record pointed to by the second message address of each expired hash record and the first cache address are recorded as corresponding expired message records and expired cache records; and all the expired hash records, the expired message records and the expired cache records in the current message queue, the current cache queue and the current hash table are deleted.
9. An electronic device, characterized in that: include: memory, processors, and transceivers; The processor is configured to be coupled to the memory, read and execute instructions in the memory, so as to implement the method according to any one of claims 1 to 8; The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a computer, the computer is caused to execute the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Message processing method and server
CN108009022A
Message sending method and server
CN108023938A