Machine learning based hovering ball stage motion state recognition and adaptive control method
By using a machine learning model to identify the motion state of the suspended ball frame and dynamically adjust the Kalman filter parameters, the problem of monitoring the suspended ball frame in both static and dynamic states is solved, enabling adaptive control and timely early warning.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN AVANT SPORTS IND CO LTD
- Filing Date
- 2026-04-29
- Publication Date
- 2026-06-12
AI Technical Summary
Existing methods for monitoring the state of suspended ball racks generate redundant data and noise parameters when the rack is stationary, which cannot suppress state drift. When the rack is in motion, the tracking capability is insufficient, leading to delayed or missed warnings.
A machine learning model is used to identify the motion state of the suspended ball frame, and the sampling frequency and process noise parameters of the Kalman filter are dynamically adjusted based on the state identification results. Adaptive control is achieved by combining dynamic early warning thresholds.
It improves the tracking capability of the suspended ball frame in motion and the state drift suppression in a stationary state, enabling timely response to warnings and reducing redundant data and latency.
Smart Images

Figure CN122194690A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of machine learning technology and discloses a method for identifying and adaptively controlling the motion state of a suspended ball frame based on machine learning. Background Technology
[0002] Monitoring the operational status of a suspended ball cradle typically relies on a combination of attitude sensors and filtering algorithms. The most common approach in existing technology involves installing attitude sensors on the suspended cradle and collecting raw angle data at a fixed high frequency. This raw angle data is then input into a Kalman filter, which calculates the current angle and angular velocity state estimates of the cradle using a preset state transition matrix and observation equations. In this conventional approach, the process noise and observation noise parameters within the Kalman filter are set to fixed values. The system directly compares the filtered angle and angular velocity state estimates with preset fixed warning thresholds. When the state estimates exceed these thresholds, a corresponding alarm signal is triggered. Throughout the entire operating cycle, the sensor's data sampling frequency, the Kalman filter's process noise parameters, and the warning thresholds remain constant.
[0003] The suspended ball frame is characterized by prolonged periods of stillness and only occasional movement during actual operation. Based on the existing fixed-frequency sampling and fixed-noise-parameter settings, when the ball frame is stationary, the fixed high-frequency sampling generates a large amount of redundant data, and the fixed process noise parameter cannot reduce its value to an extremely low level to suppress state drift. When the ball frame undergoes sudden movement, the fixed process noise parameter value is too small, resulting in insufficient tracking capability of the Kalman filter for the actual motion, delayed state estimation, and a rapid increase in the uncertainty of the estimated covariance matrix, which fails to converge quickly. This fixed-parameter mechanism cannot simultaneously address state drift suppression when stationary and dynamic tracking during movement, leading to a failure of fixed-frequency sampling and fixed-threshold warnings to respond promptly to changes in the actual motion state, resulting in warning delays or missed alarms. Summary of the Invention
[0004] The purpose of this invention is to provide a machine learning-based method for recognizing and adaptively controlling the motion state of a suspended ball frame, which can solve the problems mentioned in the background art.
[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows: A machine learning-based method for motion state recognition and adaptive control of suspended ball racks includes: acquiring the original angle data of the suspended ball racks; The original angle data is input into a Kalman filter, which outputs the estimated angle state, estimated angular velocity state, and estimated covariance matrix of the suspended ball frame. The estimated angle state and the estimated angular velocity state are input into the machine learning model, and the motion pattern classification result and the corresponding process noise parameter are output. The motion pattern classification result includes stationary state and motion state. Based on the motion pattern classification result and the trace of the estimated covariance matrix, the sampling interval for the next time step is calculated and output. When the motion pattern classification result indicates a motion state and the trace increases, the sampling interval is decreased; when the motion pattern classification result indicates a stationary state and the trace decreases, the sampling interval is increased. The process noise parameters are updated in the Kalman filter; Based on the estimated angle state value, the estimated angular velocity state value, and the dynamic early warning threshold associated with the sampling interval, an alarm signal for the suspended ball frame is output.
[0006] Preferably, the step of inputting the original angle data into a Kalman filter and outputting the angle state estimate, angular velocity state estimate, and estimated covariance matrix of the suspended ball frame includes: constructing a two-dimensional state vector containing the angle state estimate and the angular velocity state estimate, and establishing an observation equation using the original angle data as the observation vector; Calculate the prior state estimate for the current time step using the prior state estimate from the previous time step and the state transition matrix; The posterior state estimate at the current moment is calculated using the Kalman gain matrix, the observation vector, and the prior state estimate. The posterior state estimate is then decomposed into the angle state estimate and the angular velocity state estimate. The estimated covariance matrix at the current time is calculated based on the Kalman gain matrix and the prior estimated covariance matrix.
[0007] Preferably, the step of inputting the angle state estimate and the angular velocity state estimate into a machine learning model and outputting motion pattern classification results and corresponding process noise parameters includes: constructing a temporal feature matrix using the angle state estimate and the angular velocity state estimate within a set time window; The temporal feature matrix is input into a pre-trained long short-term memory network, and the feature vector is output through the hidden layer of the long short-term memory network. The feature vector is input into a fully connected layer and a Softmax activation function, and the output is the probability value of belonging to the stationary state and the motion state. The one with the largest probability value is taken as the motion mode classification result. The feature vector is input into another fully connected layer and a linear activation function, and the output is the specific value of the process noise parameter corresponding to the motion pattern classification result.
[0008] Preferably, the step of calculating and outputting the sampling interval for the next time step based on the motion pattern classification result and the trace of the estimated covariance matrix includes: summing the diagonal elements of the estimated covariance matrix to obtain the trace; Set a basic sampling interval and a maximum sampling interval. When the motion pattern classification result is a motion state, calculate the product of the trace and a preset first mapping coefficient, and use the result of subtracting the product from the basic sampling interval as the sampling interval for the next moment. When the motion pattern classification result is a stationary state, the product of the trace and the preset second mapping coefficient is calculated, and the result of adding the product to the basic sampling interval is used as the sampling interval for the next moment. When the calculated sampling interval exceeds the maximum sampling interval, the sampling interval at the next moment is set to the maximum sampling interval.
[0009] Preferably, the step of outputting an alarm signal for the suspended ball frame based on the estimated angle state value, the estimated angular velocity state value, and a dynamic early warning threshold associated with the sampling interval includes: obtaining the reciprocal of the sampling interval as the current sampling frequency; The current sampling frequency is input into a preset threshold lookup table, and the corresponding angle warning threshold and angular velocity warning threshold are matched and output. The angle warning threshold and angular velocity warning threshold recorded in the threshold lookup table are positively correlated with the current sampling frequency. Determine whether the estimated angle state value is greater than the angle warning threshold, and whether the estimated angular velocity state value is greater than the angular velocity warning threshold; When both exceed the corresponding warning threshold, a high-level signal is generated as the alarm signal for the suspended ball frame; otherwise, a low-level signal is generated.
[0010] Preferably, the method further includes the step of constructing a structured data record from the data generated at each moment and storing it in a state feature database: using the current timestamp as the primary key, and using the angle state estimate, the angular velocity state estimate, the trace of the estimated covariance matrix, the motion pattern classification result, the process noise parameter, and the sampling interval as fields to generate a structured data record; According to the time sequence of the primary key, the structured data records are inserted into the inverted index linked list of the state feature database; Update the pointers of the index nodes in the inverted index list that correspond to the motion pattern classification results, and point the pointers of the index nodes to the storage address of the currently inserted structured data record.
[0011] Preferably, the step of calculating the estimated covariance matrix at the current time based on the Kalman gain matrix and the prior estimated covariance matrix includes: obtaining the estimated covariance matrix updated at the previous time, constructing a noise covariance matrix by combining the state transition matrix and the process noise parameters at the previous time, and calculating the prior estimated covariance matrix at the current time through matrix multiplication and addition operations. The Kalman gain matrix is obtained by combining the observation noise covariance matrix at the current moment, the observation matrix corresponding to the observation equation, and the prior estimated covariance matrix through matrix inversion and multiplication. Calculate the difference between the identity matrix and the Kalman gain matrix, multiply the difference by the prior estimated covariance matrix, and output the estimated covariance matrix at the current time.
[0012] Preferably, before inputting the temporal feature matrix into the pre-trained long short-term memory network, the method further includes the step of weight retrieval and loading of the long short-term memory network: extracting the matrix dimension of the currently input temporal feature matrix and the window length of the set time window, and combining them to generate a feature retrieval identifier; In the preset model weight library, using the feature retrieval identifier as the retrieval key, traverse the leaf nodes of multiple B+ tree index structures and match the target leaf node that has the same prefix as the feature retrieval identifier. Read the weight matrix and bias vector corresponding to each hidden layer in the Long Short-Term Memory network from the physical storage block pointed to by the target leaf node, and load the read weight matrix and bias vector into the corresponding network layer of the Long Short-Term Memory network.
[0013] Preferably, in the step of calculating the product of the trace and the preset first mapping coefficient, the method for determining the preset first mapping coefficient includes: acquiring multiple sets of historical trace data and historical sampling interval data recorded when the motion pattern classification result is a motion state within a historical time period; A linear regression equation is constructed using the historical trace data as the independent variable and the historical sampling interval data as the dependent variable. The linear regression equation is fitted using the least squares method, and the slope of the linear regression equation is calculated. Take the reciprocal of the absolute value of the slope, and set the result of taking the reciprocal as the preset first mapping coefficient, wherein the preset second mapping coefficient is set in the same way as the preset first mapping coefficient.
[0014] Preferably, the step of updating the pointer of the index node corresponding to the motion pattern classification result in the inverted index list includes: obtaining the text string of the motion pattern classification result, and performing a hash calculation on the text string to obtain a hash value; Search for the head pointer of the linked list that matches the hash value in the global hash table of the state feature database; Traverse each node in the inverted index linked list along the head pointer and read the timestamp of the historical structured data record stored in each node; The timestamp of the currently inserted structured data record is compared with each of the read timestamps. The node with the largest timestamp in the inverted index list is taken as the target node, and the index node pointer in the target node is updated to the storage address of the currently inserted structured data record.
[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. This invention inputs raw angle data into a Kalman filter, outputting angle state estimates, angular velocity state estimates, and an estimated covariance matrix. The angle and angular velocity state estimates are then input into a machine learning model, which outputs motion pattern classification results and process noise parameters. Based on the motion pattern classification results and the trace of the estimated covariance matrix, the sampling interval for the next time step is calculated. The sampling interval is decreased when the trace increases during motion and increased when the trace decreases during stationary states. Simultaneously, the process noise parameters output by the machine learning model are updated in the Kalman filter. Through these techniques, the sampling frequency and internal filter parameters dynamically change with the actual state of the ball frame. In motion, the sampling frequency is increased and process noise is amplified to enhance tracking capability and enable rapid filter convergence. In stationary states, the sampling frequency is decreased and process noise is reduced to suppress state drift, thus solving the warning delay problem caused by fixed parameters and fixed frequencies.
[0016] 2. This invention obtains the reciprocal of the sampling interval as the current sampling frequency, and outputs a dynamic early warning threshold positively correlated with the current sampling frequency through a threshold lookup table. The estimated angle and angular velocity states are compared with the dynamic early warning threshold to output an alarm signal, thus achieving adaptive linkage between the early warning judgment mechanism and the sampling frequency. The timestamp, state estimate, trace of the estimated covariance matrix, motion pattern classification results, process noise parameters, and sampling interval are constructed as structured data records and inserted into the inverted index linked list of the state feature database in chronological order. A hash calculation is performed based on the text string of the motion pattern classification results. The matching linked list head pointer is searched in the global hash table, and the nodes are traversed. The index pointer of the node with the largest timestamp is updated to the storage address of the current structured data record. When determining the first mapping coefficient for calculating the sampling interval, historical trace data and historical sampling interval data under the motion state are extracted to construct a linear regression equation. The slope is calculated using the least squares method, and its reciprocal is taken as the first mapping coefficient. By combining the matrix dimension and window length of the temporal feature matrix to generate feature retrieval identifiers, the target leaf nodes are matched by traversing the multi-way search tree index structure in the model weight library. The weight matrices and bias vectors corresponding to each hidden layer in the Long Short-Term Memory network are then read and loaded. This approach establishes an ordered storage and fast retrieval path for historical running data, providing data support and numerical calculation basis for state tracing and dynamic configuration of model parameters. Attached Figure Description
[0017] Figure 1 This is a flowchart of the overall process for a machine learning-based method for motion state recognition and adaptive control of a suspended ball rack. Figure 2 Flowchart for Kalman filter state estimation and covariance matrix calculation; Figure 3 A flowchart for feature processing and weight loading in machine learning models; Figure 4 Flowchart for adaptive calculation of sampling interval and determination of mapping coefficients; Figure 5 Flowchart for dynamic early warning threshold matching and alarm signal output; Figure 6 Flowchart for generating and updating inverted index linked lists for structured data records. Detailed Implementation
[0018] Please refer to the attached document. Figure 1 and 2This embodiment provides a machine learning-based method for identifying and adaptively controlling the motion state of a suspended ball frame. The attitude measurement unit of the suspended ball frame outputs the raw angle data corresponding to the spatial attitude of the ball frame in real time. The raw angle data uses the geodetic horizontal coordinate system as the reference coordinate system to represent the angle measurement value of the ball frame relative to the reference plane. The acquired raw angle data is input into a Kalman filter, which outputs the estimated angle state value, the estimated angular velocity state value, and the estimated covariance matrix of the suspended ball frame.
[0019] Specifically, a two-dimensional state vector is constructed, containing both angular state estimates and angular velocity state estimates. The expression for the two-dimensional state vector is as follows: in, Let be the two-dimensional state vector at time k. The angle state estimate at time k. for The state estimate of the angular velocity at time t. Using the original angle data as the observation vector, an observation equation is established. The state prior estimate of the current time is calculated using the state prior estimate from the previous time step and the state transition matrix. The expression for the state prior estimate is: in, for The prior state estimate at time 10:00. The discrete state transition matrix, for The posterior estimate of the state at time t. The state transition matrix has a dimension of 2×2, and its specific form is as follows: , where T is The sampling interval at time step, the physical meaning of this matrix is: the prior estimate of the angle state is composed of the sum of the angle estimate and the angular velocity estimate of the previous time step multiplied by the sampling interval, and the prior estimate of the angular velocity state is consistent with the angular velocity estimate of the previous time step in the absence of external force input.
[0020] The expression for the observation equation is: in, for The observation vector at time, i.e., the acquired raw angle data. For the observation matrix, The observed noise is given by a set formula with a mean of 0 and a covariance of 0. The observation matrix is a Gaussian distribution. The dimension of the observation matrix is 1×2, and its specific form is... The physical meaning of this matrix is: the observation vector can only directly observe the angular state in the two-dimensional state vector, and cannot directly observe the angular velocity state.
[0021] The posterior state estimate at the current time step is calculated using the Kalman gain matrix, the observation vector, and the prior state estimate. The expression for the posterior state estimate is as follows: in, Let k be the posterior estimate of the state at time k. for The Kalman gain matrix at time 10:00. The observation residual characterizes the deviation between the observed values and the prior estimates. The calculated posterior state estimates are decomposed row-wise, with the first row representing the angle state estimate at time k and the second row representing the angular velocity state estimate at time k. The Kalman gain matrix is calculated as follows: in, for The prior estimate of the covariance matrix at time t. Let be the transpose of the observation matrix. The covariance matrix of the observed noise is given. The expression for calculating the prior estimate of the covariance matrix is: in, for The posterior estimated covariance matrix at time t. It is the transpose of the state transition matrix. for The process noise covariance matrix at time t is given, and the diagonal elements of the process noise covariance matrix are the process noise parameters at the corresponding time t.
[0022] The estimated covariance matrix at the current time is calculated based on the Kalman gain matrix and the prior estimated covariance matrix. The update expression for the estimated covariance matrix is as follows: in, Let be the posterior estimated covariance matrix at time k, i.e., the output estimated covariance matrix. This is a second-order identity matrix. To clarify the physical meaning and value constraints of each core parameter of the Kalman filter in this embodiment, the following parameter definition table is constructed: Table 1. Definitions and Physical Meanings of Core Parameters of Kalman Filters
[0023] The parameters defined in this table cover the core variables of the entire process of Kalman filter state prediction, observation update, and covariance calculation. The dimensions and value constraints of each parameter ensure the legality and numerical stability of matrix operations in the filter operation process, and provide clear numerical specifications for the accurate output of state estimates and covariance matrices.
[0024] refer to Figure 3 and 4 The calculated angle and angular velocity state estimates are input into a machine learning model. The model outputs motion pattern classification results and corresponding process noise parameters, where the motion pattern classification results include stationary and moving states. Specifically, a temporal feature matrix is constructed using the angle and angular velocity state estimates within a defined time window, where the length of the time window is set to [value missing]. That is, select continuous The angle state estimate and angular velocity state estimate at each time step are used as inputs to the time series feature matrix, which is expressed as follows: in, The time series feature matrix has a dimension of . ×2, each row vector corresponds to the angle state estimate and angular velocity state estimate at a given moment, and the time window length is 2. The value can be adjusted according to the motion response characteristics of the suspended ball frame. The larger the value of , the richer the historical state information contained in the time series feature matrix. The smaller the value of , the shorter the forward propagation computation time of the model.
[0025] The temporal feature matrix is input into a pre-trained Long Short-Term Memory (LSTM) network. The input to the LSM network is each row vector of the temporal feature matrix, i.e., the input vector at each time step. ,in The range of values is 1 to Long Short-Term Memory (LSTM) networks utilize gating structures to achieve long-term memory and forgetting of temporal information. The computational expression for the gating structure is as follows: in, for The forget gate output at each time step is used to control the degree to which the cell state from the previous time step is retained; for The input gate output at each time step is used to control the degree to which candidate information for the current time step is written. Let t be the candidate cell state at time t, representing the new information learned at the current time. for The cellular state at any given moment is the long-term memory unit of the long short-term memory network; for The output gate at each time step controls the degree of output regarding the cell state at the current time step. for The hidden layer output vector at time step; This is the Sigmoid activation function, used to map the output value to the range of 0 to 1; This is the hyperbolic tangent activation function, used to map the output value to the interval between -1 and 1; The Hadamard product is the product of corresponding elements in a matrix. This is the weight matrix corresponding to the input layer; This is the cyclic weight matrix corresponding to the hidden layer; This is the bias vector corresponding to the gating structure. The hidden layer output vector at the last time step of the Long Short-Term Memory network serves as the feature vector output corresponding to the entire temporal feature matrix.
[0026] The output feature vector is input into a fully connected layer and a Softmax activation function, which outputs the probability values of belonging to the stationary and moving states. The output expression of the Softmax activation function is: in, The input feature is the probability value of belonging to the c-th motion pattern, where c takes the values 1 and 2, corresponding to the stationary state and the motion state, respectively. The weight row vector for the c-th class in the fully connected layer for classification; The bias value for classifying the fully connected layer corresponding to class c; This is the feature vector output at the last time step of the Long Short-Term Memory network. The probability values corresponding to the two categories are compared, and the category with the highest probability value is taken as the final motion pattern classification result.
[0027] The feature vector is input into another fully connected layer and a linear activation function, and the output is the specific value of the process noise parameter corresponding to the motion pattern classification result. The output expression of the process noise parameter is: in, The output process noise parameter vector has a dimension of 2×1, and the two elements correspond to the process noise variance of the angular state and the process noise variance of the angular velocity state, respectively. This is the weight matrix for the regression fully connected layer; This is the bias vector for the regressive fully connected layer. Elements of the output process noise parameter vector will be used as diagonal elements of the process noise covariance matrix for parameter updates of the Kalman filter.
[0028] The pre-trained Long Short-Term Memory (LSTM) network was trained under supervised supervision using a labeled suspended ball hoop running dataset. The training dataset contained multiple sets of continuous time-series angle and angular velocity state data. Each set of data was labeled with a corresponding motion pattern classification label and an optimal process noise parameter value, which was obtained through offline parameter calibration of the Kalman filter. The total loss function expression for the training process is: in, The total loss function for model training; The cross-entropy loss function for the classification branch is used to constrain the accuracy of motion pattern classification; The mean squared error loss function for the regression branch is used to constrain the accuracy of the output process noise parameters. To balance the weight coefficients of the two loss functions, the weight matrices and bias vectors of each layer of the network are updated using the backpropagation algorithm until the total loss function converges to a preset threshold, thus completing model training.
[0029] Based on the motion pattern classification results and the trace of the estimated covariance matrix, the sampling interval for the next time step is calculated and output. Specifically, when the motion pattern classification result indicates a moving state and the trace increases, the sampling interval decreases; conversely, when the motion pattern classification result indicates a stationary state and the trace decreases, the sampling interval increases. Specifically, the trace is calculated by summing the diagonal elements of the estimated covariance matrix. The expression for the trace is: in, To estimate the trace of the covariance matrix at time k, To estimate the covariance matrix of the first... Line number The diagonal elements of the column, the trace values, represent the total uncertainty of the state estimate. The larger the trace value, the higher the uncertainty of the state estimate.
[0030] refer to Figure 5A base sampling interval and a maximum sampling interval are preset. The base sampling interval is the reference sampling interval under normal operating conditions of the suspended ball frame, and the maximum sampling interval is the upper limit allowed for the sampling interval. When the motion mode classification result is a motion state, the product of the trace and the preset first mapping coefficient is calculated, and the result of subtracting the product from the base sampling interval is used as the sampling interval for the next moment. When the motion mode classification result is a stationary state, the product of the trace and the preset second mapping coefficient is calculated, and the result of adding the product to the base sampling interval is used as the sampling interval for the next moment. When the calculated sampling interval exceeds the maximum sampling interval, the sampling interval for the next moment is set as the maximum sampling interval; when the calculated sampling interval is less than the preset minimum sampling interval, the sampling interval for the next moment is set as the minimum sampling interval. The minimum sampling interval is the lower limit allowed for the sampling interval and is determined by the hardware sampling capability of the attitude measurement unit.
[0031] The process noise parameters output by the machine learning model are updated in the Kalman filter. Specifically, two elements of the process noise parameter vector are assigned to the two diagonal elements of the process noise covariance matrix in the Kalman filter. The updated process noise covariance matrix will be used to calculate the prior estimate covariance matrix of the Kalman filter in the next time step, thereby realizing the adaptive adjustment of the process noise parameters of the Kalman filter.
[0032] Based on the estimated angle and angular velocity states, and the dynamic warning threshold associated with the sampling interval, an alarm signal for the suspended gyro is output. Specifically, the reciprocal of the sampling interval is used as the current sampling frequency. This frequency is then input into a preset threshold lookup table, which matches and outputs the corresponding angle and angular velocity warning thresholds. The threshold lookup table pre-stores multiple sets of mapping relationships between sampling frequencies and corresponding warning thresholds. These mapping relationships are determined through offline calibration experiments. In these experiments, angle and angular velocity data of the suspended gyro are collected under normal and abnormal operating conditions at different sampling frequencies. The minimum trigger value for the abnormal state at different sampling frequencies is statistically analyzed, and this minimum trigger value is set as the warning threshold for the corresponding sampling frequency. The angle and angular velocity warning thresholds recorded in the threshold lookup table are positively correlated with the current sampling frequency; that is, the higher the sampling frequency, the larger the corresponding warning threshold.
[0033] The current estimated angle state value is compared with the angle warning threshold, and the current estimated angular velocity state value is compared with the angular velocity warning threshold. When both the estimated angle state value and the estimated angular velocity state value are greater than the angular velocity warning threshold, a high-level signal is generated as an alarm signal for the suspended ball frame; otherwise, a low-level signal is generated.
[0034] This embodiment uses a Kalman filter to achieve optimal estimation of the angle and angular velocity state of the suspended ball stand. A long short-term memory network is used to automatically classify the ball stand's motion patterns and adaptively output process noise parameters. Based on the motion pattern classification results and the trace of the estimated covariance matrix, the sampling interval is dynamically adjusted. Simultaneously, the process noise parameters are updated to the Kalman filter in real time, ensuring the filter's tracking characteristics match the actual operating state of the ball stand. An adaptive output of the alarm signal is achieved through a dynamic warning threshold linked to the sampling frequency. This realizes end-to-end adaptive adjustment of the sampling frequency, filter parameters, and warning threshold, balancing state drift suppression in a static state with dynamic tracking capabilities in a moving state.
[0035] refer to Figure 6 In a preferred embodiment, the data generated at each moment is constructed into structured data records and stored in a state feature database. The current timestamp is used as the primary key, employing a Unix time format accurate to the microsecond level to ensure global uniqueness and avoid primary key conflicts. The angle state estimate, angular velocity state estimate, trace of the estimated covariance matrix, motion pattern classification result, process noise parameters, and sampling interval output at the current moment are used as corresponding fields for the structured data record, generating a complete structured data record. The numerical type and storage length of each field are pre-defined to ensure consistent data record format. The generated structured data records are inserted into an inverted index linked list in the state feature database according to the chronological order of the primary key. The nodes of the inverted index linked list are arranged in ascending order of timestamps to ensure temporal continuity of the data records. The node corresponding to the newly inserted structured data record is added to the tail of the inverted index linked list. The pointers of the index nodes corresponding to the motion pattern classification results in the inverted index linked list are updated, pointing the index node pointers to the storage address of the currently inserted structured data record.
[0036] Specifically, the text string containing the motion pattern classification result is obtained, and a hash value is calculated from the text string. The expression for the hash calculation is: in, For text strings The corresponding hash value, The text string representing the motion pattern classification results. This is a secure hash algorithm that outputs a fixed-length hash value. This represents the number of buckets in the global hash table of the state feature database. The number of buckets is a power of 2 to ensure the uniformity of hash calculation. The result of the hash calculation is the index value of the corresponding bucket in the global hash table, and each bucket corresponds to a classification result for a motion mode.
[0037] The system searches for the head pointer of a linked list matching the hash value in the global hash table of the state feature database. This head pointer points to the starting node of the inverted index linked list corresponding to the motion pattern classification result. Following the head pointer, the system traverses each node in the inverted index linked list, reading the timestamp of the historical structured data record stored in each node. The timestamp of the currently inserted structured data record is compared with the read historical timestamps. The node with the largest timestamp in the inverted index linked list is selected as the target node. This node corresponds to the tail node of the inverted index linked list, i.e., the most recently inserted historical data node. The index node pointer in the target node is updated to the storage address of the currently inserted structured data record, ensuring that the inverted index linked list can always quickly locate the latest data record for the corresponding motion pattern classification result via the index node pointer. Each node in the inverted index linked list stores the timestamp, storage address, and pointer to the next node for the corresponding structured data record. When it is necessary to retrieve all data records for a specific motion pattern, the corresponding head pointer can be quickly found through the global hash table, and the linked list can be traversed to obtain all data records that meet the conditions without a full table scan.
[0038] To clarify the field attributes and indexing rules of structured data records in the status feature database, the following field specification table is constructed: Table 2. Field Specifications for Structured Data Records in the Status Feature Database
[0039] This table standardizes all field attributes of structured data records in the status feature database, clarifies the index type and physical meaning of each field, and ensures that the primary key and index settings guarantee the orderly storage and fast retrieval of data records in chronological order. The inverted index settings enable rapid filtering and location of data based on motion pattern classification results.
[0040] This embodiment constructs a structured data record containing all operational status data, establishes a time-series storage structure with timestamps as the primary key, and combines a global hash table and an inverted index linked list to achieve fast retrieval and location based on motion pattern classification results. This ensures the orderly storage and efficient access of operational data, providing complete and traceable data support for subsequent model parameter optimization, mapping coefficient fitting, and operational status tracing.
[0041] In another preferred embodiment, before inputting the temporal feature matrix into the pre-trained Long Short-Term Memory (LSTM) network, a weight retrieval and loading operation is performed on the LSTM network. The matrix dimension of the currently input temporal feature matrix and the window length of a set time window are extracted and combined to generate a feature retrieval identifier. The feature retrieval identifier is a string with a fixed format, containing key information about the time window length and the feature matrix dimension. The fixed format is "LSTM\WIN\{N}DIM{D}", where {N} is the window length of the time window and {D} is the feature dimension of the temporal feature matrix. This ensures that different configurations of temporal feature matrices correspond to unique feature retrieval identifiers, avoiding identifier conflicts. In a pre-set model weight library, using the generated feature retrieval identifier as the search key, multiple leaf nodes of B+ tree index structures are traversed to match target leaf nodes with the same prefix as the feature retrieval identifier. The model weight library stores multiple sets of LSTM network weight parameters corresponding to different time window configurations. Each set of weight parameters corresponds to a unique feature retrieval identifier. The B+ tree index structure is used to achieve fast matching and addressing of feature retrieval identifiers.
[0042] In a B+ tree index structure, non-leaf nodes store the prefix range of the search key and pointers to its corresponding child nodes. Leaf nodes store the complete search key and the physical address of the corresponding weight parameter storage block. All leaf nodes are arranged lexicographically by the search keys and connected by a doubly linked list for easy range queries and traversal. The B+ tree index structure uses a 3x3 B+ tree. Non-leaf nodes store a maximum of 3 search key prefixes and 4 child node pointers, while leaf nodes store a maximum of 3 complete search keys and their corresponding physical storage addresses. When searching for a target search key, starting from the root node of the B+ tree, the prefix of the search key is compared sequentially with the prefix range stored in the non-leaf nodes to find the corresponding child nodes, until a leaf node is reached and a target leaf node with the same prefix is matched.
[0043] The weight matrices and bias vectors corresponding to each hidden layer in the Long Short-Term Memory (LSTM) network are read from the physical storage block pointed to by the target leaf node. This includes the input weight matrices, recurrent weight matrices, and bias vectors for the input gate, forget gate, cell gate, and output gate, as well as the weight matrices and bias vectors for the classification and regression fully connected layers. The read weight matrices and bias vectors are then loaded into the corresponding network layers of the LSM network, completing the parameter configuration of the network model. This allows the network model to adapt to the dimension of the current temporal feature matrix and the length of the time window before performing subsequent forward propagation calculations. The reading and loading process of weight parameters is executed in the order of preset storage offsets to ensure the correspondence between weight parameters and network layers, avoiding parameter loading misalignment issues.
[0044] To clarify the storage structure and addressing rules of the weight parameters of each layer in the Long Short-Term Memory (LSTM) network, the following storage structure table is constructed: Table 3 Storage Structure of Weight Parameters in Long Short-Term Memory Network
[0045] This table clarifies the storage structure and physical meaning of the weight parameters of each layer in the Long Short-Term Memory (LSTM) network. The dimension definition and storage offset settings ensure the accuracy and addressing efficiency of the weight parameter reading process, enabling the model weights to be quickly matched and fully loaded into the corresponding network layers based on feature retrieval identifiers, thus ensuring the normal execution of the network's forward propagation process.
[0046] This embodiment generates a unique feature retrieval identifier by using the dimension of the temporal feature matrix and the length of the time window. Based on the B+ tree index structure, it achieves fast matching and accurate loading of model weights, enabling the Long Short-Term Memory network to adapt to different time window configurations and feature dimensions. It eliminates the need to retrain the model for different configurations, ensuring the adaptability, stability, and execution efficiency of motion pattern classification and process noise parameter output.
[0047] In another preferred embodiment, the preset first mapping coefficient and the preset second mapping coefficient are obtained by fitting historical running data. Multiple sets of historical trace data and historical sampling interval data are acquired when the motion pattern classification result is a motion state within a historical time period. The length of the historical time period can be set according to the running cycle of the suspended ball frame. All historical data comes from structured data records stored in the state feature database, ensuring the authenticity and validity of the data. The acquired historical data is preprocessed to remove outliers from the dataset. Outlier judgment is performed using… The criterion is to calculate the mean and standard deviation of historical trace data and historical sampling interval data, and to identify samples that exceed the mean ± 3 times the standard deviation as outliers and remove them from the fitted dataset to ensure the accuracy of the fitting results.
[0048] Using the preprocessed historical trace data as the independent variable and the corresponding historical sampling interval data as the dependent variable, a linear regression equation is constructed. The expression of the linear regression equation is as follows: in, is the independent variable, corresponding to the values of historical trace data; The dependent variable corresponds to the values of historical sampling interval data; The slope of the linear regression equation; The intercept of the linear regression equation is denoted as .
[0049] The constructed linear regression equation is fitted using the least squares method, and the slope and intercept of the linear regression equation are calculated. The expression for the slope is as follows: in, The number of historical data samples used for fitting; For the first Historical trace data values for each sample; For the first The historical sampling interval data for each sample is taken. The expression for calculating the intercept is: The calculated slope The absolute value of the first mapping coefficient is taken as its reciprocal, and this reciprocal is set as the first preset mapping coefficient. The second preset mapping coefficient is set in the same way as the first. Specifically, multiple sets of historical trace data and historical sampling interval data recorded when the motion pattern classification result was a stationary state within a historical time period are obtained. The same preprocessing, linear regression equation construction, and least squares fitting operations are performed to calculate the slope of the corresponding linear regression equation. The absolute value of the slope is taken as its reciprocal and set as the second preset mapping coefficient. The fitted mapping coefficients can be updated periodically based on newly added historical operating data, ensuring that the sampling interval adjustment logic always matches the actual operating characteristics of the suspended ball frame.
[0050] To clarify the standardized format of the historical data samples used for fitting the mapping coefficients, the following sample specification table is constructed: Table 4. Historical Data Sample Specification Table for Mapping Coefficient Fitting
[0051] This table provides a standardized format for historical data samples used to fit the mapping coefficients. The samples are grouped according to the classification results of motion patterns. Each group of samples contains corresponding historical trace data and historical sampling interval data. The timestamps ensure the validity of the time sequence of the samples. Based on the sample data in this standardized format, the linear regression equation can be constructed and fitted using the least squares method to obtain mapping coefficients that conform to the running characteristics of the ball rack.
[0052] This embodiment constructs a linear regression equation based on the historical operating data of the suspended ball rack, and obtains the mapping coefficient corresponding to the sampling interval adjustment through least squares fitting. This ensures that the dynamic adjustment logic of the sampling interval matches the actual historical operating characteristics of the ball rack, guaranteeing the rationality and stability of the sampling interval adjustment, and avoiding the problem of mismatch between the adjustment range and the operating state of the ball rack caused by fixed mapping coefficients.
Claims
1. A machine learning-based method for identifying and adaptively controlling the motion state of a suspended ball frame, characterized in that, include: Obtain the original angle data of the suspended ball stand; The original angle data is input into a Kalman filter, which outputs the estimated angle state, estimated angular velocity state, and estimated covariance matrix of the suspended ball frame. The estimated angle state and the estimated angular velocity state are input into the machine learning model, and the motion pattern classification result and the corresponding process noise parameter are output. The motion pattern classification result includes stationary state and motion state. Based on the motion pattern classification result and the trace of the estimated covariance matrix, the sampling interval for the next time step is calculated and output. When the motion pattern classification result indicates a motion state and the trace increases, the sampling interval is decreased; when the motion pattern classification result indicates a stationary state and the trace decreases, the sampling interval is increased. The process noise parameters are updated in the Kalman filter; Based on the estimated angle state value, the estimated angular velocity state value, and the dynamic early warning threshold associated with the sampling interval, an alarm signal for the suspended ball frame is output.
2. The method for motion state recognition and adaptive control of a suspended ball frame based on machine learning according to claim 1, characterized in that, The steps of inputting the original angle data into a Kalman filter and outputting the angle state estimate, angular velocity state estimate, and estimated covariance matrix of the suspended ball frame include: constructing a two-dimensional state vector containing the angle state estimate and the angular velocity state estimate, and establishing an observation equation using the original angle data as the observation vector; Calculate the prior state estimate for the current time step using the prior state estimate from the previous time step and the state transition matrix; The posterior state estimate at the current moment is calculated using the Kalman gain matrix, the observation vector, and the prior state estimate. The posterior state estimate is then decomposed into the angle state estimate and the angular velocity state estimate. The estimated covariance matrix at the current time is calculated based on the Kalman gain matrix and the prior estimated covariance matrix.
3. The method for identifying and adaptively controlling the motion state of a suspended ball frame based on machine learning according to claim 1, characterized in that, The steps of inputting the angle state estimate and the angular velocity state estimate into a machine learning model and outputting motion pattern classification results and corresponding process noise parameters include: constructing a temporal feature matrix using the angle state estimate and the angular velocity state estimate within a set time window; The temporal feature matrix is input into a pre-trained long short-term memory network, and the feature vector is output through the hidden layer of the long short-term memory network. The feature vector is input into a fully connected layer and a Softmax activation function, and the output is the probability value of belonging to the stationary state and the motion state. The one with the largest probability value is taken as the motion mode classification result. The feature vector is input into another fully connected layer and a linear activation function, and the specific value of the process noise parameter corresponding to the motion pattern classification result is output.
4. The method for identifying and adaptively controlling the motion state of a suspended ball frame based on machine learning according to claim 1, characterized in that, The step of calculating and outputting the sampling interval for the next time step based on the motion pattern classification result and the trace of the estimated covariance matrix includes: summing the diagonal elements of the estimated covariance matrix to obtain the trace; Set a basic sampling interval and a maximum sampling interval. When the motion pattern classification result is a motion state, calculate the product of the trace and a preset first mapping coefficient, and use the result of subtracting the product from the basic sampling interval as the sampling interval for the next moment. When the motion pattern classification result is a stationary state, the product of the trace and the preset second mapping coefficient is calculated, and the result of adding the product to the basic sampling interval is used as the sampling interval for the next moment. When the calculated sampling interval exceeds the maximum sampling interval, the sampling interval at the next moment is set to the maximum sampling interval.
5. The method for identifying and adaptively controlling the motion state of a suspended ball frame based on machine learning according to claim 1, characterized in that, The step of outputting an alarm signal for a suspended ball stand based on the estimated angle state value, the estimated angular velocity state value, and a dynamic warning threshold associated with the sampling interval includes: obtaining the reciprocal of the sampling interval as the current sampling frequency; The current sampling frequency is input into a preset threshold lookup table, and the corresponding angle warning threshold and angular velocity warning threshold are matched and output. The angle warning threshold and angular velocity warning threshold recorded in the threshold lookup table are positively correlated with the current sampling frequency. Determine whether the estimated angle state value is greater than the angle warning threshold, and whether the estimated angular velocity state value is greater than the angular velocity warning threshold; When both exceed the corresponding warning threshold, a high-level signal is generated as the alarm signal for the suspended ball frame; otherwise, a low-level signal is generated.
6. The method for identifying and adaptively controlling the motion state of a suspended ball frame based on machine learning according to claim 1, characterized in that, It also includes the step of constructing a structured data record from the data generated at each moment and storing it in a state feature database: using the current timestamp as the primary key, and using the angle state estimate, the angular velocity state estimate, the trace of the estimated covariance matrix, the motion pattern classification result, the process noise parameter, and the sampling interval as fields to generate a structured data record; According to the time sequence of the primary key, the structured data records are inserted into the inverted index linked list of the state feature database; Update the pointers of the index nodes in the inverted index list that correspond to the motion pattern classification results, and point the pointers of the index nodes to the storage address of the currently inserted structured data record.
7. The machine learning-based method for identifying and adaptively controlling the motion state of a suspended ball frame according to claim 2, characterized in that, The step of calculating the estimated covariance matrix at the current time based on the Kalman gain matrix and the prior estimated covariance matrix includes: obtaining the estimated covariance matrix updated at the previous time, constructing a noise covariance matrix by combining the state transition matrix and the process noise parameters at the previous time, and calculating the prior estimated covariance matrix at the current time through matrix multiplication and addition operations. The Kalman gain matrix is obtained by combining the observation noise covariance matrix at the current moment, the observation matrix corresponding to the observation equation, and the prior estimated covariance matrix through matrix inversion and multiplication. Calculate the difference between the identity matrix and the Kalman gain matrix, multiply the difference by the prior estimated covariance matrix, and output the estimated covariance matrix at the current time.
8. The method for identifying and adaptively controlling the motion state of a suspended ball frame based on machine learning according to claim 3, characterized in that, Before inputting the temporal feature matrix into the pre-trained long short-term memory network, the method further includes the steps of weight retrieval and loading of the long short-term memory network: extracting the matrix dimension of the currently input temporal feature matrix and the window length of the set time window, and combining them to generate a feature retrieval identifier; In the preset model weight library, using the feature retrieval identifier as the retrieval key, traverse the leaf nodes of multiple B+ tree index structures and match the target leaf node that has the same prefix as the feature retrieval identifier. Read the weight matrix and bias vector corresponding to each hidden layer in the Long Short-Term Memory network from the physical storage block pointed to by the target leaf node, and load the read weight matrix and bias vector into the corresponding network layer of the Long Short-Term Memory network.
9. The machine learning-based motion state recognition and adaptive control method for a suspended ball frame according to claim 4, characterized in that, In the step of calculating the product of the trace and the preset first mapping coefficient, the method for determining the preset first mapping coefficient includes: acquiring multiple sets of historical trace data and historical sampling interval data recorded when the motion pattern classification result is a motion state within a historical time period; A linear regression equation is constructed using the historical trace data as the independent variable and the historical sampling interval data as the dependent variable. The linear regression equation is fitted using the least squares method, and the slope of the linear regression equation is calculated. Take the reciprocal of the absolute value of the slope, and set the result of taking the reciprocal as the preset first mapping coefficient, wherein the preset second mapping coefficient is set in the same way as the preset first mapping coefficient.
10. The machine learning-based motion state recognition and adaptive control method for a suspended ball frame according to claim 6, characterized in that, The step of updating the pointer of the index node corresponding to the motion pattern classification result in the inverted index list includes: obtaining the text string of the motion pattern classification result, and performing a hash calculation on the text string to obtain a hash value; Search for the head pointer of the linked list that matches the hash value in the global hash table of the state feature database; Traverse each node in the inverted index linked list along the head pointer and read the timestamp of the historical structured data record stored in each node; The timestamp of the currently inserted structured data record is compared with each of the read timestamps. The node with the largest timestamp in the inverted index list is taken as the target node, and the index node pointer in the target node is updated to the storage address of the currently inserted structured data record.