Automatic driving test method and system based on CAN message cycle monitoring
By using the Pandas function library to process CAN packets and test parameters, the problems of poor monitoring compatibility and low analysis efficiency in the existing technology are solved, efficient and fast autonomous driving testing is achieved, and the test efficiency and report readability are improved.
Patent Information
- Application Number
- CN202111448661.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-30
- Publication Date
- 2025-05-09
- Estimated Expiration
- 2041-11-30
AI Technical Summary
In the prior art, CAN message monitoring has problems such as poor compatibility and low analysis efficiency, which is difficult to meet the efficient and fast testing needs of autonomous driving domain controllers.
The Pandas function library-based method is used to process CAN packets and test parameters. By obtaining, checking and calculating the CAN packet cycle, it can quickly locate and output test results, and improve the efficiency of autonomous driving tests.
It effectively improves the efficiency of autonomous driving testing, especially centralized testing in fixed CAN paths, simplifies the CAN message analysis process, supports multiple CAN message inspection and multiple format CAN message detection, and improves the readability and rapid issuance of test reports.
Smart Images

Figure CN114414255B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of autonomous driving technology, and in particular to an autonomous driving test method and system based on CAN message cycle monitoring. Background Art
[0002] CAN (Controller Area Network) messages are frames that send data from a sending unit to a receiving unit. Generally speaking, CAN messages in vehicle systems are hexadecimal messages received on CAN lines (internal CAN, vehicle CAN, charging CAN) using ECUs and CAN cards.
[0003] During the autonomous driving test, CAN messages can be used as the basis for verifying the test results. However, the autonomous driving domain controller has the characteristics of short software development iteration cycle and fast version update. Compared with traditional controllers, the autonomous driving domain controller needs to form a system with multiple controllers to control the vehicle. Therefore, the CAN message monitoring of the autonomous driving domain controller needs to be efficient, fast, and the test report readability is highly required.
[0004] In the prior art, CAN message monitoring is usually performed based on commercial CAN message parsing tools. Due to the different output formats of mainstream commercial CAN message parsing tools, the compatibility between different tools is poor. At the same time, the process in which test engineers issue test reports based on the output analysis of CAN message parsing tools also has the problem of low analysis efficiency.
[0005] Therefore, how to provide a more efficient and faster autonomous driving testing method and system has become a technical problem that needs to be urgently solved in the industry. Summary of the invention
[0006] The present invention provides an automatic driving test method and system based on CAN message cycle monitoring, which are used to solve the defects of poor compatibility between different tools and low analysis efficiency in the prior art, and realize efficient and rapid automatic driving test.
[0007] The present invention provides an automatic driving test method based on CAN message cycle monitoring, comprising:
[0008] Determine test parameters according to the requirements of the autonomous driving test, and obtain test CAN messages through the vehicle of the autonomous driving test;
[0009] Checking the test parameter in the test CAN message to obtain a first result; the first result includes a message type result of the test parameter;
[0010] If it is determined that the message type of the test parameter is a periodic message, the actual period of the test parameter in the test CAN message is calculated, and a second result is obtained according to the test parameter, the expected period of the test parameter, and the actual period.
[0011] According to an automatic driving test method based on CAN message cycle monitoring provided by the present invention, the step of determining test parameters according to the requirements of the automatic driving test and obtaining the test CAN message through the vehicle of the automatic driving test includes:
[0012] Process the test requirement data CAN Matrix based on the Pandas function library to obtain a test parameter set in DataFrame format;
[0013] Obtain raw CAN messages in ASCII format through the autonomous driving test vehicle;
[0014] The original CAN message is processed based on the Pandas function library to obtain a test CAN message in DataFrame format.
[0015] According to an automatic driving test method based on CAN message cycle monitoring provided by the present invention, the step of processing the test requirement data CAN Matrix based on the Pandas function library to obtain a test parameter set in DataFrame format includes:
[0016] The test requirement data CAN Matrix is read through the Pandas function library, and the first data segment separated by columns and in DataFrame format is obtained after parsing the index;
[0017] Excluding the first data segment that meets the first condition, to obtain a test parameter set;
[0018] The first condition refers to that the first data segment is CAN signal information.
[0019] According to an automatic driving test method based on CAN message cycle monitoring provided by the present invention, the step of processing the original CAN message based on the Pandas function library to obtain a test CAN message in DataFrame format includes:
[0020] The original CAN message is read through the Pandas function library to obtain a second data segment separated by columns in a DataFrame format;
[0021] Extracting the second data segment that meets the second condition to obtain a test CAN message;
[0022] The second condition means that the second data segment is a timestamp, a channel number, a message identifier, a sending and receiving direction, or a data segment byte.
[0023] According to an automatic driving test method based on CAN message cycle monitoring provided by the present invention, the step of checking the test parameter in the test CAN message to obtain a first result includes:
[0024] If it is determined that the parameter group number does not exist in the first message identifier set, then a judgment is made:
[0025] If the second message identifier exists in the first message identifier set, and the message type corresponding to the second message identifier is a periodic type, a first result is obtained: the message corresponding to the test parameter exists, and is a periodic non-J1939CAN message;
[0026] If the second message identifier exists in the first message identifier set, and the message type corresponding to the second message identifier is an event type, a first result is obtained: the message corresponding to the test parameter exists, and is an event type non-J1939CAN message;
[0027] If the second message identifier does not exist in the first message identifier set, and the message type corresponding to the second message identifier is a periodic type, a first result is obtained: the message corresponding to the test parameter does not exist, and is a periodic non-J1939CAN message;
[0028] If the second message identifier does not exist in the first message identifier set, and the message type corresponding to the second message identifier is an event type, a first result is obtained: the message corresponding to the test parameter does not exist, and is an event type non-J1939CAN message;
[0029] The first message identifier is a message identifier in the test CAN message; the second message identifier is a message identifier corresponding one-to-one to the test parameter.
[0030] According to an automatic driving test method based on CAN message cycle monitoring provided by the present invention, the step of checking the test parameter in the test CAN message to obtain a first result includes:
[0031] If it is determined that the parameter group number exists in the first message identifier set, a judgment is made:
[0032] If the second parameter group number exists in the first parameter group number set, and the message type corresponding to the second parameter group number is periodic, then the first result is that the message corresponding to the test parameter exists and is a periodic J1939 CAN message;
[0033] If the second parameter group number exists in the first parameter group number set, and the message type corresponding to the second parameter group number is an event type, then the first result is that the message corresponding to the test parameter exists and is an event type J1939CAN message;
[0034] If the second parameter group number does not exist in the first parameter group number set, and the message type corresponding to the second parameter group number is a periodic type, then the first result is that the message corresponding to the test parameter does not exist and is a periodic J1939 CAN message;
[0035] If the second parameter group number does not exist in the first parameter group number set, and the message type corresponding to the second parameter group number is an event type, then the first result is that the message corresponding to the test parameter does not exist and is an event type J1939CAN message;
[0036] The first parameter group label is the parameter group label in the first message identifier, and the first message identifier is the message identifier in the test CAN message; the second parameter group label is the parameter group label in the second message identifier, and the second message identifier is a message identifier corresponding one-to-one to the test parameter.
[0037] The present invention also provides an automatic driving test system based on CAN message cycle monitoring, comprising:
[0038] An acquisition module, used to determine test parameters according to the requirements of the autonomous driving test, and acquire a test CAN message through the vehicle of the autonomous driving test;
[0039] A checking module, used for checking the test parameter in the test CAN message to obtain a first result; the first result includes a message type result of the test parameter;
[0040] The period module is used to determine that the message type of the test parameter is a periodic message, calculate the actual period of the test parameter in the test CAN message, and obtain a second result based on the test parameter, the expected period of the test parameter and the actual period.
[0041] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the autonomous driving test method based on CAN message cycle monitoring as described in any one of the above are implemented.
[0042] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the automatic driving test method based on CAN message cycle monitoring as described in any of the above are implemented.
[0043] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of any of the above-mentioned automatic driving test methods based on CAN message cycle monitoring.
[0044] The automatic driving test method and system based on CAN message cycle monitoring provided by the present invention can quickly locate the test parameters by testing CAN messages and test parameters determined according to the needs of the automatic driving test, and correspondingly output the monitoring results of the test parameters in the test CAN messages, thereby effectively improving the efficiency of automatic driving tests, especially the centralized testing in fixed CAN paths; at the same time, by introducing the calculation of periodic messages, it can provide the parameter cycle results commonly used in automatic driving tests, further simplifying the CAN message analysis process, and providing a good foundation for the efficient and rapid issuance of test reports. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0046] Figure 1 It is a flow chart of an automatic driving test method based on CAN message cycle monitoring provided by the present invention;
[0047] Figure 2 It is a schematic diagram of the CAN message ID detection principle provided by an embodiment of the present invention;
[0048] Figure 3 It is a schematic diagram of a non-J1939 CAN message parsing process provided by an embodiment of the present invention;
[0049] Figure 4 It is a schematic diagram of a J1939 CAN message parsing process provided by an embodiment of the present invention;
[0050] Figure 5 is a schematic diagram of a test report provided by an embodiment of the present invention;
[0051] Figure 6 is a schematic diagram of the structure of an electronic device provided by the present invention;
[0052] Figure 7 It is a structural schematic diagram of an automatic driving test system based on CAN message cycle monitoring provided by the present invention.
[0053] Reference numerals:
[0054] 1: Acquisition module; 2: Check module; 3: Cycle module;
[0055] 610: processor; 620: communication interface; 630: memory;
[0056] 640: Communication bus. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0058] Combine the following Figure 1-Figure 5 The present invention describes an automatic driving test method based on CAN message cycle monitoring.
[0059] like Figure 1 As shown, an embodiment of the present invention provides an automatic driving test method based on CAN message cycle monitoring, comprising:
[0060] Step 102, determining test parameters according to the requirements of the autonomous driving test, and obtaining a test CAN message through the vehicle of the autonomous driving test;
[0061] Step 104, checking the test parameter in the test CAN message to obtain a first result; the first result includes a message type result of the test parameter;
[0062] Step 106, if it is determined that the message type of the test parameter is a periodic message, the actual period of the test parameter in the test CAN message is calculated, and a second result is obtained according to the test parameter, the expected period of the test parameter, and the actual period.
[0063] In step 104 of this embodiment, if the result of checking the test parameter in the test CAN message is that the test parameter does not exist, then the first result is that the test parameter does not exist in the test CAN message.
[0064] Step 106 is performed for periodic messages, and the processing of non-periodic event messages will be reflected in subsequent embodiments.
[0065] In a preferred implementation, the execution premise of step 106 is that the test CAN message is a J1939 CAN message.
[0066] The beneficial effects of this embodiment are:
[0067] By testing CAN messages and determining test parameters based on the needs of autonomous driving tests, the test parameters can be quickly located, and the monitoring results of the test parameters in the test CAN messages can be output accordingly, which effectively improves the efficiency of autonomous driving tests, especially centralized testing in fixed CAN paths;
[0068] At the same time, by introducing the calculation of periodic messages, the parameter cycle results commonly used in autonomous driving tests can be given, which further simplifies the CAN message analysis process and provides a good foundation for the efficient and rapid issuance of test reports.
[0069] According to the above embodiment, in this embodiment:
[0070] The step of determining the test parameters according to the requirements of the autonomous driving test and obtaining the test CAN message through the vehicle of the autonomous driving test includes:
[0071] Process the test requirement data CAN Matrix based on the Pandas function library to obtain a test parameter set in DataFrame format;
[0072] In a preferred embodiment, the test parameter set in DataFrame format is obtained after data cleaning and reconstruction.
[0073] Obtain raw CAN messages in ASCII format through the autonomous driving test vehicle;
[0074] The original CAN message is processed based on the Pandas function library to obtain a test CAN message in DataFrame format.
[0075] In a preferred embodiment, the test CAN message in DataFrame format is obtained after data cleaning and reconstruction.
[0076] The step of processing the test requirement data CAN Matrix based on the Pandas function library to obtain a test parameter set in DataFrame format includes:
[0077] The test requirement data CAN Matrix is read through the Pandas function library, and the first data segment separated by columns and in DataFrame format is obtained after parsing the index;
[0078] Excluding the first data segment that meets the first condition, to obtain a test parameter set;
[0079] The first condition refers to that the first data segment is CAN signal information.
[0080] In a preferred implementation, it is also necessary to remove invalid information from the first data segment, standardize the string writing format, and process abnormal values.
[0081] In a preferred embodiment, the CAN signal information refers to non-CAN message information, that is, the test requirement data CAN Matrix consists of CAN signal information and CAN message information.
[0082] The step of processing the original CAN message based on the Pandas function library to obtain a test CAN message in DataFrame format includes:
[0083] The original CAN message is read through the Pandas function library to obtain a second data segment separated by columns in a DataFrame format;
[0084] Extracting the second data segment that meets the second condition to obtain a test CAN message;
[0085] The second condition means that the second data segment is a timestamp, a channel number, a message identifier, a sending and receiving direction, or a data segment byte.
[0086] In a preferred implementation, it is also necessary to remove invalid information, standardize the string writing format, and process abnormal values for the second data segment.
[0087] The beneficial effects of this embodiment are:
[0088] The CAN messages and CANMatrix are processed by the Pandas library (for example, the Pandas library in the Python language), which has higher parsing efficiency than other CAN message processing tools such as MATLAB and LabVIEW.
[0089] It is worth noting that the parsing of CAN messages in the prior art is often performed based on commercial tools. On the basis of providing a general CAN message parsing method, being able to discover the difference in CAN message parsing efficiency itself requires creative work by technical personnel in this field. That is to say, this embodiment is based on providing a general CAN message parsing method, and further considers the issue of parsing efficiency.
[0090] According to any of the above embodiments, in this embodiment:
[0091] The step of checking the test parameter in the test CAN message to obtain the first result includes a sub-step of checking the non-J1939 CAN message (i.e., the ordinary CAN message), specifically:
[0092] If it is determined that the parameter group number does not exist in the first message identifier set, then a judgment is made:
[0093] If the second message identifier exists in the first message identifier set, and the message type corresponding to the second message identifier is a periodic type, a first result is obtained: the message corresponding to the test parameter exists, and is a periodic non-J1939CAN message;
[0094] If the second message identifier exists in the first message identifier set, and the message type corresponding to the second message identifier is an event type, a first result is obtained: the message corresponding to the test parameter exists, and is an event type non-J1939CAN message;
[0095] If the second message identifier does not exist in the first message identifier set, and the message type corresponding to the second message identifier is a periodic type, a first result is obtained: the message corresponding to the test parameter does not exist, and is a periodic non-J1939CAN message;
[0096] If the second message identifier does not exist in the first message identifier set, and the message type corresponding to the second message identifier is an event type, a first result is obtained: the message corresponding to the test parameter does not exist, and is an event type non-J1939CAN message;
[0097] The first message identifier is a message identifier in the test CAN message; the second message identifier is a message identifier corresponding one-to-one to the test parameter.
[0098] In particular, for periodic messages, a judgment can be performed to determine whether the CAN message is an abnormal frame that is sent only once. For abnormal frames, the abnormal frame result can be directly output; for non-abnormal frames, the subsequent period calculation step (i.e., obtaining the second result) is continued.
[0099] The step of checking the test parameters in the test CAN message to obtain a first result also includes a sub-step of checking the J1939 CAN message.
[0100] In particular, for J1939CAN messages, i.e. long-frame CAN messages, it is also necessary to consider whether the J1939CAN message is a single-frame message in a long-frame format. Therefore, if the length of the J1939CAN message is less than or equal to 8 (generally speaking, the length of a single-frame message is equal to 8, so the message with a length less than 8 can be cleaned and no subsequent processes are executed), it is determined that the J1939CAN message is a single-frame message in a long-frame format. The output of the first result can refer to the above judgment process for non-J1939CAN messages; if the length of the J1939CAN message is greater than 8, then:
[0101] If it is determined that the parameter group number exists in the first message identifier set, a judgment is made:
[0102] If the second parameter group number exists in the first parameter group number set, and the message type corresponding to the second parameter group number is periodic, then the first result is that the message corresponding to the test parameter exists and is a periodic J1939 CAN message;
[0103] If the second parameter group number exists in the first parameter group number set, and the message type corresponding to the second parameter group number is an event type, then the first result is that the message corresponding to the test parameter exists and is an event type J1939CAN message;
[0104] If the second parameter group number does not exist in the first parameter group number set, and the message type corresponding to the second parameter group number is a periodic type, then the first result is that the message corresponding to the test parameter does not exist and is a periodic J1939 CAN message;
[0105] If the second parameter group number does not exist in the first parameter group number set, and the message type corresponding to the second parameter group number is an event type, then the first result is that the message corresponding to the test parameter does not exist and is an event type J1939CAN message;
[0106] The first parameter group label is the parameter group label in the first message identifier, and the first message identifier is the message identifier in the test CAN message; the second parameter group label is the parameter group label in the second message identifier, and the second message identifier is a message identifier corresponding one-to-one to the test parameter.
[0107] The beneficial effects of this embodiment are:
[0108] Similar to the previous embodiment, this embodiment, on the basis of providing a general CAN message parsing method, further takes into account the characteristics of CAN messages of autonomous driving vehicles, such as multiple sending channels, mixed sending of J1939CAN messages and ordinary CAN messages, and coexistence of single-frame messages and multi-frame messages. Due to the above problems, the whole vehicle CAN message test for autonomous driving vehicles has difficulties such as high complexity, large number, and inconsistent judgment criteria for different messages. Being able to discover these problems itself requires creative labor from technical personnel in this field.
[0109] This embodiment provides a solution for the above problem of distinguishing J1939 CAN messages from ordinary CAN messages so as to perform different processing, thereby avoiding the shortcomings of low efficiency and high misjudgment rate in manual detection, and making the analysis efficiency higher during testing.
[0110] According to any of the above embodiments, in this embodiment:
[0111] First, the relevant background of this embodiment is described.
[0112] Compared with traditional vehicles, trucks equipped with autonomous driving domain controllers are highly complex, with many CAN message sending and receiving nodes in design and multiple CAN formats (J1939 and ordinary CAN). Due to these problems, the CAN network test of autonomous driving trucks has problems such as low test efficiency, complex test items, and inability to accurately obtain CAN cycle error results during manual testing.
[0113] Since the CAN signals of self-driving trucks transmit key information of each ECU in the self-driving system, testers often need to draw charts of the signals when performing data analysis and check whether specific ID messages appear according to DBC files or CAN matrix files.
[0114] The mainstream CAN message detection tools on the market currently have the function of saving CAN signals in ASCII format, but traditional computer languages such as C and C++ cannot efficiently process data in ASCII files.
[0115] Currently, mainstream CAN message analysis tools do not have the function of vehicle inspection for CAN messages, that is, to detect whether all CAN messages appear on the CAN path; the detection of CAN cycles cannot quickly prompt users whether there is frame loss; when users analyze data offline, they cannot quickly locate the problem, and manual identification and calculation of cycle errors are required, which is inefficient.
[0116] After completing the inspection test, the test engineer needs to issue a test report for the corresponding test to reflect the problems of the test items. For the CAN message inspection test, the problem types in the test report can be divided into fixed types. Due to this feature, the CAN message inspection test report can be automatically generated.
[0117] After manually calculating the results, they need to be converted into an Excel or Word version of the report. Reports written by engineers themselves are inefficient, prone to errors, and have low coverage.
[0118] There are two common solutions in the prior art:
[0119] 1. Use the mainstream CAN detection tools on the market to record all messages on the CAN road of the vehicle, and then use manual calculations to determine whether the key ID appears. Use the CAN tool's built-in chart drawing function to observe whether the message cycle exceeds the specified limit.
[0120] 2. Calculate key signals through software such as Excel, and then write the results into the test report.
[0121] This embodiment adopts the following distinguishing means:
[0122] 1. The CAN message input file is ASCII. Currently, all mainstream CAN parsing tools support this format, breaking through tool limitations and supporting CAN message data recorded by multiple tools.
[0123] 2. Using the pandas library function in Python language, you can effectively process CAN signals with huge amounts of data (compared to Python programs that do not use Pandas, the processing speed is increased by 10 times).
[0124] 3. It can support automatic report generation in Excel format, with the CAN message sending type (periodic, event type), the average cycle and maximum cycle of the CAN message in ASCII, and determine whether the message cycle does not meet expectations based on the error criteria specified by the customer.
[0125] 4. Support multi-channel CAN message inspection and support various formats of CAN messages (J1939, ordinary CAN).
[0126] Therefore, this embodiment has the following beneficial effects:
[0127] 1. Aiming at the testing needs of on-site diagnostic engineers, fast and efficient CAN message detection is achieved;
[0128] 2. Automatic monitoring of multiple CAN channels reduces software configuration time and facilitates centralized testing in fixed CAN channels;
[0129] 3. Generate a highly readable test report for errors in CAN message sending, with information such as the average cycle error and maximum cycle error of the corresponding CAN signal, so that test engineers can easily determine whether there are errors in the message cycle;
[0130] 4. Supports periodic type, event type; detection of ordinary CAN messages and J1939 multi-frame messages, and comes with corresponding instructions for easy reading by users.
[0131] That is to say, this embodiment involves automatic monitoring and cycle calculation of CAN messages and evaluation of message sending cycles, which is one of the important contents in vehicle controller testing. This embodiment innovatively uses the python language to process a large amount of CAN message raw data, improves processing efficiency, and allows users to get rid of the limitations of traditional CAN message parsing tools, and makes special processing for key information of CAN message testing, such as the calculation of average error and maximum error, so that CAN message sending errors that cannot be quickly judged using traditional CAN tools, such as frame loss, repeated transmission, etc., are marked; this embodiment also makes judgments on J1939 multi-frame messages, allowing users to quickly locate this type of message.
[0132] The specific scheme of this embodiment will be described below.
[0133] The input file of this embodiment is an ASCII file, which can be generated by a CAN message parsing tool. Currently, mainstream CAN parsing tools on the market support recording CAN messages in ASCII files. Hereinafter, ASCII file refers to an ASCII file that records CAN message information. The ASCII file contains the following information: timestamp, message identifier (Msg_ID), specified channel in the CAN message parsing tool, CAN message data field, and CAN message sending and receiving direction.
[0134] This embodiment uses the CAN matrix file, which is used as a guidance file when generating the CAN message parsing file DBC, as an input of the program. In this file, the following information of the CAN message is defined: message name (MSg_Name), message type (Msg_Type), message identifier (Msg_ID), parameter group number (PGN), message sending type (Msg_send_Type), message sending cycle (Msg_Cycle_time) and other information. This information will be used as the basis for parsing and performing data parsing on the ASCII file containing the original information of the CAN message.
[0135] The CAN message processing process of this embodiment can be performed by Figure 2 It is explained that in the process, the data processing process can be divided into two processes: ASCII file (i.e. test CAN message) data processing and Excel file (i.e. test parameters / CAN Matrix) data processing. Among them, ASCII files have the characteristics of large data volume and complex structure, which is the main difficulty of data processing. This embodiment uses the Dataframe data structure of the Python data processing library function Pandas to read the ASCII file and save it in Dataframe format. This format does not require traversal to obtain information that the specified row and column contain the specified value, thereby improving the program processing efficiency. For the excel file containing the CAN Matrix, it is necessary to unify the irregular writing when defining the CAN Matrix file and convert it into a unified writing format.
[0136] After reconstructing the ASCII file and the CAN Matrix file, this embodiment performs data processing on them. After obtaining the data processing result, the information defined in the original CAN Matrix, the message name (MSg_Name), the message type (Msg_Type), the message identifier (Msg_ID), the parameter group number (PGN), the message sending type (Msg_send_Type), and the message sending cycle (Msg_Cycle_time) are retained, and the data processing results, the average cycle error (period_error_average), the average cycle error percentage (period_error_average_percentage), the maximum cycle error (period_error_max), the maximum cycle error percentage (period_error_max_percentage), whether the message appears in the ASCII file (ID_appear_in_ASCII), the final test result (test result), and the test result comment (comment), are saved in the CAN ID detection report: ID_Apperance_check_result.
[0137] The following will follow Figure 2 The flowchart sequence is used to introduce the main process of data processing in CAN detection. According to the implementation process of the python script, it can be divided into the following steps: CAN message data reading and data cleaning; CAN Matrix reading and data cleaning; data processing for J1939 messages; data processing for ordinary CAN messages; merging the test results output and importing them into excel files.
[0138] The key point of reading and cleaning CAN message data is to efficiently read ASCII and convert it into an array structure that can be processed by subsequent programs. For this requirement, the Pandas function library can efficiently process large amounts of ASCII files. After reading the data, the data needs to be scattered. This process is to separate the read data by column for data processing. ASCII also contains some information that is useless for data processing. This part of information is usually the operation information of the CAN message, some header information, etc., which needs to be removed. After completing the above steps, a data segment in the DataFrame format separated by columns according to the requirements will be obtained. In this data segment, columns that are useful for the subsequent processing need to be extracted. These columns include: timestamp (time), channel number (channel), message identifier (Msg_ID), transceiver direction (Orient), data segment bytes 1-8 (byte1-8). After all processing is completed, the ASCII data reading and data cleaning work has been completed, and the output result can be directly used as the input of the subsequent data processing program segment.
[0139] The data reading and data cleaning of CAN Matrix data mainly targets the parsing index information of CAN messages. Since CAN Matrix contains CAN message information and CAN signal information, in this invention, CAN signal data is invalid input, and it is necessary to remove these signals and filter the necessary information for data parsing of ASCII files. This information can be divided into two types:
[0140] The first type is used in subsequent reports to only describe the CAN message information. It does not play a practical role in the program and is used to facilitate user reading, such as: message name (MSg_Name), message type (Msg_Type), message sending type (Msg_send_Type), each message sending and receiving node, etc.
[0141] Another type of information will serve as a guide in data processing, such as a message identifier (Msg_ID), a parameter group number (PGN), a message transmission cycle (Msg_Cycle_time), etc.;
[0142] After data cleaning, these two signals will be combined to generate a Dataframe type structure and output to subsequent programs for processing.
[0143] After completing the data processing of the above two output files, the CAN message detection work can be started. When designing the parsing script, this embodiment distinguishes CAN messages into J1939CAN and ordinary CAN messages. The reason is that compared with ordinary CAN messages, the message identifier (Msg_ID) of J1939CAN includes the parameter group number (PGN). Compared with ordinary CAN messages, when parsing, if a multi-packet message, that is, a J1939 long frame, is sent, the parameter group number (PGN) will need to be used for identification, while ordinary CAN messages only need to be identified by the message identifier (Msg_ID).
[0144] In this embodiment, the parsing process for ordinary CAN messages (i.e. non-J1939 CAN messages) is as follows: Figure 3 After reconstructing the CAN matrix and ASCII files, all message identifiers (Msg_ID) in the CAN matrix are observed to determine whether they are in the ID that appears in the ASCII. In addition, the data processing script distinguishes between periodic messages and event messages. In vehicle testing, event messages are usually responsible for the transmission of DTC or long data, and are the key observation items of message detection. Judgment during data processing helps users to distinguish them easily when reading reports.
[0145] In this embodiment, the J1939CAN message parsing process is as follows Figure 4 As shown. Compared with the analysis of ordinary CAN messages, J1939CAN messages need more than just the message identifier (Msg_ID) as a reference for detection in ASCII due to the existence of J1939 long frames. Long frames use the parameter group number (PGN) as a reference for detection. In the actual test process, there is a situation where only one frame is triggered in a long frame, and the calculation cycle must have at least 2 frames. This situation will cause the program to report an error. Due to the above reasons, it is necessary to determine the long frame cycle.
[0146] After completing the above processing, the output results will be merged with the information that the test engineer needs to read in the CAN matrix, and finally exported to generate an Excel file. The information contained in the final output report is as follows: Figure 5 shown.
[0147] This embodiment provides a CAN message detection tool for vehicle CAN message detection and CAN message cycle offline analysis, and can distinguish J1939CAN messages from ordinary CAN messages, so as to perform different processing, avoiding the shortcomings of low efficiency and high misjudgment rate in manual detection. This embodiment introduces the data processing library function Pandas in Python to process CAN message data. In view of the large storage capacity of CAN message record files and the problem of inconsistent data structure in daily testing, data cleaning, merging and other operations are adopted. After data processing, periodic detection is performed on messages with different IDs. In this process, whether the message is sent according to the specified period is analyzed, and the average error and maximum error are calculated to determine whether the message has frame loss, repeated transmission and other problems. This embodiment has been used in CAN message spot inspection tests for multiple projects, which improves the work efficiency of test engineers, and generates highly readable test reports based on the needs of test engineers.
[0148] The beneficial effects of this embodiment will be described below from a comparative perspective.
[0149] The test requirements of this embodiment are as follows:
[0150] During the integration test of the autonomous driving vehicle, it is necessary to confirm that the messages sent by the CAN message nodes comply with the CAN matrix definition. The focus is on whether the CAN message cycle meets the definition requirements, whether the CAN message frame is lost, whether the average cycle error of the CAN message is less than the criterion, whether the maximum cycle error of the CAN message is less than the criterion, etc.
[0151] The test requirement data of this embodiment:
[0152] In this embodiment, the attributes of the CAN message obtained in the CAN matrix are: the specified period of the message, the specified transmission type of the CAN message (periodic type, event type), the message length (DLC), where the message with DLC>8 will be classified as a long frame message, and the message identifier (ID)
[0153] The reasons why existing methods cannot obtain / directly acquire the required data:
[0154] The existing method can use CAN message analysis tools to conduct real-time observation and data review, but it cannot effectively calculate and count the CAN messages within the specified time, whether the CAN message cycle meets the definition requirements, whether the CAN message is frame lost, whether the average cycle error of the CAN message is less than the criterion, whether the maximum cycle error of the CAN message is less than the criterion, etc., and give a test report, because these data need to be analyzed and counted offline.
[0155] The reason why the application in this embodiment can be obtained is:
[0156] This embodiment innovatively uses the advantage of the python pandas library for efficient data processing to process large amounts of offline data used for vehicle integration testing, calculates the real cycle of the message specified in each CAN matrix message in the ascii file, and counts the average cycle, maximum cycle, and whether there is frame loss, and screens different types of cycles according to the CAN matrix for differentiated processing.
[0157] The sending node is determined through the definition in the CAN matrix. If there is a problem with the CAN message reception or transmission, it is convenient for testers to directly locate the problematic ECU node.
[0158] The innovation of this embodiment is also reflected in that it can identify J1939 long frames and filter them from ASCII files by PGN instead of ID.
[0159] The following is a description of the autonomous driving test device based on CAN message cycle monitoring provided by the present invention. The autonomous driving test device based on CAN message cycle monitoring described below and the autonomous driving test method based on CAN message cycle monitoring described above can be referenced to each other.
[0160] An embodiment of the present invention provides an automatic driving test system based on CAN message cycle monitoring, comprising:
[0161] An acquisition module 1 is used to determine test parameters according to the requirements of the autonomous driving test, and obtain a test CAN message through the vehicle of the autonomous driving test;
[0162] Checking module 2, used for checking the test parameter in the test CAN message to obtain a first result; the first result includes a message type result of the test parameter;
[0163] The period module 3 is used to determine that the message type of the test parameter is a periodic message, calculate the actual period of the test parameter in the test CAN message, and obtain a second result based on the test parameter, the expected period of the test parameter and the actual period.
[0164] The acquisition module 1 comprises:
[0165] The test parameter submodule is used to process the test requirement data CAN Matrix based on the Pandas function library to obtain a test parameter set in DataFrame format;
[0166] The raw message submodule is used to obtain the raw CAN messages in ASCII format through the autonomous driving test vehicle;
[0167] The test message submodule is used to process the original CAN message based on the Pandas function library to obtain a test CAN message in a DataFrame format.
[0168] The test parameter submodule includes:
[0169] A first reading unit is used to read the test requirement data CAN Matrix through a Pandas function library, and obtain a first data segment separated by columns and in a DataFrame format after parsing the index;
[0170] an excluding unit, configured to exclude a first data segment satisfying a first condition to obtain a test parameter set;
[0171] The first condition refers to that the first data segment is CAN signal information.
[0172] The test message submodule includes:
[0173] A second reading unit is used to read the original CAN message through a Pandas function library to obtain a second data segment separated by columns in a DataFrame format;
[0174] An extraction unit, used for extracting a second data segment satisfying a second condition to obtain a test CAN message;
[0175] The second condition means that the second data segment is a timestamp, a channel number, a message identifier, a sending and receiving direction, or a data segment byte.
[0176] The inspection module 2 comprises:
[0177] The non-J1939 submodule is used to determine if the parameter group number does not exist in the first message identifier set, and then make a judgment:
[0178] If the second message identifier exists in the first message identifier set, and the message type corresponding to the second message identifier is a periodic type, a first result is obtained: the message corresponding to the test parameter exists, and is a periodic non-J1939CAN message;
[0179] If the second message identifier exists in the first message identifier set, and the message type corresponding to the second message identifier is an event type, a first result is obtained: the message corresponding to the test parameter exists, and is an event type non-J1939CAN message;
[0180] If the second message identifier does not exist in the first message identifier set, and the message type corresponding to the second message identifier is a periodic type, a first result is obtained: the message corresponding to the test parameter does not exist, and is a periodic non-J1939CAN message;
[0181] If the second message identifier does not exist in the first message identifier set, and the message type corresponding to the second message identifier is an event type, a first result is obtained: the message corresponding to the test parameter does not exist, and is an event type non-J1939CAN message;
[0182] The first message identifier is a message identifier in the test CAN message; the second message identifier is a message identifier corresponding one-to-one to the test parameter.
[0183] The J1939 submodule is used to determine whether a parameter group number exists in the first message identifier set, and then make a judgment:
[0184] If the second parameter group number exists in the first parameter group number set, and the message type corresponding to the second parameter group number is periodic, then the first result is that the message corresponding to the test parameter exists and is a periodic J1939 CAN message;
[0185] If the second parameter group number exists in the first parameter group number set, and the message type corresponding to the second parameter group number is an event type, then the first result is that the message corresponding to the test parameter exists and is an event type J1939CAN message;
[0186] If the second parameter group number does not exist in the first parameter group number set, and the message type corresponding to the second parameter group number is a periodic type, then the first result is that the message corresponding to the test parameter does not exist and is a periodic J1939 CAN message;
[0187] If the second parameter group number does not exist in the first parameter group number set, and the message type corresponding to the second parameter group number is an event type, then the first result is that the message corresponding to the test parameter does not exist and is an event type J1939CAN message;
[0188] The first parameter group label is the parameter group label in the first message identifier, and the first message identifier is the message identifier in the test CAN message; the second parameter group label is the parameter group label in the second message identifier, and the second message identifier is a message identifier corresponding one-to-one to the test parameter.
[0189] Figure 6 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 6As shown, the electronic device may include: a processor (processor) 610, a communication interface (Communications Interface) 620, a memory (memory) 630 and a communication bus 640, wherein the processor 610, the communication interface 620, and the memory 630 complete mutual communication through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the automatic driving test method based on CAN message cycle monitoring, the method comprising: determining the test parameters according to the requirements of the automatic driving test, and obtaining the test CAN message through the vehicle of the automatic driving test; checking the test parameters in the test CAN message to obtain a first result; the first result includes the message type result of the test parameter; determining that the message type of the test parameter is a periodic message, then calculating the actual cycle of the test parameter in the test CAN message, and obtaining the second result according to the test parameter, the expected cycle of the test parameter and the actual cycle.
[0190] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0191] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the autonomous driving test method based on CAN message cycle monitoring provided by the above methods, and the method includes: determining test parameters according to the requirements of the autonomous driving test, and obtaining a test CAN message through the vehicle of the autonomous driving test; checking the test parameters in the test CAN message to obtain a first result; the first result includes a message type result of the test parameter; determining that the message type of the test parameter is a periodic message, calculating the actual period of the test parameter in the test CAN message, and obtaining a second result based on the test parameter, the expected period of the test parameter and the actual period.
[0192] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the autonomous driving test method based on CAN message cycle monitoring provided by the above-mentioned methods, the method comprising: determining test parameters according to the requirements of the autonomous driving test, and obtaining a test CAN message through the vehicle of the autonomous driving test; checking the test parameters in the test CAN message to obtain a first result; the first result includes a message type result of the test parameter; determining that the message type of the test parameter is a periodic message, calculating the actual period of the test parameter in the test CAN message, and obtaining a second result based on the test parameter, the expected period of the test parameter and the actual period.
[0193] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0194] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0195] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An automatic driving test method based on CAN message cycle monitoring, characterized in that: include: Determine test parameters according to the requirements of the autonomous driving test, and obtain test CAN messages through the vehicle of the autonomous driving test; Checking the test parameter in the test CAN message to obtain a first result; the first result includes a message type result of the test parameter; Determining that the message type of the test parameter is a periodic message, calculating the actual period of the test parameter in the test CAN message, and obtaining a second result according to the test parameter, the expected period of the test parameter, and the actual period; The step of determining the test parameters according to the requirements of the autonomous driving test and obtaining the test CAN message through the vehicle of the autonomous driving test includes: Process the test requirement data CAN Matrix based on the Pandas function library to obtain a test parameter set in DataFrame format; Obtain raw CAN messages in ASCII format through the autonomous driving test vehicle; The original CAN message is processed based on the Pandas function library to obtain a test CAN message in DataFrame format.
2. The automatic driving test method based on CAN message cycle monitoring according to claim 1 is characterized in that: The step of processing the test requirement data CAN Matrix based on the Pandas function library to obtain a test parameter set in DataFrame format includes: The test requirement data CAN Matrix is read through the Pandas function library, and the first data segment separated by columns and in DataFrame format is obtained after parsing the index; Excluding the first data segment that meets the first condition, to obtain a test parameter set; The first condition refers to that the first data segment is CAN signal information.
3. The automatic driving test method based on CAN message cycle monitoring according to claim 1 is characterized in that: The step of processing the original CAN message based on the Pandas function library to obtain a test CAN message in DataFrame format includes: The original CAN message is read through the Pandas function library to obtain a second data segment separated by columns in a DataFrame format; Extracting the second data segment that meets the second condition to obtain a test CAN message; The second condition means that the second data segment is a timestamp, a channel number, a message identifier, a sending and receiving direction, or a data segment byte.
4. The automatic driving test method based on CAN message cycle monitoring according to claim 1 is characterized in that: The step of checking the test parameter in the test CAN message to obtain a first result comprises: If it is determined that the parameter group number does not exist in the first message identifier set, then a judgment is made: If the second message identifier exists in the first message identifier set, and the message type corresponding to the second message identifier is a periodic type, a first result is obtained: the message corresponding to the test parameter exists, and is a periodic non-J1939CAN message; If the second message identifier exists in the first message identifier set, and the message type corresponding to the second message identifier is an event type, a first result is obtained: the message corresponding to the test parameter exists, and is an event type non-J1939CAN message; If the second message identifier does not exist in the first message identifier set, and the message type corresponding to the second message identifier is a periodic type, a first result is obtained: the message corresponding to the test parameter does not exist, and is a periodic non-J1939CAN message; If the second message identifier does not exist in the first message identifier set, and the message type corresponding to the second message identifier is an event type, a first result is obtained: the message corresponding to the test parameter does not exist, and is an event type non-J1939CAN message; The first message identifier is a message identifier in the test CAN message; the second message identifier is a message identifier corresponding one-to-one to the test parameter.
5. The automatic driving test method based on CAN message cycle monitoring according to claim 1 is characterized in that: The step of checking the test parameter in the test CAN message to obtain a first result comprises: If it is determined that the parameter group number exists in the first message identifier set, a judgment is made: The first parameter group number is the parameter group number in the first message identifier; If the second parameter group number exists in the first parameter group number set, and the message type corresponding to the second parameter group number is periodic, then the first result is that the message corresponding to the test parameter exists and is a periodic J1939 CAN message; If the second parameter group number exists in the first parameter group number set, and the message type corresponding to the second parameter group number is an event type, then the first result is that the message corresponding to the test parameter exists and is an event type J1939CAN message; If the second parameter group number does not exist in the first parameter group number set, and the message type corresponding to the second parameter group number is a periodic type, then the first result is that the message corresponding to the test parameter does not exist and is a periodic J1939 CAN message; If the second parameter group number does not exist in the first parameter group number set, and the message type corresponding to the second parameter group number is an event type, then the first result is that the message corresponding to the test parameter does not exist and is an event type J1939CAN message; The first message identifier is a message identifier in the test CAN message; the second parameter group number is a parameter group number in the second message identifier, and the second message identifier is a message identifier corresponding one-to-one to the test parameter.
6. An automatic driving test system based on CAN message cycle monitoring, characterized in that: include: An acquisition module, used to determine test parameters according to the requirements of the autonomous driving test, and acquire a test CAN message through the vehicle of the autonomous driving test; A checking module, used for checking the test parameter in the test CAN message to obtain a first result; the first result includes a message type result of the test parameter; A period module, used for determining that the message type of the test parameter is a periodic message, calculating the actual period of the test parameter in the test CAN message, and obtaining a second result according to the test parameter, the expected period of the test parameter and the actual period; The acquisition module comprises: The test parameter submodule is used to process the test requirement data CAN Matrix based on the Pandas function library to obtain a test parameter set in DataFrame format; The raw message submodule is used to obtain the raw CAN messages in ASCII format through the autonomous driving test vehicle; The test message submodule is used to process the original CAN message based on the Pandas function library to obtain a test CAN message in a DataFrame format.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the automatic driving test method based on CAN message cycle monitoring as described in any one of claims 1 to 5 are implemented.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, the steps of the automatic driving test method based on CAN message cycle monitoring as described in any one of claims 1 to 5 are implemented.
9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by the processor, the steps of the automatic driving test method based on CAN message cycle monitoring as described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Automatic driving test method and system based on CAN message analysis operation
CN114401203A