Vehicle data collection method, device, vehicle and storage medium
By defining interface library files in the vehicle and using data publishing and subscription methods and shared memory methods to cache data packets, the problem of waste of resources and high management costs caused by multi-type data collection is solved, and efficient data management and storage is achieved.
Patent Information
- Application Number
- CN202310458232.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-25
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2043-04-25
AI Technical Summary
In the prior art, multiple types of data acquisition lead to data redundancy, data development code redundancy and difficulty in maintaining, excessive computing resources, increased data transmission traffic, increased data storage space and high data management costs.
The interface library files of each data generation object in the vehicle are defined using the preset protocol, and the data packets are cached to the cache memory through data publishing and subscription methods and/or shared memory, and the appropriate cache method is selected according to the data size, so that the data packets that meet the trigger conditions are written to the vehicle's disk.
It realizes clear data exchange between various modules, saves computing resources, reduces data management costs, reduces storage space usage, reduces redundancy and difficulty in maintaining data development codes, and improves data management efficiency.
Smart Images

Figure CN116524621B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of vehicle data collection, and in particular to a vehicle data collection method, device, vehicle, and storage medium. Background Art
[0002] With the rapid development of intelligent and connected vehicles, data sources have expanded from conventional CAN (Controller Area Network) data such as body, power and chassis to multi-type data such as camera images and videos, radar point clouds, various algorithms and vehicle environments for autonomous driving and smart cockpits; data types have also changed from structured data to unstructured data. In order to enhance users' driving experience and meet regulatory requirements, efficient use of data and reduction of end-cloud resources are the directions that various automobile companies are constantly exploring for improvement.
[0003] In related technologies, the problem of multi-type data collection usually involves receiving, caching, and storing various data types separately for compass processing or selectively centralizing them together before uploading them to the cloud. However, this will cause redundancy in vehicle-side code development and make it difficult to maintain. First, the vehicle-side method of decoding the camera code stream to reproduce images or videos takes up too many CPU (Central Processing Unit) resources, resulting in a waste of resources; then, multiple cameras on the vehicle side generate multiple video files, resulting in an increase in the file size compared to the video stream before decoding, which in turn reduces the write life of the controller file and increases the end-cloud transmission traffic and cloud storage space; finally, due to the diversity of data types, the cloud needs to handle time synchronization issues when replaying data, which increases the cost of cloud data management. Summary of the Invention
[0004] The present application provides a vehicle data collection method, device, vehicle and storage medium to solve the problems in related technologies such as multi-type data collection leading to data redundancy, redundant and difficult maintenance of data development code, excessive use of computing resources, increased data transmission traffic, increased data storage space, and high data management costs.
[0005] The first aspect of the present application provides a vehicle data collection method, comprising the following steps: defining an interface library file for each data generating object in the vehicle using a preset protocol; implementing data transfer between the data generating objects using the interface library file, and aggregating the data of the data generating objects at the same collection moment to obtain a data packet; caching the data packet to a cache memory using a data publishing and subscription method and / or a shared memory method, and writing a data packet of a preset duration that meets a preset trigger condition to the disk of the vehicle.
[0006] According to the above technical means, in the embodiment of the present application, the interface library file of each data generating object in the vehicle is defined based on the preset protocol, which can ensure the clear data exchange between each module, and realize data transmission between data by using the interface library file, gather the data of each data generating object at the same collection time, and cache the data packet to the cache memory by using the data publishing and subscription method and / or the shared memory method. It can cache data packets of different data sizes, and write the data packets of the required time period before and after the trigger conditions according to the actual situation to the vehicle's disk, saving computing power resources and reducing the cost of data management. The use of the preset protocol to complete the definition of data can realize the mutual calling and information transmission of each module, and data publishing and receiving can be cached in different ways for information of different sizes. Each module can effectively reduce data redundancy, redundancy and difficulty of maintenance of data development code, save storage space and computing power resources, and reduce the cost of data management.
[0007] Optionally, the method of caching the data packet to the cache memory using a data publishing and subscription method and / or a shared memory method includes: identifying the data volume of the data packet; if the data volume is less than or equal to a preset threshold, caching the data packet to the cache memory through a publish-subscribe message queue, and continuously writing the data packet to a preset length queue of the cache memory with time as the index; if the data volume is greater than the preset threshold, caching the associated information of the data packet to the cache memory through the publish-subscribe message queue, caching the corresponding data packet in the shared memory to the cache memory according to the associated information, and continuously writing the data packet to the preset length queue of the cache memory with time as the index.
[0008] According to the above technical means, in the embodiment of the present application, when the data volume of a data packet is less than or equal to a preset threshold, the data packet is cached by publishing a subscription message; when the data volume of a data packet is greater than the preset threshold, the data packet in the shared memory is obtained and stored in the cache memory by publishing the associated information of the cached data packet in the subscription message queue; a suitable method is selected according to the data volume of the data packet to cache the data packet in the cache memory, and the data packet is continuously written to the cache memory frame by frame with time as the index, which can save computing power resources to a great extent and reduce the cost of data management.
[0009] Optionally, the associated information includes one or more of an identifier of a data generation object, a coding type, width and height attributes, a timestamp, a shared memory start address, and an actual data length.
[0010] According to the above technical means, the associated information of the embodiment of the present application includes one or more of the identifier of the data generating object, the coding type, the width and height attributes, the timestamp, the shared memory starting address and the actual data length, so that the corresponding data packet in the shared memory can be cached to the cache memory according to the associated information.
[0011] Optionally, the preset duration includes a first duration before the current moment and a second duration after the current moment, wherein the first duration is less than the length of the preset long queue, and the preset long queue caches data in a circular coverage manner.
[0012] According to the above technical means, when the trigger conditions are met, the embodiment of the present application takes out the data of the required time period before and after the trigger moment from the cache and writes it to the disk, and caches the data in a circular overwrite manner, thereby avoiding repeated subscription of data packets and avoiding excessive storage space occupation and waste of resources.
[0013] Optionally, after writing a data packet of a preset duration that meets a preset trigger condition to the disk of the vehicle, it also includes: parsing the data on the disk by the vehicle; and / or uploading the data stored on the disk to the cloud, and using the cloud to parse the uploaded data for data playback or scene reconstruction.
[0014] According to the above technical means, the embodiment of the present application parses the disk data on the vehicle side and parses the uploaded data using the cloud side to perform data playback or scene reconstruction, which can quickly locate the problem.
[0015] Optionally, the interface library file for defining each data generating object in the vehicle using a preset protocol includes: defining an intermediate variable interface for each data generating object in the vehicle using a preset protocol; forming an interface file based on the intermediate variable interface, and compiling the interface file into the interface library file.
[0016] According to the above technical means, the embodiment of the present application uses a preset protocol to define the intermediate variable interface of each data generating object in the vehicle, forms an interface file, and compiles it into an interface library file so that the data of each module can call each other and realize information transmission between various software modules on the vehicle side.
[0017] Optionally, the preset protocol is the protobuf protocol.
[0018] A second aspect of the present application provides a data acquisition device for a vehicle, comprising: a definition module for defining an interface library file for each data generating object in the vehicle using a preset protocol; an aggregation module for implementing data transfer between the data generating objects using the interface library file, and aggregating the data of the data generating objects at the same acquisition moment to obtain a data packet; a cache module for caching the data packet to a cache memory using a data publishing and subscription method and / or a shared memory method, and writing the data packet of a preset duration that meets the preset trigger condition to the disk of the vehicle when a preset trigger condition or acquisition cycle is met.
[0019] Optionally, the cache module is further used to: identify the data volume of the data packet; if the data volume is less than or equal to a preset threshold, cache the data packet to the cache memory through a publish-subscribe message queue, and continuously write the data packet to a preset length queue of the cache memory with time as the index; if the data volume is greater than the preset threshold, cache the associated information of the data packet to the cache memory through the publish-subscribe message queue, cache the corresponding data packet in the shared memory to the cache memory according to the associated information, and continuously write the data packet to the preset length queue of the cache memory with time as the index.
[0020] Optionally, the associated information includes one or more of an identifier of a data generation object, a coding type, width and height attributes, a timestamp, a shared memory start address, and an actual data length.
[0021] Optionally, the preset duration includes a first duration before the current moment and a second duration after the current moment, wherein the first duration is less than the length of the preset long queue, and the preset long queue caches data in a circular coverage manner.
[0022] Optionally, the cache module is further used to: perform data parsing on the disk through the vehicle; and / or upload the data stored on the disk to the cloud, and use the cloud to perform data parsing on the uploaded data for data playback or scene reconstruction.
[0023] Optionally, the definition module is further used to: define an intermediate variable interface of each data generation object in the vehicle using a preset protocol; form an interface file based on the intermediate variable interface, and compile the interface file into the interface library file.
[0024] A third aspect of the present application provides a vehicle, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the vehicle data collection method as described in the above embodiment.
[0025] A fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, which is executed by a processor to implement the vehicle data collection method as described in the above embodiment.
[0026] Therefore, this application has at least the following beneficial effects:
[0027] (1) In the embodiment of the present application, the interface library file of each data generating object in the vehicle is defined based on the preset protocol, which can ensure the clear data exchange between each module, realize data transmission between data by using the interface library file, aggregate the data of each data generating object at the same collection time, cache the data packet to the cache memory by using the data publishing and subscription method and / or the shared memory method, cache the data packet of different data sizes, and write the data packet of the required time period before and after the trigger condition to the vehicle disk according to the actual situation, save computing power resources, reduce the cost of data management, and complete the definition of data by using the preset protocol to realize the mutual calling and information transmission of each module, data publishing and receiving, and can adopt different methods to cache the information of different data sizes. Each module can effectively reduce the redundancy of data, the redundancy and difficulty of maintenance of data development code, save storage space and computing power resources, and reduce the cost of data management.
[0028] (2) In the embodiment of the present application, when the data volume of a data packet is less than or equal to a preset threshold, the data packet is cached by publishing a subscription message. When the data volume of a data packet is greater than the preset threshold, the data packet in the shared memory is obtained by publishing the associated information of the cached data packet in the subscription message queue and stored in the cache memory. The data packet is cached in the cache memory in an appropriate manner according to the data volume of the data packet, and the data packet is continuously written to the cache memory frame by frame with time as the index, which can greatly save computing resources and reduce the cost of data management.
[0029] (3) The associated information of the embodiment of the present application includes one or more of the identifier of the data generating object, the coding type, the width and height attributes, the timestamp, the shared memory starting address and the actual data length, so that the corresponding data packet in the shared memory can be cached to the cache memory according to the associated information.
[0030] (4) When the trigger condition is met, the embodiment of the present application takes out the data of the required time period before and after the trigger moment from the cache and writes it to the disk, and caches the data in a circular overwrite manner, thereby avoiding repeated subscription of data packets and avoiding excessive storage space occupation and waste of resources.
[0031] (5) The embodiment of the present application parses the disk data on the vehicle side and parses the uploaded data using the cloud side to perform data playback or scene reconstruction, which can quickly locate the problem.
[0032] (6) The embodiment of the present application uses a preset protocol to define the intermediate variable interface of each data generating object in the vehicle, forms an interface file, and compiles it into an interface library file so that the data of each module can call each other and realize information transmission between various software modules on the vehicle side.
[0033] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0035] Figure 1 This is a flow chart of a vehicle data collection method provided according to an embodiment of the present application;
[0036] Figure 2 This is an architectural diagram of a vehicle-side data acquisition method based on the protobuf protocol provided in an embodiment of the present application;
[0037] Figure 3 This is an example diagram of a vehicle data acquisition device according to an embodiment of the present application;
[0038] Figure 4 Schematic diagram of the structure of a vehicle according to an embodiment of the present application. DETAILED DESCRIPTION
[0039] The following describes in detail embodiments of the present application, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0040] Traditional data acquisition methods usually receive, cache and process various data types (for example, radar includes front radar, corner radar and lidar, etc., video includes front view, surround view and circumference view, etc., and other types of data, such as combined inertial navigation, V2X, etc.) separately, or selectively concentrate some processes together, and finally upload them to the cloud. However, this will result in multiple similar codes during vehicle-side development, causing code bloat and difficulty in maintenance; the vehicle side needs to decode the camera code stream and then generate pictures or videos. The decoding process requires higher CPU resources. If there are multiple cameras, the CPU resources occupied will double. In addition, separate single types or single processing flows will cause redundant waste of CPU resources and occupy the vehicle-side chip. For example, when writing data to disk, the CPU computing resources occupied by writing 100MB of data to disk as a single file are far less than those occupied by the concurrent process of writing 10 files of 10MB each to disk. The end-cloud data transmission traffic and end-cloud storage space increase. Multiple cameras on the vehicle need to generate multiple video files, and the file size increases compared to the video stream before decoding, which in turn reduces the controller file write life, increases the end-cloud transmission traffic, and increases the cloud storage space. In addition, due to the diversity of data types, the cloud needs to handle time synchronization issues when replaying data to ensure data time synchronization during data analysis or algorithm training. In addition, the diversity of data creates multiple data streams from the source, resulting in increased cloud processing costs.
[0041] Therefore, an embodiment of the present application proposes a vehicle-side data collection method based on the protobuf protocol to solve the above problems.
[0042] The following describes the vehicle data collection method, device, vehicle and storage medium of the embodiment of the present application with reference to the accompanying drawings. Specifically, Figure 1 A flow chart of a vehicle data collection method provided in an embodiment of the present application.
[0043] like Figure 1 As shown, the vehicle data collection method includes the following steps:
[0044] In step S101 , an interface library file for each data generation object in the vehicle is defined using a preset protocol.
[0045] Among them, the preset protocol is the protobuf protocol.
[0046] The data may be data generated by various sensors and data generated during the operation of various software modules, etc., which are not specifically limited here.
[0047] It can be understood that the embodiment of the present application uses the protobuf protocol to define the interface library file of each data generation object in the vehicle to facilitate the subsequent transmission of data.
[0048] In an embodiment of the present application, an interface library file for each data generating object in a vehicle is defined using a preset protocol, including: defining an intermediate variable interface for each data generating object in the vehicle using a preset protocol; forming an interface file based on the intermediate variable interface, and compiling the interface file into an interface library file.
[0049] The interface file may be a proto interface file, and the interface library file may be a pb.h interface library file, without specific limitation.
[0050] It can be understood that the embodiment of the present application uses the protobuf protocol to define the intermediate variable interface of each data generation object in the vehicle, and forms an interface file based on it, and compiles the interface file into an interface library file, which can be used for each module to call each other, and the information between the modules on the vehicle side is transmitted.
[0051] Specifically, the data format definition, i.e., the proto file format design, must meet certain naming conventions to ensure that data exchange between modules is error-free and clear, as follows:
[0052] All file names are lowercase, may include underscores, and the first word is the module abbreviation, for example: fus_freespace.proto; the first letter of each word in the message name is uppercase, and there cannot be underscores; for example: MyExcitingMsg; all variable names are lowercase, and words are connected by underscores; for example: a_struct_data_member.
[0053] Macro names are all capitalized, and words are connected by underscores, for example: MY_MACRO_THAT_SCARES_SMALL_CHILDREN; enumeration names should be consistent with constants, for example: enum Alternate Url TableErrors{OK=0, OUT_OF_MEMORY=1, MALFORMED_INPUT=2}; to prevent naming conflicts between different message types, each proto file should have a declaration symbol, for example: package tutorial; finally, comments, the proto file must include the author, modification and creation date, interpretation, etc., the most important of which is the signal interpretation.<name:[uint]、(default、min、max)、[max_number]、(factor,offset)、description> , which respectively represent <signal name: [unit], (default value, minimum value, maximum value), [repeated maximum value], (factor, offset), signal description>. Finally, these ptoto files are compiled to generate pb.h for each module to call.
[0054] In step S102, the interface library file is used to realize data transmission between the data generation objects, and the data of the data generation objects at the same collection time are aggregated to obtain a data packet.
[0055] It can be understood that the embodiment of the present application uses the interface library file to realize data transfer between various data generating objects, and aggregates the data of each data generating object at the same collection time to obtain a data packet, so that it can be cached to the cache memory in different ways according to the size of the data packet.
[0056] In step S103, data packets are cached in a cache memory using a data publishing and subscription method and / or a shared memory method, and data packets of a preset duration that meet a preset trigger condition are written to a disk of the vehicle.
[0057] Among them, the preset trigger condition can be the triggering of an event corresponding to pre-marked data, or the triggering of a vehicle collision. The trigger setting can be made according to the actual situation and is not specifically limited here.
[0058] The preset duration includes a first duration before the current moment and a second duration after the current moment, and the first duration is less than the length of the preset length queue.
[0059] Among them, the first duration can be m seconds before the occurrence of an event, and the second duration can be n seconds after the occurrence of an event. The above durations can be specifically set according to actual conditions or user intentions without specific limitations.
[0060] The length of the preset queue may be 20 seconds or 30 seconds. This parameter is configurable and is not specifically limited.
[0061] It can be understood that the embodiments of the present application use a data publishing and subscription method and / or a shared memory method to cache data packets to the cache memory, which can cache data packets of different data sizes, and write data packets of preset duration that meet preset trigger conditions to the vehicle's disk, saving computing power resources, and writing specific data packets that meet the trigger conditions to the disk according to actual conditions for subsequent retrieval.
[0062] In an embodiment of the present application, a data packet is cached to a cache memory using a data publishing and subscription method and / or a shared memory method, including: identifying the data volume of the data packet; if the data volume is less than or equal to a preset threshold, caching the data packet to the cache memory by publishing a subscription message queue, and continuously writing the data packet to a preset length queue of the cache memory with time as the index; if the data volume is greater than the preset threshold, caching the associated information of the data packet to the cache memory by publishing a subscription message queue, wherein the cache memory uses the associated information to obtain the data packet in the shared memory, and continuously writes the data packet to the preset length queue of the cache memory with time as the index.
[0063] The preset threshold value may be set by the user according to different types of storage devices and is not specifically limited here.
[0064] Among them, the associated information includes one or more of the identifier of the data generating object, coding type, width and height attributes, timestamp, shared memory starting address and actual data length, which can be selected according to actual conditions without specific limitation.
[0065] The preset length queue uses a circular overlay method to cache data.
[0066] It can be understood that the embodiment of the present application identifies the data volume of a data packet. If the data volume is less than or equal to a threshold, a publish-subscribe message queue is used to cache the data packet. If the data volume is greater than the threshold, a shared memory method is used to cache the data packet, so that different methods can be used to cache data according to the actual size of the data packet. The data packet is continuously written to the cache memory frame by frame with time as the index, and the data is cached in a circular overwrite manner, which can save computing power resources to a great extent, reduce the cost of data management, and avoid excessive storage space occupation and waste of resources.
[0067] It should be noted that data packet information is indexed by time and cached in memory. The data in the cache is a fixed-length queue (this parameter is configurable, with a default of 20 seconds) and is automatically overwritten over time. If an event requires recording data from m seconds before and n seconds after the occurrence, m seconds must be less than the fixed-length queue length to avoid frame loss. The cache can be updated in the following n seconds, and the data from the following n seconds can also be written to the local disk.
[0068] Specifically, data publishing and receiving usually use zmq and other publish-subscribe message queues to realize message transmission for data packet information with small data volume; data packet information with large data volume is usually divided into two parts. Large data information (for example: encoded H265 video stream) uses shared memory for data transmission, and small data information transmits the associated information of large data information (for example: H265 video stream stores the starting address and data length of shared memory, etc.), thereby realizing the sending and subscription of large data packet information; the data acquisition module subscribes to the data packet information of each module with time as the index and caches it in the memory. When the predetermined trigger condition is met (for example: collision event trigger), the data of the required time period before and after the trigger moment is taken out from the cache and written to the disk ; Taking into account the high frequency of vehicle-side data (the minimum signal cycle can be up to 10ms), the characteristics of the ZMQ publishing queue are fully utilized to increase the number of data packets in the data cache between message publishing and subscription. The data acquisition module can obtain data information periodically when subscribing to these high-frequency information. As long as the acquisition cycle is less than the total time of the cached data packets, there will be no data loss problem. For example: the sending cycle of the signal data packet is 10ms, and the number of cached data packets is 50, that is, the data acquisition cycle is set to less than 500ms; in addition, after each data subscription, the corresponding data packet cache is cleared, that is, duplicate subscription of data packets will not occur; data file saving is to read the required data information from the memory and write it to the disk, in which the format of the data file needs to be defined for parsing and use.
[0069] In an embodiment of the present application, after writing a data packet of a preset duration that meets a preset trigger condition to the vehicle's disk, it also includes: parsing the disk's data by the vehicle; and / or uploading the data stored on the disk to the cloud, and using the cloud to parse the uploaded data for data playback or scene reconstruction.
[0070] It can be understood that the embodiment of the present application parses the disk data on the vehicle side and parses the uploaded data using the cloud side to perform data playback or scene reconstruction, which can quickly locate the problem.
[0071] Specifically, end-cloud data analysis is mainly divided into vehicle-side and cloud-side analysis. For example, forward-looking videos are parsed from disk data acquisition record files and saved in MP4 format. The vehicle-side mainly uses C++ language for analysis, and the cloud can use languages such as JAVA or PYTHON. Cloud-side data viewing mainly establishes a cloud-based data management and display system with front-end and back-end architectures, and performs data playback or scene reconstruction on the front-end page, that is, when playing the video, data information can be viewed synchronously; or a virtual scene based on real data is established on the front-end page to quickly locate the problem. Data that needs to be forwarded by regulations can also be transmitted to the national or local regulatory platform in batches or in real time.
[0072] According to the vehicle data collection method proposed in the embodiment of the present application, the interface library file of each data generating object in the vehicle is defined based on a preset protocol, which can ensure clear data exchange between modules, and use the interface library file to realize data transmission between data, aggregate the data of each data generating object at the same collection time, and cache data in a data publishing and subscription manner and / or a shared memory manner. It can cache data packets of different sizes, and write data packets of the required time period before and after the trigger conditions according to actual conditions to the vehicle's disk, saving computing resources and reducing the cost of data management. The use of the preset protocol to complete the definition of data can realize mutual calling and information transmission of each module, data publishing and receiving can be cached in different ways for information of different sizes, and each module can effectively reduce data redundancy, redundancy and difficulty in maintenance of data development code, save storage space and computing resources, and reduce the cost of data management.
[0073] The following will be combined Figure 2 This paper elaborates on the vehicle data collection method, which includes data format definition, data publishing and receiving, data caching, data triggering, data file storage, end-cloud data analysis, and cloud data management. The details are as follows:
[0074] (1) Data format definition
[0075] The basis of the vehicle-side data acquisition method based on the protobuf protocol is the definition of the data format. The data format definition is to complete the interface definition of the data generated by various types of sensors and the intermediate variables generated during the operation of each software module based on the protobuf protocol, and form the relevant proto interface file. After compilation, the pb.h interface library file is generated for each module to call each other, and finally realize the information transmission between the various software modules on the vehicle side.
[0076] Among them, the proto interface file format design must meet certain naming specifications to ensure that data exchange between modules is error-free and clear, as follows:
[0077] File names are all lowercase and may include underscores. The first word is the module abbreviation, for example: fus_freespace.proto; the first letter of each word in the message name is uppercase and there cannot be underscores, for example: MyExcitingMsg; variable names are all lowercase, and words are connected by underscores, for example: a_struct_data_member; macro names are all uppercase, and words are connected by underscores, for example: MY_MACRO_THAT_SCARES_SMALL_CHILDREN; enumeration names should be consistent with constants, for example: enum Alternate Url Table Errors{OK=0, OUT_OF_MEMORY=1, MALFORMED_INPUT=2}; to prevent naming conflicts between different message types, each proto file should have a declaration symbol, for example: package tutorial; finally, comments, the proto file must include the author, modification and creation date, interpretation, etc., the most important of which is the signal interpretation.<name:[uint]、(default、min、max)、[max_number]、(factor,offset)、description> , which respectively represent <signal name: [unit], (default value, minimum value, maximum value), [repeated maximum value], (factor, offset), signal description>. Finally, these ptoto files are compiled to generate pb.h for each module to call.
[0078] (2) Data publishing and reception
[0079] The embodiment of the present application mainly adopts the zmq publish-subscribe queue protocol. The subscription topic format is designed as module name, package name and message name. The module name and package name are connected with "-", and the package name and message name are connected with ".", for example: vs_slam-common.HeartBeat.
[0080] 1) Data publishing interface design: publish(data packet, topic name), where the data packet creates an object instance, assigns values to the instance's relevant attributes (that is, assigns values to the signal), fills in the publishing topic, and then sends the data by calling the encapsulated publish method. The publish method inherits the Google serialization interface to implement data serialization and then send it.
[0081] 2) Data subscription interface design: mainly divided into event callback method and method of obtaining the latest data. The difference lies in the needs of the subscriber. In the event callback method, when a topic changes, the subscriber immediately responds to the received data, for example: bindEventCallback <netmsg>(std::bind(&adrSystem_component::onNetmngCallback,this,std::placeholders::_1,std::placeholders::_2),"netmng-netmngMsg.NetMsg"), when the netmng-netmngMsg.NetMsg topic has data to send, the receiver immediately executes the onNetmngCallback callback function with the object data (the interface has been deserialized) and the topic sending time; to obtain the latest data, there is no need to subscribe when the change is published, but the receiver can get the latest data when needed, for example: getDataLatest <packsignalproto::busvehicleinfo>(TOPIC_BUS_TBOX_TIME,&usTboxTime).
[0082] Considering that the callback method of the data acquisition and recording module is very CPU-intensive and all data needs to be obtained, this application designs an interface for caching 50 data of the same topic (multiple topics can be cached, and the number can be adjusted according to memory usage). The corresponding data is immediately cleared after consumption. When the data acquisition module subscribes, as long as the acquisition cycle is less than the minimum cycle of 50 topics, data frame loss will not occur. For example, if the minimum cycle of a topic is 10ms and the number of caches is 50, the data acquisition cycle can be less than 500ms. The interface is: getDataStructType <std::string>(topic, ×tamp), the timestamp is used to determine whether the data has been received. In addition, the subscribed data can be flexibly selected according to the template type. If it is a string, it is a serialized data packet stream. If a certain template class is filled in, the data of the corresponding proto structure is received. The former is convenient for storage, and the latter is convenient for parsing.
[0083] For large data packets, a shared memory approach is used, which is mainly suitable for data types such as encoded video streams or radar point clouds. First, the relevant information of the encoded video stream is sent based on the zmq publish-subscribe queue. One part is the camera number, coding type, width and height attributes, timestamp and serial number used to decode the video stream. The other part is used for the shared memory starting address and actual data length of the frame video encoding stream. This part is used to facilitate the acquisition of data in the shared memory. In addition, a uint32 type data field is cleverly added to read the actual stream data from the shared memory and then rewrite the data (the data in this field is ignored when publishing the message), and then all data packets are cached in the memory.
[0084] (3) Data cache design
[0085] Data cache is mainly subscribed to messages through ZMQ and stored in memory. The design format is as follows: std::multimap <double,std::shared_ptr<middata_stru> >m_midData, adopts multimap structure and timestamp as key, so that when an event occurs, the required data of the first m seconds and the last n seconds in the memory can be read according to the occurrence time of the event; middata_stru is value, and the detailed structure is as follows: typedef struct middata_stru{middata_stru(const string&topicName, const string&topicData){this->topicName=topicName;this->topicData=topicData;}stringtopicName;stringtopicData;}middata_st ru;which is the structure type containing the topic name and data.
[0086] (4) Data trigger
[0087] Data triggering mainly involves subscribing to related topics, parsing corresponding signal variables, and comprehensively judging whether the trigger conditions are met. Triggering means marking the corresponding event and obtaining the data in the memory according to the event requirements.
[0088] (5) Data file storage module
[0089] The data file of this application is mainly saved as binary .dat data, and the design is mainly as follows: it is mainly divided into two parts: file header and data set. The file header defines a structure, including three attributes: ProtoVersion (Proto interface version information), ProtoContent (Proto specific content) and Comment (comment information); the data set is divided into two parts: data header and data. The data header contains topicName name, timestamp, and data length. The data is the serialized data corresponding to the topic. A KRecorder class is designed, which includes the creation of instances such as objects (passing in the created path and file name), initializing instance objects, calling the object data recording method, and deleting the instance object after completing data recording.
[0090] (6) End-cloud data analysis module
[0091] Parsing is performed according to the file saving format. The vehicle side parses the .dat data when exporting data when the vehicle stops, avoiding the traditional practice of parsing data while the vehicle is running. When the cloud needs to view the specified .dat data, the vehicle side uses C++ language to parse it, and the cloud side uses Python language to parse it.
[0092] (7) Cloud Data Management
[0093] Cloud data management includes a cloud data viewing module, which mainly refers to data playback and scene reconstruction after .dat data parsing. After parsing the .dat data, fuzzy search can be performed according to the module name, topic name and signal name, and then viewed in the form of multiple curve graphs (time series as the horizontal axis, signal value as the vertical axis). It also supports cursor viewing and playback viewing, and the number of video frames corresponds to the actual data value. Another method is to establish scene playback based on various .dat signals, such as lane lines, adjacent vehicles, traffic signs, and vehicle operating status, so that problem analysis and scenario optimization are faster and more realistic.
[0094] In summary, the embodiment of the present application aggregates all sensors and intermediate variables of each module into one data packet, effectively avoiding redundant designs such as multiple caches and file storage for data collection. At the same time, because the protobuf protocol data format is adopted, the controller can decode the video encoding stream when the vehicle is stationary or upload it to the cloud for review before parsing it. This effectively reduces the end-cloud data transmission bandwidth, reduces the CPU load of the vehicle-side controller and the cloud storage space, and the centralized data packet structure can also reduce the vehicle-side design and development and cloud management costs.
[0095] Next, the data acquisition device for a vehicle according to an embodiment of the present application will be described with reference to the accompanying drawings.
[0096] Figure 3 It is a block diagram of a data acquisition device for a vehicle according to an embodiment of the present application.
[0097] like Figure 3 As shown, the vehicle data acquisition device 10 includes: a definition module 100 , a data transmission 200 and a cache module 300 .
[0098] Among them, the definition module 100 is used to define the interface library file of each data generating object in the vehicle using a preset protocol; the aggregation module 200 is used to realize data transmission between each data generating object using the interface library file, and aggregate the data of each data generating object at the same collection time to obtain a data packet; the cache module 300 is used to cache the data packet to the cache memory using a data publishing and subscription method and / or a shared memory method, and write the data packet of a preset time length that meets the preset trigger condition to the disk of the vehicle.
[0099] In an embodiment of the present application, the definition module 100 is further used to: define the intermediate variable interface of each data generation object in the vehicle using a preset protocol; form an interface file based on the intermediate variable interface, and compile the interface file into the interface library file.
[0100] In an embodiment of the present application, the cache module 300 is further used to: identify the data volume of the data packet; if the data volume is less than or equal to a preset threshold, cache the data packet to the cache memory through a publish-subscribe message queue, and continuously write the data packet to a preset length queue of the cache memory with time as the index; if the data volume is greater than the preset threshold, cache the associated information of the data packet to the cache memory through the publish-subscribe message queue, cache the corresponding data packet in the shared memory to the cache memory according to the associated information, and continuously write the data packet to the preset length queue of the cache memory with time as the index.
[0101] In an embodiment of the present application, the associated information includes one or more of an identifier of a data generation object, a coding type, width and height attributes, a timestamp, a shared memory start address, and an actual data length.
[0102] In an embodiment of the present application, the preset duration includes a first duration before the current moment and a second duration after the current moment, wherein the first duration is less than the length of the preset length queue, and the preset length queue caches data in a circular coverage manner.
[0103] In an embodiment of the present application, the cache module 300 is further used to: perform data parsing on the disk through the vehicle; and / or upload the data stored on the disk to the cloud, and use the cloud to perform data parsing on the uploaded data for data playback or scene reconstruction.
[0104] It should be noted that the above explanation of the embodiment of the vehicle data collection method is also applicable to the vehicle data collection device of this embodiment, and will not be repeated here.
[0105] According to the data acquisition device for a vehicle proposed in the embodiment of the present application, an interface library file for each data generating object in the vehicle is defined based on a preset protocol, which can ensure clear data exchange between modules, realize data transmission between data by using the interface library file, aggregate data of each data generating object at the same acquisition moment, cache data by using data publishing and subscription and / or shared memory, cache data packets of different sizes, and write data packets of the required time period before and after the triggering conditions to the vehicle's disk according to actual conditions, saving computing resources and reducing the cost of data management. The definition of data completed by using a preset protocol can realize mutual calling and information transmission of each module, data publishing and receiving can be cached in different ways for information of different sizes, each module can effectively reduce data redundancy, redundancy and difficulty in maintenance of data development code, save storage space and computing resources, and reduce the cost of data management.
[0106] Figure 4 A schematic diagram of the structure of a vehicle provided in an embodiment of the present application. The vehicle may include:
[0107] Memory 401 , processor 402 , and computer programs stored in the memory 401 and executable on the processor 402 .
[0108] When the processor 402 executes the program, the vehicle data collection method provided in the above embodiment is implemented.
[0109] Furthermore, the vehicle further comprises:
[0110] The communication interface 403 is used for communication between the memory 401 and the processor 402 .
[0111] The memory 401 is used to store computer programs that can be run on the processor 402 .
[0112] The memory 401 may include a high-speed RAM (Random Access Memory) memory, and may also include a non-volatile memory, such as at least one disk memory.
[0113] If the memory 401, the processor 402, and the communication interface 403 are implemented independently, the communication interface 403, the memory 401, and the processor 402 can be connected to each other via a bus and communicate with each other. The bus can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0114] Optionally, in a specific implementation, if the memory 401, the processor 402 and the communication interface 403 are integrated on a chip, the memory 401, the processor 402 and the communication interface 403 can communicate with each other through an internal interface.
[0115] The processor 402 may be a CPU (Central Processing Unit), or an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application.
[0116] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon, which implements the above-mentioned vehicle data collection method when executed by a processor.
[0117] In the description of this specification, the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" mean that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.
[0118] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features being referred to. Thus, a feature specified as "first" or "second" may explicitly or implicitly include at least one such feature. Throughout the description of this application, "N" means at least two, for example, two, three, etc., unless otherwise specifically defined.
[0119] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or N executable instructions for implementing a custom logical function or process step, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may be performed in a different order than shown or discussed, including performing functions in a substantially simultaneous manner or in a reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present application pertain.
[0120] It should be understood that various parts of the present application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiment, the N steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array, a field programmable gate array, etc.
[0121] Those skilled in the art will understand that all or part of the steps in the method of the above embodiment can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiment.
[0122] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.< / std::string> < / packsignalproto::busvehicleinfo> < / netmsg>
Claims
1. A vehicle data collection method, characterized in that: The following steps are involved: An interface library file defining each data generation object in the vehicle using a preset protocol; The interface library file is used to realize data transmission between the data generating objects, and the data of the data generating objects at the same collection time are collected to obtain a data packet; caching the data packets to a cache memory using a data publishing and subscription method and / or a shared memory method, and writing data packets of a preset time length that meet a preset trigger condition to a disk of the vehicle; The method of caching the data packet into the cache memory by adopting a data publishing and subscription method and / or a shared memory method includes: Identifying the data volume of the data packet; If the data volume is less than or equal to a preset threshold, the data packet is cached to the cache memory through a publish-subscribe message queue, and the data packet is continuously written into a queue of a preset length in the cache memory with time as an index; If the data volume is greater than the preset threshold, the associated information of the data packet is cached to the cache memory through the publish-subscribe message queue, the corresponding data packet in the shared memory is cached to the cache memory according to the associated information, and the data packet is continuously written into the preset length queue of the cache memory with time as the index.
2. The vehicle data collection method according to claim 1, characterized in that: The associated information includes one or more of an identifier of a data generating object, a coding type, width and height attributes, a timestamp, a shared memory start address, and an actual data length.
3. The vehicle data collection method according to claim 1, characterized in that: The preset duration includes a first duration before the current moment and a second duration after the current moment, wherein the first duration is less than the length of the preset length queue, and the preset length queue caches data in a circular coverage manner.
4. The vehicle data collection method according to claim 1, characterized in that: After writing the data packet of the preset time length that meets the preset trigger condition to the disk of the vehicle, the method further includes: parsing the disk's data using the vehicle; And / or, uploading the data stored on the disk to the cloud, and utilizing the cloud to perform data analysis on the uploaded data for data playback or scene reconstruction.
5. The vehicle data collection method according to claim 1, characterized in that: The interface library file for defining each data generation object in the vehicle using a preset protocol includes: Use the preset protocol to define the intermediate variable interface of each data generating object in the vehicle; An interface file is formed based on the intermediate variable interface, and the interface file is compiled into the interface library file.
6. The vehicle data collection method according to any one of claims 1 to 5, characterized in that: The preset protocol is the protobuf protocol.
7. A vehicle data acquisition device, characterized in that: include: A definition module, used to define the interface library file of each data generation object in the vehicle using a preset protocol; an aggregation module, configured to implement data transfer between the data generating objects by using the interface library file, and to aggregate the data of the data generating objects at the same collection time to obtain a data packet; a cache module, configured to cache the data packets in a cache memory using a data publishing and subscription method and / or a shared memory method, and write a preset number of data packets in the cache memory that meet a preset storage condition to a disk of the vehicle when a preset trigger condition or collection period is met; The cache module is specifically used for: Identifying the data volume of the data packet; If the data volume is less than or equal to a preset threshold, the data packet is cached to the cache memory through a publish-subscribe message queue, and the data packet is continuously written into a queue of a preset length in the cache memory with time as an index; If the data volume is greater than the preset threshold, the associated information of the data packet is cached to the cache memory through the publish-subscribe message queue, the corresponding data packet in the shared memory is cached to the cache memory according to the associated information, and the data packet is continuously written into the preset length queue of the cache memory with time as the index.
8. A vehicle, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the vehicle data collection method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the vehicle data collection method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method and system for establishing unmanned driving database
CN108052564A
Engineering data center for integration
CN110599124A