Method for automatically realizing instruction addressing in pointer mode during inertial device calibration
By establishing an instruction set structure using pointers and automatically addressing the function calls of the inertial measurement unit (IMU), the problems of insufficient reliability and scalability during IMU calibration are solved. This enables efficient and reliable instruction interaction and data transmission, improving production efficiency and system maintainability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-22
- Publication Date
- 2026-03-27
AI Technical Summary
Existing inertial measurement units suffer from low reliability, low real-time performance, and low functional scalability during calibration. In particular, they are inefficient in command interaction and data transmission, resulting in insufficient production efficiency and maintainability.
The instruction set structure is built using pointers, and a global array variable stores the function numbers and pointers. The corresponding function is automatically addressed and executed by looping through the array, which simplifies the instruction addressing process and improves scalability and maintainability.
It improves the production efficiency and reliability of inertial measurement units, simplifies the instruction addressing process, enhances the real-time performance and scalability of the system, reduces errors, and improves the convenience of production and maintenance.
Smart Images

Figure CN121742906A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of inertial devices (IMU), and in particular to a method for automatically implementing command addressing in a pointer mode during calibration of an inertial device. BACKGROUND
[0002] An inertial measurement unit (IMU) plays a vital role in the entire intelligent driving technology, especially in the technical requirements of L3 level and above. In the scenarios where GNSS signals are poor or lost in tunnels, culverts, basements, and shaded areas, etc., high-precision positioning of vehicles is necessary, which relies on an inertial measurement unit and related algorithms to achieve real-time and high-precision positioning of vehicles. Given the vital role of the inertial measurement unit in the intelligent driving system, it is necessary to ensure the high reliability and performance of the product during research and development and production. A high-performance and high-precision inertial measurement unit must undergo strict and a series of calibration and testing before leaving the factory, which involves a large amount of data collection and generation of calibration parameters. Therefore, there will be a large number of interactive commands between the inertial measurement unit module and the PC end. Through the command mode, the automatic execution of the calibration program, the collection of data, and the automatic writing of calibration parameters are realized, and then a high-precision inertial measurement unit is produced. As can be seen, during the entire production and calibration process, the inertial measurement unit will respond to a large number of interactive commands and perform corresponding actions, thereby running the corresponding calibration actions. Therefore, the real-time performance and reliability of the system are particularly important, otherwise it will lead to discontinuity of the entire calibration process and incorrect writing of calibration parameters. On the one hand, with the increasing requirements of the entire industry on the inertial measurement unit, the expansion of interactive commands during calibration and generation is also necessary, which requires higher requirements for the maintainability and functional expandability of the inertial measurement unit in the future. On the other hand, with the development of intelligent driving systems, the market demand for inertial measurement units is expanding, and higher requirements are put forward for the production efficiency of the factory. In summary, the research and development and production units are required to not only ensure the high performance and high precision of the module during the design and production of the inertial measurement unit, but also put forward higher requirements for the efficiency of the factory production and the maintainability and expandability in the future.
[0003] Currently, the inertial measurement unit module generally interacts with the PC program through the UART interface or the CAN interface for human-machine command interaction and data transmission. The conventional format of the command is shown in Table 1:
[0004] Table 1
[0005] frame header 1 frame header 2 data length main function code sub function code effective data 1 ... effective data n frame trailer check code byte_1 byte_2 byte_3 ~ byte_6 byte_7 byte_8 byte_9 ... byte_n+8 byte_n+9 byte_n+10
[0006] Wherein, the frame header 1 and the frame header 2 are 1 byte; the data length is 4 bytes; the main function code and the secondary function code are each 1 byte; the valid data 1-valid data n are variable data length, n bytes; the frame tail is 1 byte, and the check code is 2 bytes.
[0007] Firstly, the conventional instruction addressing mode generally has two kinds:
[0008] Scheme 1, an instruction addressing mode using if-else structure, as shown in the figure. fig. 1 The disadvantage of this scheme is very obvious. When the instruction set is large, the execution efficiency of the entire program is very low. In some cases, the program needs to traverse all the function codes before finding the appropriate instruction to execute. Moreover, all the functions are combined in one function, which makes the function very bloated and difficult to read. With the increase of the instruction set, the reliability of the program will further decrease. In addition, when the demand changes and additional instruction sets are needed, the program's scalability will also become very low.
[0009] Scheme 2: an instruction addressing mode using if-else and switch-case combination or only switch-case structure, as shown in the figure. fig. 2 Although this scheme improves the execution efficiency of the program to some extent, the overall program structure is still very bloated. All the function codes and execution commands are still combined in one function, which is still not friendly to the maintainability and scalability of the program, and is prone to errors and has low reliability. SUMMARY
[0010] In order to solve the above problems of the prior art, the present application provides a method for automatically implementing instruction addressing in a pointer mode during the calibration of an inertial device, which can solve the problems of low reliability, low real-time performance and low scalability of subsequent functions in the process of implementing instruction interaction between the PC end and the inertial measurement unit during data acquisition and performance calibration.
[0011] A method for automatically implementing instruction addressing in a pointer mode during the calibration of an inertial device, comprising the following steps:
[0012] A. Establish a global array variable of an instruction set structure, the size of the array being defined according to the number of actual instruction sets; the structure including two elements, namely the number corresponding to each function function as an identity card for realizing automatic addressing, and the pointer of each specific function function, which is automatically executed through the pointer after automatic addressing matching;
[0013] B. Initialize the global variable of the instruction set array defined in step A, to assign values to each element in the array;
[0014] C. define the specific function function instance, that is, each instruction generally has a specific function function to be executed;
[0015] D. the main part of the automatic addressing function function is realized by the pointer mode, the global variable array defined in step A is traversed through the for loop, the corresponding function function is automatically found according to the one-to-one correspondence in step B, and finally the function function instance defined in step C is automatically jumped to and executed.
[0016] In step A, the instruction set and the corresponding function function are initialized in the instruction set structure global array variable in advance.
[0017] In step A, if the instruction set is subsequently increased, the size of the array variable can be correspondingly expanded.
[0018] In step B, the assignment is to assign a number and a corresponding function function to two elements in each variable respectively to form a one-to-one correspondence.
[0019] In step B, if the instruction set needs to be increased for subsequent function expansion, initialization can be performed at this step.
[0020] The inertial device calibration method using the pointer mode to automatically realize instruction addressing has the following advantages:
[0021] 1. The test environment cabin with controllable temperature and humidity makes the test not affected by environmental factors, and the test period is short.
[0022] 2. The temperature and humidity control of each test can be more accurate, ensuring that the test conditions are the same, and multiple speed segment constant speed fuel consumption detection can be performed for each test, which greatly improves the efficiency.
[0023] 3. The vehicle does not need to be installed with a fuel consumption instrument, the preparation work is simple, the test is simpler, and manpower and material resources can be saved;
[0024] 4. It has strong repeatability and can also carry out comparative tests under different temperature and humidity conditions. BRIEF DESCRIPTION OF DRAWINGS
[0025] fig. 1 is a flowchart of the instruction addressing mode of the if-else structure of the prior art;
[0026] fig. 2 is a flowchart of the instruction addressing mode of the if-else and switch-case structure of the prior art;
[0027] fig. 3 is a logic diagram of the macro definition of the instruction set structure of the present application;
[0028] fig. 4 is a logic diagram of the instruction set structure initialization of the present application;
[0029] fig. 5 is a logic diagram of the function instance definition of the present application;
[0030] fig. 6 is a logic diagram of the pointer mode automatic implementation of instruction addressing of the present application;
[0031] fig. 7 is a flow chart of the method of the pointer mode automatic implementation of instruction addressing of the present application. DETAILED DESCRIPTION
[0032] The method of the pointer mode automatic implementation of instruction addressing of the inertial device calibration of the present application is described further below.
[0033] The overall idea of the pointer automatic addressing mode is as follows:
[0034] First, an instruction set structure mapping table is defined, and the function code (i.e. instruction set) and the corresponding function function are initialized in the instruction set structure array in advance, and the definition of the instruction set structure is as shown in fig. 3 .
[0035] The function in the macro definition of the instruction set structure is a function pointer, which is used to store the specific instruction execution action (i.e. execution function), and do_something is the type of the instruction corresponding to the function pointer. Therefore, when initializing the instruction set structure array, the following method can be used, as shown in fig. 4 .
[0036] Obviously, the longer the instruction set structure array is defined, the more instructions there are. And the function pointer mode is used in the array, so the memory occupation is very small. And the initialization does not require sorting, that is, the initialization of the instruction set has no sequence, which plays a simple and clear role in the later maintenance. This way is more important for the efficiency and convenience of the expansion of the later function. No matter how many instructions are added, you only need to continue to define them in the initialization function, without worrying about the order and the existing instructions.
[0037] Then, the specific execution function (function function) can be defined, as shown in fig. 5 .
[0038] As can be seen, each function function can be written independently without interference, and the overall structure is clear and simple. In actual operation, these function functions can be created in a separate file for naming, which improves the pain points of the traditional mode of bloated and difficult to maintain.
[0039] Finally, after the above instruction set structure mapping table and function function are implemented, the pointer-based automatic implementation of instruction addressing function of the application can be implemented, and the specific flow is shown in fig. 6 .
[0040] As can be seen from fig. 6 , although there is a switch-case structure in the function body in the addressing of the application, the content of the switch-case structure has become very simple, and there is only one program instruction, and its role is only to match the current PC end instruction. After the matching is completed, it enters the key part of the application, that is, the program code in the dashed box, which automatically addresses the current PC end instruction through a for loop. After the corresponding function is found, it automatically jumps to the corresponding execution function (function function) to perform the corresponding action through the function pointer. fig. 6 .
[0041] Therefore, after the above operation, the pointer-based automatic implementation of instruction addressing in inertial device calibration is realized.
[0042] As shown in fig. 7 , the pointer-based automatic implementation of instruction addressing in inertial device calibration of the application specifically includes the following steps:
[0043] A. Define a global array variable of struct doInstruction structure type. The size of the global array variable of the structure type can be defined according to the number of actual instruction sets. If the instruction set is increased later, the size of the array variable can also be expanded accordingly.
[0044] The definition of the global array variable of the struct doInstruction structure type can be referred to fig. 3 , which includes two elements. Element 1: instruction_type is the number corresponding to each function function, which is the identity card for automatic addressing. Element 2: instruction_function is the pointer of each specific function function. After automatic addressing matching, the corresponding function function is automatically executed through the pointer.
[0045] B. Initialize the global array variable of the structure type defined in step A. The purpose is to assign a value to each element in the array, that is, to assign a number and a corresponding function function to each variable in two elements, to form a one-to-one correspondence. There are as many instructions as there are array variables to be initialized. Subsequent function expansion and instruction set increase can also be initialized at this point.
[0046] C. Define specific function function instances, each instruction generally has a specific function function to be executed, due to the characteristics of the technical scheme of the application, all function functions are independent and can be defined independently in independent files.
[0047] D. The main part of the automatic addressing function function is realized by the pointer method, the global variable array defined in step A is traversed through the for loop, the corresponding function function is automatically found according to the one-to-one correspondence in step B, and then the function function instance defined in step C is automatically jumped to and executed.
[0048] In summary, through the method for automatically realizing instruction addressing in the pointer mode of the application, the pain points of low communication efficiency of traditional inertial devices in research and development, calibration, generation and PC end, low scalability and maintainability are effectively solved; the production efficiency, i.e. the post-maintenance, is effectively improved, and the production and research and development reliability is increased. In view of the technical scheme in the application, in addition to the instruction interaction between the inertial device and the PC end, any system that interacts with instructions through CAN, UART and the like can apply part or all of the processes mentioned in the application.
[0049] However, those skilled in the art in the technical field should realize that the above embodiments are only used to illustrate the application, and are not used as a limitation on the application, as long as the changes and modifications of the above described embodiments are within the spirit and principles of the application, they will fall within the scope of the claims of the application.
Claims
1. A method for automatically implementing instruction addressing using pointers during inertial device calibration, characterized in that, Includes the following steps: A. Create a global array variable of instruction set structure, the size of which is defined according to the number of actual instruction sets; the structure includes two elements, namely, the number corresponding to each function of the ID card that implements automatic addressing, and a pointer to each specific function. After automatic addressing and matching, the corresponding function is automatically executed through the pointer. B. Initialize the global variable for the instruction set array defined in step A, so as to assign a value to each element in the array; C. Define specific function instances, that is, each instruction generally has a specific function to be executed; D. The main body of the function is implemented using pointers. The global variable array defined in step A is traversed by a for loop. Then, according to the one-to-one correspondence in step B, the corresponding function is automatically found. Finally, the function instance defined in step C is automatically jumped to for execution.
2. The method for automatically implementing instruction addressing by pointer during inertial device calibration as described in claim 1, characterized in that: In step A, the instruction set and its corresponding function are initialized in the global array variable of the instruction set structure beforehand.
3. The method for automatically implementing instruction addressing using pointers during inertial device calibration as described in claim 1, characterized in that: In step A, if an instruction set is subsequently added, the size of the array variable can be increased accordingly.
4. The method for automatically implementing instruction addressing by pointer during inertial device calibration as described in claim 1, characterized in that: In step B, the assignment is to assign a number and a corresponding function to each of the two elements in each variable to form a one-to-one correspondence.
5. The method for automatically implementing instruction addressing by pointer during inertial device calibration as described in claim 1, characterized in that: In step B, if subsequent functional expansion requires adding an instruction set, initialization can be performed at this step.