Intelligent gateway control method and system based on attitude operation
By using the quaternion method's attitude calculation algorithm and magnetometer optimization technology in the intelligent gateway, the automatic configuration and network optimization of the intelligent gateway are realized, solving the problem of complex configuration of the existing intelligent gateway in different environments, and improving the equipment stability and efficiency, and ensures the stability of data transmission.
Patent Information
- Application Number
- CN202411436520.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2025-01-21
AI Technical Summary
Existing smart gateways have complexity and inflexibility in device configuration and network settings, making it difficult to adapt to stable and efficient work in different environments.
Using the attitude calculation algorithm based on the quaternion method, the angular velocity, acceleration and magnetic field data are collected through the built-in sensor group of the smart gateway, and the attitude data is analyzed and processed to realize the automatic data equipment configuration and network configuration of the smart gateway, and through the magnetometer Optimize heading angle and dynamically adjust data transfer rate.
The automatic configuration and network optimization of intelligent gateways in different environments have improved the stability and efficiency of the device, reducing the needs of manual intervention, and automatically switched to the backup network when the network quality decreases to ensure the stability and stability of data transmission and reliability.
Smart Images

Figure CN119341938A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent gateways, and in particular to an intelligent gateway control method and system based on gesture operation. Background Art
[0002] Currently, the Industrial Internet has been widely used in many fields such as manufacturing, logistics, and energy. In these industries, smart gateways play an important role by connecting various devices to provide remote monitoring, real-time data collection, analysis, and operation and maintenance management functions. This can not only realize the intelligent management of the production process, but also help enterprises optimize resource allocation, improve energy efficiency, and reduce operating costs.
[0003] In the manufacturing industry, smart gateways can monitor production equipment in real time and provide early warnings of equipment health status through data analysis to prevent failures, reduce unnecessary downtime, and improve production efficiency. In the logistics industry, smart gateways are used to monitor transportation environment data in real time, such as temperature, humidity, and light, to ensure the safety of goods during transportation and optimize logistics processes through data analysis. In the energy industry, smart gateways can monitor the operating status of energy equipment to ensure that equipment operates under optimal conditions, reduce energy consumption, and improve production efficiency.
[0004] The use of intelligent gateways is usually accompanied by a large amount of data transmission and processing. Therefore, before actual use, detailed device configuration and network settings must be performed to ensure that the gateway can work stably and efficiently in various environments. At the same time, the network configuration of the gateway must be adjusted according to the usage scenario to select the most appropriate communication method (such as Wi-Fi, cellular network, etc.) to ensure that data can be smoothly transmitted and analyzed, thereby providing strong support for the digital and intelligent transformation of enterprises. Therefore, the present invention proposes a method and system for controlling an intelligent gateway based on gesture operation. Summary of the invention
[0005] In view of the problems in the related art, the present invention proposes a smart gateway control method and system based on gesture operation to overcome the above-mentioned technical problems existing in the existing related art.
[0006] To this end, the specific technical solution adopted by the present invention is as follows:
[0007] According to one aspect of the present invention, there is provided a method for controlling an intelligent gateway based on gesture operation, comprising the following steps:
[0008] S 1. Based on the quaternion method, the posture calculation algorithm is used to analyze and obtain the posture data of the intelligent gateway, and the data device configuration and network configuration of the intelligent gateway are implemented according to the posture data;
[0009] S2. Establish a communication connection between the smart gateway and each smart gateway node, and collect environmental temperature, humidity and light intensity data in real time through the smart gateway node;
[0010] S3. Based on the configured intelligent gateway and the dynamically adjusted data transmission rate, the collected data is uploaded to the cloud server and mobile terminal for storage and display.
[0011] Preferably, the quaternion-based attitude calculation algorithm analyzes and obtains attitude data of the intelligent gateway, and implements data device configuration and network configuration of the intelligent gateway according to the attitude data, including the following steps:
[0012] S 11. Using a sensor group preset inside the smart gateway, collect angular velocity, acceleration and magnetic field data of the smart gateway, and remove abnormal data according to the analysis results of the mean and standard deviation;
[0013] S12, optimizing the heading angle based on the magnetic field data, and dynamically adjusting the weights of the angular velocity, acceleration and magnetic field data according to the magnetic field and vibration data;
[0014] S 13. The attitude solution algorithm based on the quaternion method is combined with the adjusted weight to fuse the angular velocity and acceleration data, analyze and obtain the Euler angle of the intelligent gateway, and implement the data device configuration and network configuration of the intelligent gateway according to the Euler angle.
[0015] Preferably, the method of collecting the angular velocity, acceleration and magnetic field data of the intelligent gateway by using a sensor group preset inside the intelligent gateway, and removing abnormal data according to the analysis results of the mean and standard deviation includes the following steps:
[0016] S 111. Use the gyroscope, accelerometer and magnetometer preset in the intelligent gateway to respectively measure the angular velocity, acceleration and magnetic field data of the intelligent gateway, and correct the angular velocity measured by the gyroscope based on the filtered attitude error and the correction amount of the attitude angle to obtain the corrected angular velocity; S 112. Calculate the mean and standard deviation of each sensor output value to obtain a standardized value, and determine whether the standardized value meets the preset standardized threshold value. If not, determine that the output value is normal data. If so, determine that the output value is abnormal, and remove the abnormal data;
[0017] The formula for calculating the normalized value is:
[0018]
[0019] Where Z represents the standardized value, X represents the output value of the current sensor, μ represents the mean, and σ represents the standard deviation.
[0020] Preferably, the optimizing the heading angle based on the magnetic field data and dynamically adjusting the weights of the angular velocity, acceleration and magnetic field data according to the magnetic field and vibration data comprises the following steps:
[0021] S121. Obtain magnetic field data of the intelligent gateway, and perform hard iron effect correction, soft iron effect correction and normalization processing on the magnetic field data respectively;
[0022] S 122. Calculate the heading angle of the magnetometer according to the processed magnetic field data, and use the heading angle of the magnetometer to correct the current heading angle of the gyroscope;
[0023] The calculation formula of the heading angle of the magnetometer is:
[0024] Yaw=arctan2(M y , M x )
[0025] Where Yaw is the heading angle of the magnetometer, M y and M x They represent the magnetic field components in the y-axis and x-axis directions measured by the magnetometer respectively;
[0026] S 123. Analyze the current magnetic field interference and vibration conditions of the intelligent gateway based on the magnetic field data and the vibration data, and dynamically adjust the weights of the acceleration, angular velocity, and magnetic field data according to the analysis results.
[0027] Preferably, the analyzing the current magnetic field interference and vibration conditions of the intelligent gateway based on the magnetic field data and the vibration data, and dynamically adjusting the weights of the acceleration, angular velocity and magnetic field data according to the analysis results includes the following steps:
[0028] S1231. Calculate the difference between the measured value of the magnetic field strength and the magnetic field strength when the device is working normally, and determine whether the absolute value of the difference exceeds a preset difference threshold. If so, determine that a high magnetic interference environment exists; if not, determine that a high magnetic interference environment does not exist.
[0029] S 1232. Calculate the acceleration change value of the intelligent gateway, and determine whether the acceleration change value exceeds a preset acceleration change threshold value. If so, determine that vibration interference exists in the current environment; if not, determine that vibration interference does not exist in the current environment.
[0030] The calculation formula for the acceleration change is:
[0031]
[0032] In the formula, Δa represents the change in acceleration, a x Represents the acceleration component in the x-axis direction at the current moment, a yRepresents the acceleration component in the y-axis direction at the current moment, a z Represents the acceleration component in the z-axis direction at the current moment, a x0 represents the acceleration component in the x-axis direction at the reference time, a y0 represents the acceleration component in the y-axis direction at the reference time, a z0 Represents the acceleration component in the z-axis direction at the reference time;
[0033] S1233. Dynamically adjust the weights of acceleration, angular velocity and magnetic field data according to the analysis results of high magnetic interference and vibration interference;
[0034] In a high magnetic environment, the adjusted weights are:
[0035]
[0036] In a vibration environment, the adjusted weights are:
[0037]
[0038] In the presence of high magnetic field and vibration environment, the adjusted weights are:
[0039]
[0040] In the formula, w m,new represents the adjusted magnetic field data weight, w m,old Represents the original weight of the magnetic field data, w g,new Represents the adjusted angular velocity weight, w g,old Represents the original weight of angular velocity, w a,new Represents the adjusted acceleration weight, w a,old represents the original weight of acceleration, ΔB represents the change in magnetic field strength, k v represents the adjustment factor under vibration environment, k m represents the adjustment factor in high magnetic field environment, k n Indicates the adjustment factor in the presence of high magnetic field and vibration environment.
[0041] Preferably, the quaternion-based attitude solution algorithm combines the adjusted weighted fusion angular velocity and acceleration data to analyze and obtain the Euler angle of the intelligent gateway, and implements the data device configuration and network configuration of the intelligent gateway according to the Euler angle, including the following steps:
[0042] S 131. Obtain angular velocity and acceleration data of the intelligent gateway, and normalize the acceleration data;
[0043] S132, through quaternion Q 1(q0, q1, q2, q3) represents the posture of the smart gateway, where Q 1 Indicates the posture of the smart gateway, q0 represents half of the cosine value of the angle between the rotation axis and the positive direction of the initial coordinate system, q1 represents half of the sine value of the component of the rotation axis in the x-axis direction and the rotation angle, q2 represents half of the sine value of the component of the rotation axis in the y-axis direction and the rotation angle, and q3 represents half of the sine value of the component of the rotation axis in the z-axis direction and the rotation angle;
[0044] S 133. Based on the first-order Runge-Kutta method, the attitude quaternion is preliminarily updated by combining the measurement data of the sensor and the current attitude quaternion;
[0045] The initial update formula of the attitude quaternion is:
[0046]
[0047] θ=ω.Δt
[0048] In the formula, q new Represents the initial updated attitude quaternion, q old Represents the current attitude quaternion, q delta represents the quaternion increment due to rotation, represents quaternion multiplication, θ represents the rotation vector, θ x ,θ y ,θ z They represent the components of the rotation angle in the x, y, and z directions respectively, and Δt represents the time interval;
[0049] S134, using Kalman filtering technology combined with adjusted weights to fuse angular velocity and acceleration data to obtain optimal attitude estimation;
[0050] The expression of state prediction is:
[0051]
[0052] The expression for covariance prediction is:
[0053] P k+1|k =F·P k|k ·F T +Q
[0054] The expression of Kalman gain is:
[0055] K k+1 =P k+1|k ·H T (H.P k+1|k ·H T +R) -1
[0056] The expression for state update is:
[0057]
[0058] The expression for updating the covariance matrix of the estimated error is:
[0059] P k+1|k+1 =(IK k+1 ·H)P k+1|k
[0060] In the formula, represents the optimal estimate of the state at time step k+1 given the information at time step k, represents the optimal estimate of the state at time step k given the information at time step k, represents the optimal estimate of the state at time step k+1 given the measurement information at time step k+1, F represents the state transfer matrix, P k+1|k represents the estimated covariance matrix at time step k+1 given the information at time step k, P k|k represents the estimated covariance matrix of the state at time step k given the information at time step k, P k+1|k+1 represents the estimated covariance matrix at time step k+1 given the measurement information at time step k+1, T represents the transpose of the matrix, Q represents the process noise covariance matrix, K k+1 represents the Kalman gain used to determine the effect of measurement update on state estimation, H represents the observation matrix, R represents the observation noise covariance matrix, z k+1 represents the measurement value at time step k+1, and I represents the identity matrix;
[0061] S135, calculating the cross product of the gravity acceleration vector and the estimated gravity vector to obtain an attitude error, and integrating the attitude error based on a discrete integral formula to obtain a correction amount of the attitude angle;
[0062] The calculation formula of attitude error is:
[0063]
[0064] The calculation formula of the correction amount of the attitude angle is:
[0065] θ corr =∫edt≈e·Δt
[0066] Where e represents the attitude error vector, represents the gravitational acceleration vector, represents the estimated gravity vector, θ corr It represents the correction amount of attitude angle, Δt represents the time interval;
[0067] S136, filtering the attitude error by complementary filtering or Kalman filtering, and updating the attitude quaternion again according to the filtered attitude error;
[0068] The update formula of the attitude quaternion is:
[0069]
[0070] In the formula, q′ new Represents the updated attitude quaternion, q error represents the error between the initial updated posture and the filtered posture, e x 、e y 、e z Respectively represent the components of the attitude error vector e in the x-axis, y-axis, and z-axis directions;
[0071] S137, correcting the angular velocity according to the filtered attitude error combined with the correction amount of the attitude angle, and converting the updated attitude quaternion into a direction cosine matrix, and then converting the direction cosine matrix into Euler angles;
[0072] S138. Analyze the specific posture action of the intelligent gateway according to the calculated posture angle, and implement data device configuration and network configuration of the intelligent gateway according to the specific posture action.
[0073] Preferably, the expression of the direction cosine matrix is:
[0074]
[0075] The conversion formula of Euler angle is:
[0076] θ p =sin -1 [2(q2q3+q0q1)]
[0077]
[0078] Where R(q) represents the direction cosine matrix, θ p ,θ r ,θ y They represent pitch angle, roll angle and heading angle respectively.
[0079] Preferably, the analyzing the specific posture action of the intelligent gateway according to the calculated posture angle, and implementing the data device configuration and network configuration of the intelligent gateway according to the specific posture action includes:
[0080] When the roll angle is less than -45 degrees, it is judged as left-handed, and when the roll angle is greater than 45 degrees, it is judged as right-handed. The left and right-handed are configured as menu options to switch up and down;
[0081] When the pitch angle is less than -45 degrees, it is judged as forward tilt, and when the pitch angle is greater than 45 degrees, it is judged as backward tilt. The forward tilt is configured to enter the current menu interface, and the backward tilt is configured to exit the current menu interface;
[0082] When the pitch angle and roll angle are both less than 45 degrees and the gravity acceleration is greater than 2g, it is determined that the smart gateway has collided with the desktop and the networking operation is performed.
[0083] Preferably, the calculation formula for dynamically adjusting the data transmission rate is:
[0084]
[0085] Where Bitrate New Indicates the adjusted data transmission rate, Bitrate Current Indicates the current data transmission rate, Quality Current Indicates the quality of the current data. Target Indicates the target quality of the data.
[0086] According to another aspect of the present invention, there is provided an intelligent gateway control system based on gesture operation, the intelligent gateway control system based on gesture operation comprising an intelligent gateway configuration module, a real-time data acquisition module and a real-time data display module;
[0087] The intelligent gateway configuration module is used to analyze and obtain the attitude data of the intelligent gateway based on the attitude calculation algorithm of the quaternion method, and implement the data device configuration and network configuration of the intelligent gateway according to the attitude data;
[0088] The real-time data acquisition module is used to establish a communication connection between the intelligent gateway and each intelligent gateway node, and to collect environmental temperature, humidity and light intensity data in real time through the intelligent gateway node;
[0089] The real-time data display module is used to upload the collected data to the cloud server and the mobile terminal for storage and display based on the configured intelligent gateway and the dynamically adjusted data transmission rate.
[0090] The beneficial effects of the present invention are:
[0091] 1) The present invention can use intelligent gateway technology to carry out automatic testing of environmental temperature, humidity, and illumination, realizing sensor detection of the environment and transmission and remote monitoring of wireless sensor networks; at the same time, posture detection is performed based on posture sensors to realize motion control sensor networking, that is, the gateway is connected to the network after collision or tipping over, which increases the fun of sensor networking operations.
[0092] 2) The present invention obtains accurate posture change information by filtering the measurement data of acceleration and angular velocity of the six-axis sensor in the intelligent gateway, so that the posture change information can be used to switch the display interface and menu options, replacing the key operations on the current common instruments and meters, completing the sensor device management and network configuration scheme, and then realizing intelligent posture human-computer interaction, with the characteristics of small size and low power consumption.
[0093] 3) The present invention optimizes the heading angle by introducing a magnetometer, thereby not only providing a stable heading angle estimation, reducing the influence of gyroscope drift, and improving the accuracy of attitude estimation, but also being able to better adapt to attitude changes in long-term measurements and complex environments when combined with a magnetometer, providing a more stable output. At the same time, using a magnetometer for compensation can effectively reduce the cumulative error caused by such drift.
[0094] 4) The present invention dynamically adjusts the weights of angular velocity, acceleration and magnetic field data through magnetic field and vibration data, thereby effectively compensating for sensor errors caused by environmental factors, improving the accuracy of attitude estimation, and maintaining stable performance under different operating conditions, thereby being able to maintain optimal performance under different environmental conditions.
[0095] 5) The present invention can not only automatically calibrate the sensor when abnormal data is detected, thereby reducing the need for manual intervention and ensuring the accuracy of attitude estimation in long-term operation, but also regularly calibrate the sensor to reduce the impact of drift.
[0096] 6) The present invention can dynamically adjust the data transmission rate through an adaptive algorithm, so that when a decrease in network quality is detected, it can automatically switch to a backup network, thereby improving the stability and reliability of data transmission and ensuring smooth data communication in various network environments. BRIEF DESCRIPTION OF THE DRAWINGS
[0097] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only 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.
[0098] Figure 1 is a flow chart of a method for controlling an intelligent gateway based on gesture operation according to an embodiment of the present invention;
[0099] Figure 2 is a schematic diagram of measurement parameters of the six-axis sensor MPU6050 according to an embodiment of the present invention;
[0100] Figure 3is a schematic diagram of the principle of attitude solution based on temperature compensation and Kalman filter algorithm according to an embodiment of the present invention;
[0101] Figure 4 The present invention is a flow chart of posture judgment in a method for controlling an intelligent gateway based on posture operation according to an embodiment of the present invention. DETAILED DESCRIPTION
[0102] To further illustrate each embodiment, the present invention provides drawings, which are part of the disclosure of the present invention and are mainly used to illustrate the embodiments and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these contents, ordinary technicians in the field should be able to understand other possible implementations and advantages of the present invention. The components in the figures are not drawn to scale, and similar component symbols are generally used to represent similar components.
[0103] According to an embodiment of the present invention, a method and system for controlling an intelligent gateway based on gesture operation are provided.
[0104] The present invention is further described with reference to the accompanying drawings and specific embodiments. Figure 1-Figure 4 As shown, according to one embodiment of the present invention, a method for controlling an intelligent gateway based on gesture operation is provided, comprising the following steps:
[0105] S 1. Based on the quaternion method, the posture calculation algorithm is used to analyze and obtain the posture data of the intelligent gateway, and the data device configuration and network configuration of the intelligent gateway are implemented according to the posture data;
[0106] In this embodiment, the intelligent gateway uses a cost-effective six-axis attitude sensor (inertial measurement unit, IMU) MPU6050 to measure attitude. The coordinate system of the MPU6050 chip is defined as follows: Figure 2 As shown;
[0107] IMU measurement principle: MPU6050 can obtain acceleration in three axes and angular velocity in three axes (i.e. accelerometer and gyroscope). However, the acceleration sensor does not distinguish between gravity acceleration and external force acceleration. It can measure acceleration, including gravity acceleration. Therefore, when it is stationary or in uniform motion (uniform linear motion), the accelerometer only measures gravity acceleration, and gravity acceleration is fixed to the coordinate system (absolute coordinate system). Through this relationship, the angular relationship between the plane where the accelerometer is located and the ground, that is, the roll angle (Roll) and pitch angle (Pitch), can be obtained.
[0108] IMU attitude solution: The three-axis components ACC_X, ACC_Y and ACC_Z of the accelerometer are all 16-bit signed integers, which represent the acceleration of the device in the three axes. When the value is negative, the acceleration is along the negative direction of the coordinate axis, and when the value is positive, it is along the positive direction. The angular velocity components GYR_X, GYR_Y and GYR_Z of the gyroscope rotating around the three coordinate axes X, Y and Z are all 16-bit signed integers. Looking from the origin to the direction of the rotation axis, when the value is positive, it rotates clockwise, and when the value is negative, it rotates counterclockwise. The Kalman filter is used to fuse the attitude data of the accelerometer and gyroscope multi-sensor, and the statistical characteristics of the measurement model are used to recursively obtain the optimal fusion and data estimation in a statistical sense. The inertial measurement unit (IMU) system has a linear dynamic model, and the errors between the system and the sensor conform to the Gaussian white noise model, which can provide the only statistically optimal estimate for the fused data.
[0109] like Figure 3 As shown in the figure, the attitude solution based on temperature compensation and Kalman filter algorithm is performed to obtain 5 accurate attitudes of the module from the surface. The azimuth angle solution of Kalman filter adopts the attitude solution based on quaternion method. The attitude solution based on quaternion can convert the quaternion data into the elements of direction cosine matrix, and then convert it into Euler angle, that is, attitude.
[0110] Quaternion and its relationship with attitude angle: Quaternion attitude calculation is a method commonly used in the aerospace field. It uses quaternions to describe the attitude of an object in three-dimensional space. Quaternion is a mathematical tool that contains a real part and three imaginary parts and can be used to represent rotation. Attitude calculation is to derive the attitude information of an object, that is, the rotation angle or direction, based on the data measured by the sensor.
[0111] Specifically, the quaternion-based attitude calculation algorithm analyzes and obtains attitude data of the intelligent gateway, and implements data device configuration and network configuration of the intelligent gateway according to the attitude data, including the following steps:
[0112] S 11. Using a sensor group preset inside the smart gateway, collect angular velocity, acceleration and magnetic field data of the smart gateway, and remove abnormal data according to the analysis results of the mean and standard deviation;
[0113] Specifically, the method of collecting the angular velocity, acceleration and magnetic field data of the intelligent gateway by using the sensor group preset inside the intelligent gateway, and removing abnormal data according to the analysis results of the mean and standard deviation includes the following steps:
[0114] S111, using the gyroscope, accelerometer and magnetometer preset in the smart gateway to respectively measure the angular velocity, acceleration and magnetic field data of the smart gateway, and correct the angular velocity measured by the gyroscope based on the filtered attitude error and attitude angle correction (that is, for the zero bias drift calibration of the gyroscope, calibration is performed using data in a static state), to obtain the corrected angular velocity;
[0115] S112, calculating the mean and standard deviation of each sensor output value to obtain a standardized value, and determining whether the standardized value meets a preset standardized threshold value, if not, determining that the output value is normal data, if yes, determining that the output value is abnormal, and removing the abnormal data;
[0116] The formula for calculating the normalized value is:
[0117]
[0118] Where Z represents the standardized value, X represents the output value of the current sensor, μ represents the mean, and σ represents the standard deviation.
[0119] S12, optimizing the heading angle based on the magnetic field data, and dynamically adjusting the weights of the angular velocity, acceleration and magnetic field data according to the magnetic field and vibration data;
[0120] In this embodiment, introducing a magnetometer for attitude compensation is an effective method to improve the heading angle (Yaw) estimation in the six-axis attitude sensor (IMU) system. The following is a detailed description of how to implement and optimize this method:
[0121] 1. Working principle of magnetometer
[0122] A magnetometer can measure the three-axis components of the Earth's magnetic field, which can be used to determine the orientation of a device in three-dimensional space. Unlike accelerometers and gyroscopes, magnetometers are not affected by accumulated errors over a short period of time, making them suitable for correcting errors caused by gyroscope drift.
[0123] 2. Magnetometer data fusion in attitude solution
[0124] In the process of attitude solution, the magnetometer provides a reference geomagnetic direction, which is usually used to correct the heading angle (Yaw). Since the heading angle mainly depends on the integral operation of the gyroscope, and the gyroscope is easily affected by drift errors, the errors will gradually accumulate over a long period of use, resulting in inaccurate heading angle estimation. Introducing magnetometer data can provide a reliable geomagnetic reference to correct this drift error.
[0125] 3. Preprocessing of magnetometer data
[0126] Magnetometer data usually needs to be preprocessed as follows before use:
[0127] a. Hard iron effect correction: interference caused by strong magnetic fields in the external environment or magnetic materials inside the device, which will cause the measured geomagnetic field direction to shift. By calculating the offset vector for compensation, the influence of the hard iron effect can be reduced.
[0128] b. Soft iron effect correction: measurement error caused by the magnetic permeability of the material inside the device, which causes the proportion of the components of the geomagnetic field on each axis to change. This effect can be eliminated by correcting the data using methods such as ellipse fitting.
[0129] c. Normalization: The magnetic field strength measured by the magnetometer usually needs to be normalized to ensure that the data is not affected by different intensities during calculation.
[0130] 4. Implementation of posture fusion algorithm
[0131] Using magnetometers for attitude fusion usually involves the following steps:
[0132] 1. Heading angle calculation: Use the X and Y axis data of the magnetometer to calculate the heading angle (Yaw);
[0133] 2. Error correction: Use the heading angle of the magnetometer to correct the heading angle obtained by the gyroscope integration to prevent the accumulation of errors caused by drift during long-term use. Common methods include dynamically adjusting the heading angle through a complementary filter or a Kalman filter.
[0134] Specifically, the optimization of the heading angle based on the magnetic field data and the dynamic adjustment of the weights of the angular velocity, acceleration and magnetic field data according to the magnetic field and vibration data include the following steps:
[0135] S121, obtaining magnetic field data of the intelligent gateway, and performing hard iron effect correction, soft iron effect correction and normalization processing on the magnetic field data respectively;
[0136] S 122. Calculate the heading angle of the magnetometer according to the processed magnetic field data, and use the heading angle of the magnetometer to correct the current heading angle of the gyroscope;
[0137] The calculation formula of the heading angle of the magnetometer is:
[0138] Yaw=arctan2(M y , M x )
[0139] Where Yaw is the heading angle of the magnetometer, M y and M x They represent the magnetic field components in the y-axis and x-axis directions measured by the magnetometer respectively;
[0140] S123. Analyze the current magnetic field interference and vibration conditions of the smart gateway based on the magnetic field data and vibration data, and dynamically adjust the weights of the acceleration, angular velocity and magnetic field data according to the analysis results.
[0141] The method of analyzing the current magnetic field interference and vibration conditions of the smart gateway based on the magnetic field data and the vibration data, and dynamically adjusting the weights of the acceleration, angular velocity and magnetic field data according to the analysis results includes the following steps:
[0142] S1231. Calculate the difference between the measured value of the magnetic field strength and the magnetic field strength when the device is working normally, and determine whether the absolute value of the difference exceeds a preset difference threshold. If so, determine that a high magnetic interference environment exists; if not, determine that a high magnetic interference environment does not exist.
[0143] S1232, calculating the acceleration change value of the intelligent gateway, and determining whether the acceleration change value exceeds a preset acceleration change threshold value, if so, determining that there is a large vibration interference in the current environment, if not, determining that there is no large vibration interference in the current environment;
[0144] The calculation formula for the acceleration change is:
[0145]
[0146] In the formula, Δa represents the change in acceleration, which is a scalar that represents the distance between the current acceleration and the reference acceleration. x Represents the acceleration component in the x-axis direction at the current moment, a y Represents the acceleration component in the y-axis direction at the current moment, a z Represents the acceleration component in the z-axis direction at the current moment, a x0 represents the acceleration component in the x-axis direction at the reference time, a y0 represents the acceleration component in the y-axis direction at the reference time, a z0 Represents the acceleration component in the z-axis direction at the reference time;
[0147] S1233. Dynamically adjust the weights of acceleration, angular velocity and magnetic field data according to the analysis results of high magnetic interference and vibration interference;
[0148] In a high magnetic environment, the adjusted weights are:
[0149]
[0150] In a vibration environment, the adjusted weights are:
[0151]
[0152] In the presence of high magnetic field and vibration environment, the adjusted weights are:
[0153]
[0154] In the formula, w m,new represents the adjusted magnetic field data weight, w m,old Represents the original weight of the magnetic field data, w g,new Represents the adjusted angular velocity weight, w g,old Represents the original weight of angular velocity, w a,new Represents the adjusted acceleration weight, w a,old represents the original weight of acceleration, ΔB represents the change in magnetic field strength, which is used to determine whether there is a high magnetic field environment, and k v Represents the adjustment factor under vibration environment, which is used to quantify the impact of vibration intensity on weight, k m represents the adjustment factor in a high magnetic field environment, which is used to quantify the effect of changes in magnetic field strength on the weight, k n It represents the adjustment factor in the presence of high magnetic field and vibration environment, which is used to quantify the impact of vibration intensity and magnetic field intensity changes on the weight.
[0155] S13. The attitude solution algorithm based on the quaternion method is combined with the adjusted weight to fuse the angular velocity and acceleration data, analyze and obtain the Euler angle of the intelligent gateway, and implement the data device configuration and network configuration of the intelligent gateway according to the Euler angle.
[0156] Specifically, the quaternion-based attitude solution algorithm combines the adjusted weights to fuse the angular velocity and acceleration data, analyzes and obtains the Euler angle of the intelligent gateway, and implements the data device configuration and network configuration of the intelligent gateway according to the Euler angle, including the following steps:
[0157] S131, obtaining the angular velocity and acceleration data of the intelligent gateway, and normalizing the acceleration data to make its magnitude 1, thereby retaining only the posture information in the acceleration direction;
[0158] S132, through quaternion Q 1 (q0, q1, q2, q3) represents the posture of the smart gateway, where Q 1 Indicates the posture of the smart gateway, q0 represents half of the cosine value of the angle between the rotation axis and the positive direction of the initial coordinate system, q1 represents half of the sine value of the component of the rotation axis in the x-axis direction and the rotation angle, q2 represents half of the sine value of the component of the rotation axis in the y-axis direction and the rotation angle, and q3 represents half of the sine value of the component of the rotation axis in the z-axis direction and the rotation angle;
[0159] S133, based on the first-order Runge-Kutta method, preliminarily updating the attitude quaternion by combining the measurement data of the sensor and the current attitude quaternion;
[0160] The initial update formula of the attitude quaternion is:
[0161]
[0162] θ=ω·Δt
[0163] In the formula, q new Represents the initial updated attitude quaternion, q old Indicates the current posture quaternion, which is used to represent the current posture of the smart gateway. delta represents the quaternion increment due to rotation, represents quaternion multiplication, θ represents the rotation vector, that is, the integral of the angular velocity vector within the time interval Δt, which is used to represent the total amount of rotation, θ x ,θ y ,θ z They represent the components of the rotation angle in the x, y, and z directions, respectively, and Δt represents the time interval, that is, the time difference between two measurements;
[0164] S134, using Kalman filtering technology combined with adjusted weights to fuse angular velocity and acceleration data to obtain optimal attitude estimation;
[0165] The expression of state prediction is:
[0166]
[0167] The expression for covariance prediction is:
[0168] P k+1|k =F·P k|k ·F T +Q
[0169] The expression of Kalman gain is:
[0170] K k+1 =P k+1|k ·H T (H.P k+1|k ·H T +R) -1
[0171] The expression for state update is:
[0172]
[0173] The expression for updating the covariance matrix of the estimated error is:
[0174] P k+1|k+1 =(IK k+1 ·H)P k+1|k
[0175] In the formula, represents the optimal estimate of the state at time step k+1 given the information at time step k, represents the optimal estimate of the state at time step k given the information at time step k, represents the optimal estimate of the state at time step k+1 given the measurement information at time step k+1, F represents the state transfer matrix, P k+1|k represents the estimated covariance matrix at time step k+1 given the information at time step k, P k|k represents the estimated covariance matrix of the state at time step k given the information at time step k, P k+1|k+1 represents the estimated covariance matrix at time step k+1 given the measurement information at time step k+1, T represents the transpose of the matrix, Q represents the process noise covariance matrix, K k+1 represents the Kalman gain used to determine the effect of measurement update on state estimation, H represents the observation matrix, R represents the observation noise covariance matrix, z k+1 represents the measurement value at time step k+1, and I represents the unit matrix; S135, calculating the cross product of the gravity acceleration vector and the estimated gravity vector to obtain the attitude error, and integrating the attitude error based on the discrete integral formula to obtain the correction amount of the attitude angle;
[0176] The calculation formula of attitude error is:
[0177]
[0178] The calculation formula of the correction amount of the attitude angle is:
[0179] θ corr =∫edt≈e·Δt
[0180] Where e represents the attitude error vector, represents the gravitational acceleration vector, represents the estimated gravity vector, θ corr It represents the correction value of the attitude angle, which is used to correct the attitude of the smart gateway. Δt represents the time interval, which is used to calculate the integral.
[0181] S 136. Filtering the attitude error by complementary filtering or Kalman filtering, and updating the attitude quaternion again according to the filtered attitude error;
[0182] The update formula of the attitude quaternion is:
[0183]
[0184] In the formula, q′ new Represents the updated attitude quaternion, q errorIt represents the error between the initial updated attitude and the filtered attitude, and is used to update the attitude quaternion according to the filtered attitude error. x 、e y 、e z Respectively represent the components of the attitude error vector e in the x-axis, y-axis, and z-axis directions;
[0185] S137, correcting the angular velocity according to the filtered attitude error combined with the correction amount of the attitude angle, and converting the updated attitude quaternion into a direction cosine matrix, and then converting the direction cosine matrix into Euler angles;
[0186] The expression of the direction cosine matrix is:
[0187]
[0188] The conversion formula of Euler angle is:
[0189] θ p =sin -1 [2(q2q3+q0q1)]
[0190]
[0191] Where R(q) represents the direction cosine matrix, also known as the rotation matrix, which is used to rotate a vector from one coordinate system to another. p ,θ r ,θ y They represent the pitch angle (i.e. the forward and backward tilt angle of the object relative to the horizontal plane), the roll angle (i.e. the left and right tilt angle of the object along the longitudinal axis) and the heading angle (i.e. the rotation angle of the object relative to the geographic north).
[0192] S138. Analyze the specific posture action of the intelligent gateway according to the calculated posture angle, and implement data device configuration and network configuration of the intelligent gateway according to the specific posture action.
[0193] Specifically, analyzing the specific posture action of the intelligent gateway according to the calculated posture angle, and implementing the data device configuration and network configuration of the intelligent gateway according to the specific posture action includes:
[0194] like Figure 4 As shown, when the roll angle is less than -45 degrees, it is judged as falling to the left; when the roll angle is greater than 45 degrees, it is judged as falling to the right; when the pitch angle is less than -45 degrees, it is judged as leaning forward; when the pitch angle is greater than 45 degrees, it is judged as leaning backward; when the pitch angle and roll angle are both less than 45 degrees, and the gravity acceleration is greater than 2g, it is judged that the smart gateway has collided with the desktop;
[0195] According to ergonomic theory, place the front of the gateway in front of you, configure left and right to switch menu options up and down, lean forward to enter the current menu interface, and lean back to exit the current menu interface; in the network configuration interface, when it is detected that the gateway module collides with the desktop, the networking operation is performed.
[0196] In this embodiment, the network configuration and operation steps are as follows:
[0197] Step 1: After powering on, enter the network configuration interface, and display the network information to be connected. If the network information is incorrect, lean back through the posture control to enter the network configuration interface in step 2; if it is correct, lean forward through the posture control or collide with the desktop to enter step 3.
[0198] Step 2: Connect the PC to the hotspot opened by the gateway and log in to the webpage to configure the network. After completion, save the configuration and the network configuration interface will be updated. Use gesture control to lean forward or collide with the desktop to enter step 3.
[0199] Step 3: Connect to the network. If successful, proceed to step 4. If unsuccessful, return to step 1 and re-configure the network.
[0200] Step 4. After successfully connecting to the network, enter the operation interface. You can switch between the three interfaces of network time, weather, and sensor data by gesture control.
[0201] S2. Establish a communication connection between the smart gateway and each smart gateway node, and collect environmental temperature, humidity and light intensity data in real time through the smart gateway node;
[0202] Specifically, the intelligent gateway in this embodiment has a built-in voice playback module, a main control board and a Fibocom module;
[0203] Among them, the voice playback module can provide voice notifications and prompts when specific events occur in the system. For example, when a sensor detects an abnormal situation (such as high temperature, smoke, etc.), it can remind the user through voice broadcast, which enhances the user experience and the interactivity of the system. It also has a voice broadcast function when it is turned on, and the smart gateway node automatically broadcasts when it goes online and offline. It can also play weather time and sensor data in real time, and give suggestions based on the surrounding environment.
[0204] The main control board can collect data from multiple sensors. Sensor types include temperature sensors, humidity sensors, air quality sensors, motion sensors, etc. The main control board can collect various types of data from the environment and equipment in real time, perform preliminary processing on the collected data, and package it into a format suitable for transmission. The data is then uploaded to the cloud through the Fibocom communication module. This ensures that the data is not lost or damaged during transmission, while improving transmission efficiency. That is, the main control board can not only collect data, but also query and analyze the collected data. Through the user interface or remote control terminal, users can view real-time data or historical data records, and perform data analysis to obtain useful information. At the same time, users can also control connected devices through the system, such as turning on or off certain devices, adjusting device parameters, etc.
[0205] In addition, this embodiment can also integrate edge computing capabilities in the main control board to process and analyze data in real time, reduce data transmission delays, and improve response speed; use edge computing modules (Intel Movidius) to perform data preprocessing and analysis on the concentrator. The results of data processing directly generate reports or trigger events locally, thereby reducing dependence on the cloud.
[0206] Fibocom modules support multiple cellular networks, including 2G, 3G, 4G, and 5G. This means that even in areas where WiFi is not available, the device can still transmit data through the cellular network. Cellular connectivity is very important for sensor devices that need to be installed outdoors or in remote locations. The Fibocom module can upload the sensor data collected by ESP8266 to Huawei Cloud via the cellular network. This ensures the real-time and reliability of the data, and maintains stable data transmission no matter what environment the device is in. The Fibocom module can serve as a backup for WiFi connections. When the WiFi connection is unavailable, the device can automatically switch to the cellular network to ensure uninterrupted data transmission. This redundant design can improve the reliability and stability of the system.
[0207] Through the cellular network, users can send control commands to devices through Huawei Cloud to achieve remote control of the device. For example, when sending commands through the WeChat applet, the Fibocom module will pass the commands to ESP8266 after receiving them, thereby achieving control of the temperature and humidity sensor or other devices.
[0208] In this embodiment, the intelligent gateway node measures the current environmental temperature, humidity and light intensity through the BH1750 sensor and the AHT20 sensor. In addition, multimodal sensors, ultrasonic sensors and infrared sensors can be integrated into the intelligent gateway node to expand the scope and accuracy of environmental monitoring, that is, the ultrasonic sensor is used to detect distance changes and combined with the data of existing sensors (temperature, humidity, light intensity sensors). The infrared sensor is used to monitor objects or heat sources in the surrounding environment. The sensor data is processed by a data fusion algorithm (weighted average).
[0209] Formula: Assume that the ultrasonic sensor data is D US , infrared sensor data is D IR , the fused environmental data is: D Fused =αD US +βD IR , where D Fused Represents the fused data, which is usually the result of fusing data from multiple sensors. α represents the weight coefficient, which is used to adjust the ultrasonic sensor data D US The contribution of α to the fusion result. Usually, the value of α is between 0 and 1. US represents the data provided by the ultrasonic sensor, which may represent the distance measurement value or other information collected by the ultrasonic sensor. β represents the weight coefficient, which is used to adjust the infrared sensor data D IR The contribution of β to the fusion result. Usually, the value of β is also between 0 and 1. IR Represents the data provided by the infrared sensor, which may represent distance measurements or other information collected by the infrared sensor.
[0210] S3. Based on the configured intelligent gateway and the dynamically adjusted data transmission rate, the collected data is uploaded to the cloud server and mobile terminal for storage and display.
[0211] Specifically, during the data transmission process, when the network quality is detected to be degraded, it automatically switches to the backup network. At the same time, the data transmission rate is dynamically adjusted through the bandwidth adaptive algorithm (adaptive bit rate control). The calculation formula for dynamically adjusting the data transmission rate is:
[0212]
[0213] Where Bitrate New Indicates the adjusted data transmission rate, Bitrate Current Indicates the current data transmission rate, Quality Current Indicates the quality of the current data, that is, the quality level of the current video or audio, usually measured by indicators such as PSNR, SSIM, etc.Target The target quality of the data, i.e. the target quality level, is also measured by the same quality indicator.
[0214] In addition, in this embodiment, the mobile terminal can also collect and manage data for each intelligent gateway node, that is, the mobile terminal directly accesses the intelligent sensor device hardware node and sends a control command to the intelligent sensor device hardware node.
[0215] According to another embodiment of the present invention, there is provided an intelligent gateway control system based on gesture operation, the intelligent gateway control system based on gesture operation comprising an intelligent gateway configuration module, a real-time data acquisition module and a real-time data display module;
[0216] The intelligent gateway configuration module is used to analyze and obtain the attitude data of the intelligent gateway based on the attitude calculation algorithm of the quaternion method, and implement the data device configuration and network configuration of the intelligent gateway according to the attitude data;
[0217] The real-time data acquisition module is used to establish a communication connection between the intelligent gateway and each intelligent gateway node, and to collect environmental temperature, humidity and light intensity data in real time through the intelligent gateway node;
[0218] The real-time data display module is used to upload the collected data to the cloud server and the mobile terminal for storage and display based on the configured intelligent gateway and the dynamically adjusted data transmission rate.
[0219] In summary, with the help of the above technical solution of the present invention, the present invention can use intelligent gateway technology to carry out automatic testing of temperature, humidity and illumination of the environment, realize sensor detection of the environment and transmission and remote monitoring of wireless sensor networks; at the same time, posture detection is performed based on the posture sensor, and the action control sensor networking is realized, that is, the gateway is connected to the network after collision or dumping, and the interesting operation of sensor networking is increased. In addition, the present invention obtains accurate posture change information by filtering the measurement data of the acceleration and angular velocity of the six-axis sensor in the intelligent gateway, so that the posture change information can be used to switch the display interface and menu options, replace the key operation on the common instruments and meters, complete the sensor equipment management and network configuration scheme, and then realize intelligent posture human-computer interaction, which has the characteristics of small size and low power consumption. In addition, the present invention realizes the optimization processing of the heading angle by introducing a magnetometer, so that it can not only provide a stable heading angle estimation, reduce the influence of gyroscope drift, and improve the accuracy of posture estimation, but also can better adapt to the posture changes in long-term measurement and complex environment after combining the magnetometer, and provide a more stable output. At the same time, the use of the magnetometer for compensation can effectively reduce the cumulative error caused by such drift. In addition, the present invention dynamically adjusts the weights of angular velocity, acceleration and magnetic field data through magnetic field and vibration data, thereby effectively compensating for sensor errors caused by environmental factors, improving the accuracy of attitude estimation, and maintaining stable performance under different operating conditions, thereby maintaining optimal performance under different environmental conditions. In addition, the present invention can not only automatically calibrate the sensor when abnormal data is detected, thereby reducing the need for manual intervention and ensuring the accuracy of attitude estimation in long-term operation, but also regularly calibrate the sensor to reduce the impact of drift. In addition, the present invention can dynamically adjust the data transmission rate through an adaptive algorithm, so that it can automatically switch to a backup network when a decrease in network quality is detected, thereby improving the stability and reliability of data transmission and ensuring that data communication can be carried out smoothly in various network environments.
[0220] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A smart gateway control method based on gesture operation, characterized in that: The intelligent gateway control method based on gesture operation includes the following steps: S1. Based on the quaternion method, the posture calculation algorithm is used to analyze and obtain the posture data of the intelligent gateway, and the data device configuration and network configuration of the intelligent gateway are realized according to the posture data; S2. Establish a communication connection between the smart gateway and each smart gateway node, and collect environmental temperature, humidity and light intensity data in real time through the smart gateway node; S3. Based on the configured intelligent gateway and the dynamically adjusted data transmission rate, the collected data is uploaded to the cloud server and mobile terminal for storage and display.
2. According to claim 1, a method for controlling an intelligent gateway based on gesture operation is characterized in that: The quaternion-based attitude calculation algorithm analyzes and obtains attitude data of the intelligent gateway, and implements data device configuration and network configuration of the intelligent gateway according to the attitude data, including the following steps: S11, using the sensor group preset inside the smart gateway to collect the angular velocity, acceleration and magnetic field data of the smart gateway, and remove abnormal data according to the analysis results of the mean and standard deviation; S12, optimizing the heading angle based on the magnetic field data, and dynamically adjusting the weights of the angular velocity, acceleration and magnetic field data according to the magnetic field and vibration data; S13. The attitude solution algorithm based on the quaternion method is combined with the adjusted weight to fuse the angular velocity and acceleration data, analyze and obtain the Euler angle of the intelligent gateway, and implement the data device configuration and network configuration of the intelligent gateway according to the Euler angle.
3. According to claim 2, a method for controlling an intelligent gateway based on gesture operation is characterized in that: The method of collecting the angular velocity, acceleration and magnetic field data of the intelligent gateway by using the sensor group preset inside the intelligent gateway and removing abnormal data according to the analysis results of the mean and standard deviation includes the following steps: S111, using the gyroscope, accelerometer and magnetometer preset in the intelligent gateway to respectively measure the angular velocity, acceleration and magnetic field data of the intelligent gateway, and correct the angular velocity measured by the gyroscope based on the filtered attitude error and attitude angle correction amount to obtain the corrected angular velocity; S112, calculating the mean and standard deviation of each sensor output value to obtain a standardized value, and determining whether the standardized value meets a preset standardized threshold value. If not, determining that the output value is normal data; if so, determining that the output value is abnormal, and removing the abnormal data; The formula for calculating the normalized value is: Where Z represents the standardized value, X represents the output value of the current sensor, μ represents the mean, and σ represents the standard deviation.
4. According to claim 2, a method for controlling an intelligent gateway based on gesture operation is characterized in that: The method of optimizing the heading angle based on the magnetic field data and dynamically adjusting the weights of the angular velocity, acceleration and magnetic field data according to the magnetic field and vibration data includes the following steps: S121, obtaining magnetic field data of the intelligent gateway, and performing hard iron effect correction, soft iron effect correction and normalization processing on the magnetic field data respectively; S122, calculating the heading angle of the magnetometer according to the processed magnetic field data, and using the heading angle of the magnetometer to correct the current heading angle of the gyroscope; The calculation formula of the heading angle of the magnetometer is: Yaw=arctan2(M y ,M x ) Where Yaw is the heading angle of the magnetometer, M y and M x They represent the magnetic field components in the y-axis and x-axis directions measured by the magnetometer respectively; S123. Analyze the current magnetic field interference and vibration conditions of the smart gateway based on the magnetic field data and vibration data, and dynamically adjust the weights of the acceleration, angular velocity and magnetic field data according to the analysis results.
5. The method for controlling an intelligent gateway based on gesture operation according to claim 4, characterized in that: The method of analyzing the current magnetic field interference and vibration conditions of the smart gateway based on the magnetic field data and the vibration data, and dynamically adjusting the weights of the acceleration, angular velocity and magnetic field data according to the analysis results includes the following steps: S1231. Calculate the difference between the measured value of the magnetic field strength and the magnetic field strength when the device is working normally, and determine whether the absolute value of the difference exceeds a preset difference threshold. If so, determine that a high magnetic interference environment exists; if not, determine that a high magnetic interference environment does not exist. S1232, calculating the acceleration change value of the smart gateway, and determining whether the acceleration change value exceeds a preset acceleration change threshold value, if so, determining that there is vibration interference in the current environment, if not, determining that there is no vibration interference in the current environment; The calculation formula for the acceleration change is: In the formula, Δa represents the change in acceleration, a x Represents the acceleration component in the x-axis direction at the current moment, a y Represents the acceleration component in the y-axis direction at the current moment, a z Represents the acceleration component in the z-axis direction at the current moment, a x0 represents the acceleration component in the x-axis direction at the reference time, a y0 represents the acceleration component in the y-axis direction at the reference time, a z0 Represents the acceleration component in the z-axis direction at the reference time; S1233. Dynamically adjust the weights of acceleration, angular velocity and magnetic field data according to the analysis results of high magnetic interference and vibration interference; In a high magnetic environment, the adjusted weights are: In a vibration environment, the adjusted weights are: In the presence of high magnetic field and vibration environment, the adjusted weights are: In the formula, w m,new represents the adjusted magnetic field data weight, w m,old Represents the original weight of the magnetic field data, w g,new Represents the adjusted angular velocity weight, w g,old Represents the original weight of angular velocity, w a,new Represents the adjusted acceleration weight, W a,old represents the original weight of acceleration, ΔB represents the change in magnetic field strength, k v represents the adjustment factor under vibration environment, k m represents the adjustment factor in high magnetic field environment, k n Indicates the adjustment factor in the presence of high magnetic and vibration environments.
6. The method for controlling an intelligent gateway based on gesture operation according to claim 2, characterized in that: The quaternion-based attitude calculation algorithm combines the adjusted weights to fuse the angular velocity and acceleration data, analyzes and obtains the Euler angle of the intelligent gateway, and implements the data device configuration and network configuration of the intelligent gateway according to the Euler angle, including the following steps: S131, obtaining the angular velocity and acceleration data of the intelligent gateway, and normalizing the acceleration data; S132, through quaternion Q 1 (q0, q1, q2, q3) represents the posture of the smart gateway, where Q 1 Indicates the posture of the smart gateway, q0 represents half of the cosine value of the angle between the rotation axis and the positive direction of the initial coordinate system, q1 represents half of the sine value of the component of the rotation axis in the x-axis direction and the rotation angle, q2 represents half of the sine value of the component of the rotation axis in the y-axis direction and the rotation angle, and q3 represents half of the sine value of the component of the rotation axis in the z-axis direction and the rotation angle; S133, based on the first-order Runge-Kutta method, preliminarily updating the attitude quaternion by combining the measurement data of the sensor and the current attitude quaternion; The initial update formula of the attitude quaternion is: θ=ω·Δt In the formula, q new Represents the initial updated attitude quaternion, q old Represents the current attitude quaternion, q delta represents the quaternion increment due to rotation, represents quaternion multiplication, θ represents the rotation vector, θ x ,θ y ,θ z They represent the components of the rotation angle in the x, y, and z directions respectively, and Δt represents the time interval; S134, using Kalman filtering technology combined with adjusted weights to fuse angular velocity and acceleration data to obtain optimal attitude estimation; The expression of state prediction is: The expression for covariance prediction is: P k+1|k =F·P k|k ·F T +Q The expression of Kalman gain is: K k+1 =P k+1|k ·H T (H·P k+1|k ·H T +R) -1 The expression for state update is: The expression for updating the covariance matrix of the estimated error is: P k+1|k+1 =(I-K k+1 ·H)P k+1|k In the formula, represents the optimal estimate of the state at time step k+1 given the information at time step k, represents the optimal estimate of the state at time step k given the information at time step k, represents the optimal estimate of the state at time step k+1 given the measurement information at time step k+1, F represents the state transfer matrix, P k+1|k represents the estimated covariance matrix at time step k+1 given the information at time step k, P k|k represents the estimated covariance matrix of the state at time step k given the information at time step k, P k+1|k+1 represents the estimated covariance matrix at time step k+1 given the measurement information at time step k+1, T represents the transpose of the matrix, Q represents the process noise covariance matrix, K k+1 represents the Kalman gain used to determine the effect of measurement update on state estimation, H represents the observation matrix, R represents the observation noise covariance matrix, z k+1 represents the measurement value at time step k+1, and I represents the identity matrix; S135, calculating the cross product of the gravity acceleration vector and the estimated gravity vector to obtain an attitude error, and integrating the attitude error based on a discrete integral formula to obtain a correction amount of the attitude angle; The calculation formula of attitude error is: The calculation formula of the correction amount of the attitude angle is: i corr =∫edt≈e·Δt Where e represents the attitude error vector, represents the gravitational acceleration vector, represents the estimated gravity vector, θ corr It represents the correction amount of attitude angle, Δt represents the time interval; S136, filtering the attitude error by complementary filtering or Kalman filtering, and updating the attitude quaternion again according to the filtered attitude error; The update formula of the attitude quaternion is: In the formula, q′ new Represents the updated attitude quaternion, q error represents the error between the initial updated posture and the filtered posture, e x 、e y 、e z Respectively represent the components of the attitude error vector e in the x-axis, y-axis, and z-axis directions; S137, correcting the angular velocity according to the filtered attitude error combined with the correction amount of the attitude angle, and converting the updated attitude quaternion into a direction cosine matrix, and then converting the direction cosine matrix into Euler angles; S138. Analyze the specific posture action of the intelligent gateway according to the calculated posture angle, and implement data device configuration and network configuration of the intelligent gateway according to the specific posture action.
7. The method for controlling an intelligent gateway based on gesture operation according to claim 6, characterized in that: The expression of the direction cosine matrix is: The conversion formula of Euler angle is: i p =sin -1 [2(q2q3+q0q1)] Where R(q) represents the direction cosine matrix, θ p ,θ r ,θ y They represent pitch angle, roll angle and heading angle respectively.
8. The method for controlling an intelligent gateway based on gesture operation according to claim 6, characterized in that: The specific posture action of the intelligent gateway is analyzed according to the calculated posture angle, and the data device configuration and network configuration of the intelligent gateway are realized according to the specific posture action, including: When the roll angle is less than -45 degrees, it is judged as left-handed, and when the roll angle is greater than 45 degrees, it is judged as right-handed. The left and right-handed are configured as menu options to switch up and down; When the pitch angle is less than -45 degrees, it is judged as forward tilt, and when the pitch angle is greater than 45 degrees, it is judged as backward tilt. The forward tilt is configured to enter the current menu interface, and the backward tilt is configured to exit the current menu interface; When the pitch angle and roll angle are both less than 45 degrees and the gravity acceleration is greater than 2g, it is determined that the smart gateway has collided with the desktop and the networking operation is performed.
9. The method for controlling an intelligent gateway based on gesture operation according to claim 1, characterized in that: The calculation formula for dynamically adjusting the data transmission rate is: Where Bitrate New Indicates the adjusted data transmission rate, Bitrate Current Indicates the current data transmission rate, Quality Current Indicates the quality of the current data. Target Indicates the target quality of the data.
10. An intelligent gateway control system based on gesture operation, used to implement the steps of the intelligent gateway control method based on gesture operation described in any one of claims 1 to 9, characterized in that: The intelligent gateway control system based on gesture operation includes an intelligent gateway configuration module, a real-time data acquisition module and a real-time data display module; The intelligent gateway configuration module is used to analyze and obtain the attitude data of the intelligent gateway based on the attitude calculation algorithm of the quaternion method, and implement the data device configuration and network configuration of the intelligent gateway according to the attitude data; The real-time data acquisition module is used to establish a communication connection between the intelligent gateway and each intelligent gateway node, and to collect environmental temperature, humidity and light intensity data in real time through the intelligent gateway node; The real-time data display module is used to upload the collected data to the cloud server and the mobile terminal for storage and display based on the configured intelligent gateway and the dynamically adjusted data transmission rate.
Citation Information
Cited By
Intelligent cabinet user perception method and system based on multi-mode perception
CN121505735A