这是用户在 2024-7-14 21:21 为 https://www.mdpi.com/2076-3417/14/12/5296 保存的双语快照页面,由 沉浸式翻译 提供双语支持。了解如何保存?




 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article 开放存取文章

Design and Implementation of a Two-Wheeled Self-Balancing Car Using a Fuzzy Kalman Filter
使用模糊卡尔曼滤波器设计和实现两轮自平衡车

by 1, 1 and 2,*
作者:马益民 1 、孟凡豪 1 和熊双双 2,*
1
China Electric Power Research Institute, Beijing 100192, China
中国电力科学研究院,中国北京 100192
2
School of Automation, Beijing Information Science and Technology University, Beijing 100192, China
北京信息科技大学自动化学院,中国北京 100192
*
Author to whom correspondence should be addressed.
通讯作者
Appl. Sci. 2024, 14(12), 5296; https://doi.org/10.3390/app14125296
Appl.Appl.2024, 14(12), 5296; https://doi.org/10.3390/app14125296
Submission received: 8 May 2024 / Revised: 10 June 2024 / Accepted: 13 June 2024 / Published: 19 June 2024
收到投稿:2024 年 5 月 8 日 / 修订:2024 年 6 月 10 日 / 接受:2024 年 6 月 13 日 / 出版:2024 年 6 月 19 日2024 年 6 月 13 日 / 出版:2024 年 6 月 19 日
(This article belongs to the Special Issue Mobile Robotics and Autonomous Intelligent Systems)
(本文属于《移动机器人与自主智能系统》特刊)

Abstract 摘要

To improve the upright balancing performance of the two-wheeled self-balancing car, this paper proposes an attitude estimation algorithm based on fuzzy Kalman filtering. Fuzzy logic is used to correct the inclination angle and angular velocity of the two-wheeled self-balancing car, thereby optimizing the state of the Kalman filter and ultimately improving the balancing performance of the car. This paper combines dual closed-loop PID control with the complementary filtering algorithm, Kalman filtering algorithm, and fuzzy Kalman filtering algorithm to conduct experiments on a physical two-wheeled self-balancing car. The experimental results validate the superiority of the fuzzy Kalman filtering algorithm proposed in this paper for improving the upright balancing performance of the two-wheeled self-balancing car.
为了提高两轮自平衡车的直立平衡性能,本文提出了一种基于模糊卡尔曼滤波的姿态估计算法。利用模糊逻辑修正两轮自平衡车的倾角和角速度,从而优化卡尔曼滤波器的状态,最终提高自平衡车的平衡性能。本文将双闭环 PID 控制与互补滤波算法、卡尔曼滤波算法和模糊卡尔曼滤波算法相结合,在实物两轮自平衡车上进行了实验。实验结果验证了本文提出的模糊卡尔曼滤波算法在改善两轮自平衡车直立平衡性能方面的优越性。
Keywords:
two-wheeled self-balancing car; fuzzy Kalman filtering; complementary filtering; Kalman filtering; PID control
关键词:两轮自平衡车;模糊卡尔曼滤波;互补滤波;卡尔曼滤波;PID 控制

1. Introduction 1.导言

With the advancement of science and technology, the two-wheeled self-balancing car has garnered renewed research interest and widespread application development owing to its simple structure, agile maneuverability, capacity to navigate narrow spaces and execute specialized tasks in unique environments, and adaptability to diverse terrains. Presently, various types of robots resembling the principles of the self-balancing car are ubiquitous in major venues such as shopping malls, transportation hubs, airports, and dining establishments [1]. The two-wheeled self-balancing car system resembles an inverted pendulum system, characterized by multivariable dynamics, nonlinearity, and strong coupling, rendering its study inherently complex [2]. However, in certain intricate environments, diverse interferences may induce disparate speeds between the left and right motors of the two-wheeled self-balancing car, thereby impeding the system’s ability to follow its intended trajectory. Key to maintaining precision and stability in controlling the car system lies in the accuracy and real-time acquisition of the vehicle’s attitude information and velocity measurements.
随着科学技术的进步,两轮自平衡车因其结构简单、机动灵活、能在狭窄空间中穿行、能在特殊环境中执行专门任务、能适应各种地形等特点,重新引起了人们的研究兴趣,并得到了广泛的应用开发。目前,在购物中心、交通枢纽、机场和餐饮场所等主要场所,与自平衡车原理相似的各类机器人无处不在[1]。双轮自平衡车系统类似于倒立摆系统,具有多变量动力学、非线性和强耦合等特点,因此其研究本身就很复杂[2]。然而,在某些错综复杂的环境中,各种干扰可能会导致双轮自平衡车的左右电机速度不一致,从而阻碍系统按照预定轨迹运行。要保持汽车系统控制的精确性和稳定性,关键在于准确、实时地获取汽车的姿态信息和速度测量值。
Attitude information stands as a cornerstone for ensuring the successful operation of the entire system. However, the two-wheeled self-balancing car cannot consistently traverse smooth, disturbance-free environments. Achieving optimal attitude control solely through attitude sensors in complex environments poses a considerable challenge. The integration of filtering algorithms into the main controller ensures the integrity and accuracy of attitude information. A plethora of scholars have extensively researched this area, exploring methods such as feedback control [3], complementary filtering algorithms [4], and Kalman filtering algorithms [5]. Reference [4] presents a system design for a quadcopter based on an improved complementary filtering fusion approach, showcasing minimal static error, smooth dynamic curve transitions, and ideal real-time tracking performance. Similarly, reference [6] utilizes a complementary filtering algorithm to enhance the system’s dynamic characteristics with low computational overhead, facilitating real-time measurement of terrain undulations during the locomotion process of intelligent agents. The Kalman filtering algorithm, pioneered by American scientist Kalman in 1960, initially demonstrated significant effectiveness in the field of positioning and navigation. In contrast to complementary filtering algorithms, the Kalman filtering algorithm cleverly integrates observed and estimated data, managing errors in a closed-loop manner and confining them within a defined range, rendering it more straightforward to implement than alternative filters. Importantly, the Kalman filtering algorithm does not necessitate all past observations but estimates the current signal value based on the preceding estimate and the most recent observation. Implemented through state equations and recursion methods, the Kalman filter does not impose requirements on the stationarity or time invariance of signals [7]. Reference [8] applies the Kalman filtering algorithm to PID control of a micro-rotorcraft system, successfully conducting experimental flight control tests. This method achieves excellent filtering effects, fulfilling the objective of stable flight for the aircraft. Similarly, reference [9] realizes real-time tracking of mobile robots using the Kalman filtering algorithm. References [10,11] advocate for the use of Kalman filtering for attitude estimation in aircraft attitude control, leveraging quaternions as state variables and accelerometers as observation quantities for state updates. The Kalman filtering algorithm demonstrates commendable real-time performance and convergence. However, challenges persist due to the covariance matrix and measurement process noise inherent in the Kalman filtering model, making it difficult to accurately ascertain the statistical characteristics of the covariance matrix. While the Kalman filter’s theoretical foundation lies in linear Gaussian systems, its efficacy may diminish for nonlinear, non-Gaussian systems. In contrast, fuzzy control can address nonlinear and fuzzy problems, rendering it suitable for complex systems.
姿态信息是确保整个系统成功运行的基石。然而,双轮自平衡车无法始终在平滑、无干扰的环境中行驶。在复杂环境中,仅通过姿态传感器来实现最佳姿态控制是一个相当大的挑战。将滤波算法集成到主控制器中可确保姿态信息的完整性和准确性。大量学者对这一领域进行了广泛研究,探索了反馈控制[ 3]、互补滤波算法[ 4]和卡尔曼滤波算法[ 5]等方法。参考文献[ 4]介绍了一种基于改进的互补滤波融合方法的四旋翼飞行器系统设计,展示了最小的静态误差、平滑的动态曲线转换和理想的实时跟踪性能。同样,参考文献[6]利用互补滤波算法,以较低的计算开销增强了系统的动态特性,方便了智能代理在运动过程中对地形起伏的实时测量。卡尔曼滤波算法由美国科学家卡尔曼于 1960 年首创,最初在定位和导航领域显示出显著效果。与其他滤波算法相比,卡尔曼滤波算法巧妙地整合了观测数据和估计数据,以闭环方式管理误差,并将误差限制在确定的范围内,因此比其他滤波算法更易于实现。重要的是,卡尔曼滤波算法并不需要所有过去的观测数据,而是根据之前的估计值和最近的观测数据来估计当前的信号值。 卡尔曼滤波通过状态方程和递归方法实现,对信号的静止性和时间不变性没有要求[ 7]。参考文献[ 8] 将卡尔曼滤波算法应用于微型旋翼机系统的 PID 控制,成功地进行了飞行控制实验测试。该方法取得了很好的滤波效果,实现了飞行器稳定飞行的目标。同样,参考文献[ 9] 利用卡尔曼滤波算法实现了移动机器人的实时跟踪。参考文献[ 10, 11]主张在飞机姿态控制中使用卡尔曼滤波进行姿态估计,利用四元数作为状态变量,加速度计作为状态更新的观测量。卡尔曼滤波算法的实时性能和收敛性值得称赞。然而,由于卡尔曼滤波模型中固有的协方差矩阵和测量过程噪声,很难准确确定协方差矩阵的统计特性,因此挑战依然存在。虽然卡尔曼滤波的理论基础是线性高斯系统,但对于非线性、非高斯系统,其功效可能会减弱。相比之下,模糊控制可以解决非线性和模糊问题,因此适用于复杂系统。
Fuzzy control represents an intelligent control methodology grounded in fuzzy set theory, fuzzy linguistic variables, and fuzzy logic reasoning, which emulates human fuzzy reasoning and decision-making processes [12]. This approach encompasses three primary components: fuzzification, fuzzy control rule generation, and defuzzification. Fuzzification converts precise inputs into fuzzy inputs, while fuzzy control rule generation infers output fuzzy quantities from input fuzzy quantities. Finally, the defuzzification process transforms fuzzy outputs into precise outputs. In addressing the challenge of inaccurate attitude angle estimation during carrier motion, reference [13] proposes the adoption of a fuzzy Kalman filtering algorithm for attitude estimation. Leveraging accelerometer data as an input to the fuzzy controller, this approach notably enhances accuracy during motion and augments real-time performance under static, rotational, and motion conditions. Similarly, reference [14] introduces a parking kinematic model employing fuzzy Kalman filtering for vehicle speed estimation. This model effectively mitigates calculation errors in displacement and heading angle during parking maneuvers. Reference [15] combines fuzzy theory with a Kalman filter for processing unobservable spectral components of uncertain experimental data. In reference [16], a fuzzy PI model regulator and an adaptive Kalman filter are applied to accurately estimate the state of charge. Moreover, reference [17] constructs a mobile robot kinematic model within Simulink and designs a fuzzy controller based on real-time robot angles to facilitate precise obstacle avoidance.
模糊控制是一种基于模糊集理论、模糊语言变量和模糊逻辑推理的智能控制方法,它模拟人类的模糊推理和决策过程[12]。这种方法包括三个主要部分:模糊化、模糊控制规则生成和去模糊化。模糊化将精确输入转换为模糊输入,而模糊控制规则生成则从输入模糊量推导出输出模糊量。最后,去模糊化过程将模糊输出转化为精确输出。针对载体运动过程中姿态角估计不准确的难题,参考文献[ 13]提出采用模糊卡尔曼滤波算法进行姿态估计。这种方法利用加速度计数据作为模糊控制器的输入,显著提高了运动过程中的精度,并增强了静态、旋转和运动条件下的实时性能。同样,参考文献[14]介绍了一种采用模糊卡尔曼滤波的停车运动学模型,用于车辆速度估算。该模型有效地减少了停车过程中位移和航向角的计算误差。参考文献 [ 15] 将模糊理论与卡尔曼滤波器相结合,用于处理不确定实验数据中不可观测的频谱成分。在参考文献[ 16]中,应用模糊 PI 模型调节器和自适应卡尔曼滤波器来精确估计充电状态。此外,参考文献[ 17] 在 Simulink 中构建了移动机器人运动学模型,并设计了基于实时机器人角度的模糊控制器,以促进精确避障。
This study addresses the issue of low stability in sensor data acquisition for the two- wheeled self-balancing car by integrating a fuzzy controller into the Kalman filter, proposing the fuzzy Kalman filtering algorithm to enhance the speed and stability of the upright loop of the two-wheeled self-balancing car. Accelerometer data are utilized as an input for the fuzzy controller, and fuzzy logic is employed to adjust the parameters of the Kalman filtering algorithm. The Kalman filtering measurement noise variance is continuously adjusted to obtain the optimal estimate of the car’s balance posture. Additionally, a dual closed-loop PID control algorithm is formulated, incorporating attitude information and velocity as feedback control variables. This algorithm is combined with the use of the high-performance STM32F103C8T6 (STMicroelectronics corporation from Geneva, Switzerland) chip as the main controller to enhance the stability and anti-interference capability of the two-wheeled self-balancing car system. To compare the proposed fuzzy Kalman filtering algorithm with other methods, namely complementary filtering and Kalman filtering algorithms, in terms of speed and stability on the two-wheeled self-balancing car, this study conducted comparative verifications. Through simulation comparisons, the fuzzy Kalman filtering algorithm proposed in this paper demonstrates stronger system stability and anti-interference capability.
本研究针对两轮自平衡车传感器数据采集稳定性低的问题,将模糊控制器集成到卡尔曼滤波器中,提出了模糊卡尔曼滤波算法,以提高两轮自平衡车直立回路的速度和稳定性。利用加速度计数据作为模糊控制器的输入,并采用模糊逻辑调整卡尔曼滤波算法的参数。卡尔曼滤波的测量噪声方差会不断调整,以获得汽车平衡姿态的最佳估计值。此外,还制定了双闭环 PID 控制算法,将姿态信息和速度作为反馈控制变量。该算法结合使用高性能 STM32F103C8T6(瑞士日内瓦意法半导体公司)芯片作为主控制器,以增强两轮自平衡车系统的稳定性和抗干扰能力。为了比较所提出的模糊卡尔曼滤波算法与其他方法(即互补滤波算法和卡尔曼滤波算法)在两轮自平衡车上的速度和稳定性,本研究进行了对比验证。通过仿真比较,本文提出的模糊卡尔曼滤波算法具有更强的系统稳定性和抗干扰能力。
This paper is structured as follows: Section 2 describes the two-wheeled self-balancing car system and includes the dynamic model of the considered two-wheeled self-balancing car and the PD control algorithm of the upright loop of the two-wheeled self-balancing car. Section 3 proposes the fuzzy Kalman filtering algorithm to leverage information derived from observation data to continuously estimate and rectify the model and noise statistical characteristics in real time. To compare with other filtering algorithms, this section also briefly introduces the classical Kalman filtering theory without fuzzy theory and the widely used complementary filtering theory. Section 4 focuses on verifying the effectiveness of the mentioned methods under a laboratory test environment. Section 5 summarizes the findings and conclusions of the study.
本文的结构如下:第 2 节介绍了两轮自平衡车系统,包括所考虑的两轮自平衡车动态模型和两轮自平衡车直立环的 PD 控制算法。第 3 节提出了模糊卡尔曼滤波算法,利用从观测数据中获得的信息来实时连续地估计和修正模型和噪声的统计特性。为了与其他滤波算法进行比较,本节还简要介绍了不含模糊理论的经典卡尔曼滤波理论和广泛使用的互补滤波理论。第 4 节重点验证了上述方法在实验室测试环境下的有效性。第 5 节总结了研究结果和结论。

2. The Two-Wheeled Self-Balancing Car System
2.两轮自平衡车系统

Figure 1 depicts a physical representation of the two-wheeled self-balancing car under study in this paper. The primary components of the system include an angle acquisition module, MPU-6050 sensor (TDK corporation from Japan Tokyo), STM32 control module (STMicroelectronics corporation from Geneva, Switzerland), motor drive module, and signal acquisition module. The overall circuit design of the experimental car system is illustrated in Figure 2. Utilizing the STM32F103C8T6 (STMicroelectronics corporation from Geneva, Switzerland) as the main control chip, it facilitates high-speed processing of sensor data, execution of control algorithms, and communication with the upper computer. The vehicle is powered by a 3S battery, providing a stable 12 V output voltage. The motor drive circuit employs the TB6612FNG motor drive chip (Toshiba-Semiconductor from Bangkok, Thailand). The attitude sensor utilized is the MPU-6050 (TDK corporation from Tokyo, Japan), which integrates both an accelerometer and a gyroscope, capable of measuring acceleration and angular velocity along the vertical, coronal, and sagittal axes.
图 1 是本文研究的两轮自平衡车的实物图。系统的主要组件包括角度采集模块、MPU-6050 传感器(日本东京 TDK 公司)、STM32 控制模块(瑞士日内瓦意法半导体公司)、电机驱动模块和信号采集模块。实验车系统的整体电路设计如图 2 所示。采用 STM32F103C8T6(瑞士日内瓦意法半导体公司)作为主控芯片,可实现传感器数据的高速处理、控制算法的执行以及与上位机的通信。车辆由 3S 电池供电,提供稳定的 12 V 输出电压。电机驱动电路采用 TB6612FNG 电机驱动芯片(泰国曼谷东芝半导体公司)。使用的姿态传感器是 MPU-6050(日本东京 TDK 公司),它集成了加速度计和陀螺仪,能够测量沿垂直、冠状和矢状轴的加速度和角速度。
Figure 1. Photograph of the two-wheeled self-balancing car.
图 1.两轮自平衡车的照片。
Figure 2. Block diagram of the circuit system.
图 2.电路系统框图。

2.1. Dynamic Model of the Two-Wheeled Self-Balancing Car
2.1.两轮自平衡车的动态模型

The two-wheeled self-balancing car can be conceptualized as an inverted pendulum model [18], with its force analysis diagram illustrated in Figure 3.
双轮自平衡车可以被看作是一个倒立摆模型[ 18],其受力分析图如图 3 所示。
Figure 3. Inverted pendulum system for the two-wheeled self-balancing car.
图 3.双轮自平衡车的倒立摆系统。
In Figure 3, the mass of the car body is denoted as m, the inclination angle with respect to the vertical direction is θ, the angular velocity of the car body is represented by ϖ, the acceleration of the car is denoted by a, and the magnitude of the inertial force acting on the car, inertial F, is proportional to the acceleration a, with the proportionality coefficient being the mass m, i.e., F=ma. When the inclination angle θ is small, the acceleration a is directly proportional to the inclination angle θ, with the proportionality coefficient denoted by k1, yielding the dynamic equation of the car:
在图 3 中,车体的质量表示为 m ,相对于垂直方向的倾角为 θ ,车体的角速度表示为 ϖ ,汽车的加速度表示为 a ,作用在汽车上的惯性力大小(惯性力 F )与加速度 a 成正比,比例系数为质量 m ,即 F=ma 。当倾角 θ 较小时,加速度 a 与倾角 θ 成正比,比例系数用 k1 表示,从而得到汽车的动态方程:
F=mgθmk1θ.
When k1>g, the direction of the restoring force F is opposite to the direction of inclination, thereby causing the car to return to its equilibrium position. If the car cannot accurately reach the neutral position and stabilize, it will inevitably oscillate around the neutral position, thus prolonging the time required for balance. In order to mitigate oscillations and achieve stability at the equilibrium position promptly, it is necessary to take into account additional damping force k2θ. The magnitude of this added damping force is directly proportional to the angular velocity θ, yet acts in the opposite direction, with the proportionality coefficient denoted by k2. Therefore, the dynamic equation of the car at this juncture can be succinctly expressed as follows:
k1>g 时,恢复力 F 的方向与倾斜方向相反,从而使汽车回到平衡位置。如果小车不能准确到达中性位置并稳定下来,它将不可避免地围绕中性位置摆动,从而延长平衡所需的时间。为了减少振荡并迅速在平衡位置实现稳定,有必要考虑额外的阻尼力 k2θ 。这种附加阻尼力的大小与角速度 θ 成正比,但作用方向相反,比例系数用 k2 表示。因此,此时汽车的动态方程可以简洁地表示如下:
F=mgθm(k1θ+k2θ).
The acceleration of the car can then be obtained as follows:
汽车的加速度可按下式求得:
a=k1θ+k2θ.
Managing both the direction and magnitude of acceleration facilitates the control of the car’s attitude. In this context, the adjustment of the pulse width modulation (PWM) magnitude mirrors the regulation of the car’s acceleration. This method of controlling acceleration also encompasses the manipulation of the motor PWM, effectively serving as the controller for the car’s upright loop. The incremental PD, PI, and PD algorithms are, respectively, employed in the upright, velocity, and steering loops to achieve functions such as balancing and turning of the two-wheeled self-balancing car.
管理加速度的方向和大小有助于控制汽车的姿态。在这种情况下,脉宽调制(PWM)幅度的调整反映了汽车加速度的调节。这种控制加速度的方法还包括对电机 PWM 的控制,从而有效地充当了汽车直立回路的控制器。增量式 PD、PI 和 PD 算法分别用于直立环、速度环和转向环,以实现两轮自平衡车的平衡和转弯等功能。
This note introduces a Fuzzy-Kalman-filtering-based attitude estimation algorithm to enhance the upright stability performance of the two-wheeled self-balancing car, with particular emphasis on filtering the measured angles and angular velocities of the car. The velocity and steering loops are utilized to control the car’s speed and turning.
本说明介绍了一种基于模糊-卡尔曼滤波的姿态估计算法,以提高双轮自平衡车的直立稳定性能,特别强调对汽车的测量角度和角速度进行滤波。速度和转向环路用于控制汽车的速度和转弯。
Considering the state-space model of the two-wheeled self-balancing car depicted in Figure 1, it is formulated as follows:
双轮自平衡车的状态空间模型如图 1 所示,其计算公式如下:
θkθbk=1T01θk1θbk1+T0θk1+qq,
θck=θk+r,
where θkR and θkR, respectively, represent the actual angle and angular velocity measured by the gyroscope of the two-wheeled self-balancing car at time k. θbkR represents the gyroscope’s static error, where static error refers to the angular velocity value output by the gyroscope when the two-wheeled self-balancing car is stationary. θckR denotes the angle calculated by the accelerometer, TR represents the filtering period, qR and rR, respectively, denote the covariance of process noise and measurement noise.
其中, θkRθkR 分别代表两轮自平衡车陀螺仪在 k 时间测量到的实际角度和角速度。 θbkR 表示陀螺仪的静态误差,静态误差是指两轮自平衡车静止时陀螺仪输出的角速度值。 θckR 表示加速度计计算的角度, TR 表示滤波周期, qRrR 分别表示过程噪声和测量噪声的协方差。

2.2. The PD Control for the Two-Wheeled Self-Balancing Car
2.2.两轮自平衡车的 PD 控制

Upon initialization of the self-balancing car, the first step involves state detection to determine whether the current orientation matches the target inclination angle. If not, the motor is adjusted to accelerate accordingly, aiming to bring the vehicle to an upright position through angle control. Concurrently, the velocity sensor provides feedback on motor status to fine-tune input values, thereby establishing a complete negative feedback system. Upon the acquisition of angle information by the sensors, the angular velocity undergoes PD control within the upright loop to regulate the vehicle’s posture. Increasing the proportional coefficient enhances the vehicle’s responsiveness, while the differential coefficient influences the stability of the self-balancing car when it is not inclined. Once the proportional and differential coefficients are established, adjustments to the motion posture of the two-wheeled self-balancing car can be made based on speed information provided by the encoder feedback. The expression for its PD control within the upright loop can be simplified as follows:
自平衡车初始化后,第一步涉及状态检测,以确定当前方位是否与目标倾斜角相匹配。如果不匹配,则相应地调整电机加速,旨在通过角度控制使车辆达到直立位置。与此同时,速度传感器提供有关电机状态的反馈,以微调输入值,从而建立一个完整的负反馈系统。在传感器获得角度信息后,角速度在直立环路内进行 PD 控制,以调节车辆的姿态。增加比例系数可提高车辆的响应速度,而微分系数则会影响自平衡车在非倾斜状态下的稳定性。比例系数和微分系数确定后,就可以根据编码器反馈的速度信息对两轮自平衡车的运动姿态进行调整。其直立环路内的 PD 控制表达式可简化如下:
M(k)=kpe(k)+kd(e(k)e(k1))=kp[θ¯kθk]+kd(0θk).
where θ¯k denotes the desired equilibrium angle, typically set to zero, and M(k) signifies the PWM value. kp and kd, respectively, correspond to the proportional and derivative coefficients of the PD control algorithm.
其中, θ¯k 表示所需的平衡角,通常设为零, M(k) 表示 PWM 值。 kpkd 分别对应于 PD 控制算法的比例系数和导数系数。
The precision of angle data acquisition significantly impacts the efficacy of control algorithms. However, relying solely on accelerometers and gyroscopes for angle determination presents certain limitations. Accelerometers provide relatively accurate long-term readings but exhibit notable fluctuations, potentially due to high-frequency noise contamination. Conversely, gyroscopes offer short-term accuracy but are susceptible to integration errors, suggesting the presence of low-frequency noise. To mitigate the adverse effects of noise on data accuracy, angle measurements obtained from accelerometers and gyroscopes can undergo filtering and smoothing procedures, thereby enhancing measurement precision.
角度数据采集的精度对控制算法的效果有很大影响。然而,仅依靠加速度计和陀螺仪来确定角度存在一定的局限性。加速度计可提供相对精确的长期读数,但会出现明显的波动,这可能是高频噪声污染造成的。相反,陀螺仪提供短期精度,但容易出现积分误差,表明存在低频噪声。为了减轻噪声对数据精度的不利影响,加速度计和陀螺仪获得的角度测量值可以经过过滤和平滑处理,从而提高测量精度。

3. Fuzzy Kalman Filtering Algorithm Design
3.模糊卡尔曼滤波算法设计

In optimal conditions, when a dual-wheel self-balancing car operates under normal conditions, and with known system and measurement noise parameters, fixed complementary and Kalman filters effectively mitigate measurement errors. However, in scenarios where the vehicle’s measurement sensors deviate due to environmental disturbances or when external noise is uncertain, relying solely on a Kalman filter with predetermined noise parameters may fail to accurately ascertain the vehicle’s genuine angle and velocity information. This paper proposes a fusion of fuzzy control theory and the Kalman filtering method, leveraging information derived from observation data to continuously estimate and rectify the model and noise statistical characteristics in real time. Such an approach promises to enhance filtering performance and bolster the stability of the vehicle.
在最佳条件下,当双轮自平衡车在正常条件下运行,并具有已知的系统和测量噪声参数时,固定互补和卡尔曼滤波器可有效减少测量误差。然而,在车辆的测量传感器因环境干扰而出现偏差或外部噪声不确定的情况下,仅依靠具有预定噪声参数的卡尔曼滤波器可能无法准确确定车辆的真实角度和速度信息。本文提出了一种融合模糊控制理论和卡尔曼滤波法的方法,利用从观测数据中获得的信息来实时不断地估计和修正模型和噪声的统计特性。这种方法有望提高滤波性能,增强车辆的稳定性。
To compare with other filtering algorithms, this section first introduces the fuzzy Kalman filter algorithm proposed by the author, and then briefly introduces the classical Kalman filtering theory without fuzzy theory and the widely used complementary filtering theory.
为了与其他滤波算法进行比较,本节首先介绍了作者提出的模糊卡尔曼滤波算法,然后简要介绍了没有模糊理论的经典卡尔曼滤波理论和广泛使用的互补滤波理论。

3.1. Fuzzy Kalman Filtering Algorithm Design
3.1.模糊卡尔曼滤波算法设计

This section first introduces the Kalman filtering algorithm for filtering the angle and angular velocity of the self-balancing car, followed by the establishment of the fuzzification and defuzzification processes of process noise and measurement noise based on the fuzzy theory.
本节首先介绍了对自平衡车的角度和角速度进行滤波的卡尔曼滤波算法,然后基于模糊理论建立了过程噪声和测量噪声的模糊化和去模糊化过程。
The covariance of process noise and measurement noise experienced by the two-wheeled self-balancing car is:
两轮自平衡车所经历的过程噪声和测量噪声的协方差为
qk=αk·qrk=βk·r
where qkR and rkR respectively, represent the covariance of process noise and measurement noise at time instant k, while αkR and βkR are used to adjust the parameters of measurement noise and process noise covariance.
其中 qkRrkR 分别表示时间瞬间 k 的过程噪声协方差和测量噪声协方差,而 αkRβkR 则用于调整测量噪声和过程噪声协方差的参数。
The Kalman filter, as a linear optimal estimation algorithm, utilizes a “predict–measure–correct” pattern to eliminate random disturbances of the system by updating the measurement values, thus optimizing the restoration of the system’s state. The Kalman filter has two main functions, namely prediction and correction, as shown in Figure 4. Prediction involves the time update equation, while correction involves the measurement update equation. The time update equation estimates the a priori estimate and covariance of the state variables at the current time by evaluating the state value at the previous time, while the measurement equation calculates the posterior estimate by combining the a priori estimate with the current measurement value, achieving the purpose of correction.
卡尔曼滤波器作为一种线性最优估计算法,利用 "预测-测量-修正 "模式,通过更新测量值来消除系统的随机干扰,从而优化系统状态的恢复。卡尔曼滤波器有两个主要功能,即预测和修正,如图 4 所示。预测涉及时间更新方程,而修正涉及测量更新方程。时间更新方程通过评估前一时间的状态值来估计当前时间状态变量的先验估计值和协方差,而测量方程则通过将先验估计值与当前测量值相结合来计算后验估计值,从而达到修正的目的。
Figure 4. Kalman filter update schematic.
图 4 卡尔曼滤波器更新示意图卡尔曼滤波器更新示意图。
A prior estimation of the angle and angular velocity of the two-wheeled self-balancing car is designed as follows:
双轮自平衡车的角度和角速度的先验估计设计如下:
θ^kθ^bk=1T01θ^k1θ^bk1+T0θ^k1,
θ^ck=θ^k
where θ^k,θ^k,θ^ck and θ^bk are, respectively, the estimated values of the car’s angle, angular velocity, accelerometer angle, and static error.
其中 θ^k,θ^k,θ^ckθ^bk 分别为汽车角度、角速度、加速度计角度和静态误差的估计值。
The accelerometer angle obtained from the prior estimate needs to be corrected through posterior estimation. The covariance matrix of the posterior estimate is defined as Pk [19], yielded using the following equation:
从先验估计中获得的加速度计角度需要通过后验估计进行修正。后验估计的协方差矩阵定义为 Pk [ 19],通过以下公式得出:
Pk=IKk1HAPk1AT+Qk1,Kk=K1kK2k=p11kp11k+rkp21kp11k+rk,
θcfk=θ^c(k)+P(k)(θc(k)θ^c(k)),
where I is the unit matrix, Kk is the Kalman gain vector, H=10,A=1T01, Qk1=qk100qk1,Pk=p11kp12kp21kp22k, and θcfk represents the corrected accelerometer angle, which is also the final output of the filter.
其中, I 是单位矩阵, Kk 是卡尔曼增益向量, H=10,A=1T01, Qk1=qk100qk1,Pk=p11kp12kp21kp22kθcfk 代表修正后的加速度计角度,也是滤波器的最终输出。
Two time-varying parameters, αk and βk are selected as the outputs of the fuzzy control; the noise covariance matrix of the filter is modified by adjusting the values of αk and βk.
选择两个时变参数 αkβk 作为模糊控制的输出;通过调整 αkβk 的值来修改滤波器的噪声协方差矩阵。
Let eθk=θckθcfk be defined as the residual, indicating the extent to which the self-balancing car system relies on measurement values. The variance and mean of the residual can be used to assess the performance of the filter, with the mean and variance of residual are computed as follows:
eθk=θckθcfk 定义为残差,表示自平衡车系统对测量值的依赖程度。残差的方差和均值可用来评估滤波器的性能,残差的均值和方差计算如下:
e¯k=1nk=mnmeθk,
P^ek=1nk=mn+1meθk2
where nR represents the statistical time length, mZ+. The mean and variance of the residual are chosen as inputs for fuzzy control. Next, the inputs αk and βk are fuzzified.
其中, nR 表示统计时间长度, mZ+ 表示统计时间长度。残差的均值和方差被选为模糊控制的输入值。接下来,输入 αkβk 将被模糊化。
Drawing upon the fuzzy method outlined in reference [12], the mean residual e¯k and residual variance P^ek are subjected to fuzzification for the fuzzy rules. Triangular membership functions, comprising large (L), medium (M), and small (S) fuzzy sets, are selected. The waveform diagrams illustrating the membership functions for the mean and variance of the residual are depicted in Figure 5 and Figure 6, respectively.
借鉴参考文献[12]中概述的模糊方法,对平均残差 e¯k 和残差方差 P^ek 进行模糊化处理,形成模糊规则。选择了由大(L)、中(M)和小(S)模糊集组成的三角形成员函数。图 5 和图 6 分别显示了残差均值和方差的成员函数波形图。
Figure 5. Residual mean affiliation distribution.
图 5.残差平均隶属关系分布。
Figure 6. Residual variance affiliation distribution.
图 6.残差隶属关系分布。
The curves in the graph represent different scenarios based on the mean residual being less than or equal to 1 and the residual variance being less than or equal to 0.4, indicating that both fall within the small (S) fuzzy interval, signifying reliable measurement information for the two-wheeled self-balancing car. When the mean is between 1 and 3.5 and the variance is between 0.4 and 1.4, both are in the medium (M) fuzzy interval, indicating relatively reliable measurement information. Moreover, when the mean is between 3.5 and 5 and the variance is between 1.4 and 2, both are in the large (L) fuzzy interval, indicating unreliable measurement information. Based on the actual data and empirical evidence from the car’s operation, fuzzy rules are established as shown in Table 1.
图中的曲线代表了平均残差小于或等于 1 和残差方差小于或等于 0.4 的不同情况,表明两者都属于小(S)模糊区间,表示两轮自平衡车的测量信息是可靠的。当均值介于 1 和 3.5 之间,方差介于 0.4 和 1.4 之间时,二者均处于中(M)模糊区间,表明测量信息相对可靠。此外,当均值介于 3.5 和 5 之间,方差介于 1.4 和 2 之间时,两者都处于大(L)模糊区间,表明测量信息不可靠。根据汽车运行的实际数据和经验证据,建立了如表 1 所示的模糊规则。
Table 1. Fuzzy rule table.
表 1.模糊规则表。
Through fuzzy reasoning, the mean and variance of the residual are assessed, facilitating the real-time adjustment of covariance parameters for measurement noise and process noise in the Kalman filter. The centroid method [19] is employed as a defuzzification algorithm to derive specific numerical outputs.
通过模糊推理,对残差的均值和方差进行评估,便于实时调整卡尔曼滤波器中测量噪声和过程噪声的协方差参数。采用中心法[ 19] 作为去模糊化算法,得出具体的数值输出。
(1)
When the output falls within the S fuzzy interval:
当输出在 S 模糊区间内时:
αk=1βk=1
(2)
When the output falls within the M fuzzy interval:
当输出在 M 模糊区间内时:
αk=0.80.1P^ekβk=1.4+0.1P^ek
(3)
When the output falls within the L fuzzy interval:
当输出在 L 模糊区间内时:
αk=0.60.2e¯kβk=1.2+0.2e¯k
Remak 1. 
The calculation coefficients in defuzzification Equations (13)–(15) are primarily selected based on the scale values of the membership distribution chart. In this study, keeping the parameter αk as a fixed value, the parameter βk is continuously adjusted to achieve the optimal filtering effect. Conversely, when the parameter βk is fixed, adjustments are made to the parameter αk. Eventually, based on approximately 50 experimental and trial datasets, the feasibility of this dataset is inferred and further utilized for subsequent experiments to compare and validate the effectiveness of the algorithm.

去模糊化公式(13)-(15)中的计算系数主要根据成员分布图的标度值进行选择。在本研究中,在保持参数 αk 为固定值的情况下,不断调整参数 βk 以达到最佳过滤效果。反之,当参数 βk 固定时,对参数 αk 进行调整。最终,基于约 50 个实验和试用数据集,推断出该数据集的可行性,并进一步用于后续实验,以比较和验证算法的有效性。
For the purpose of comparative experiments, in the case where the PD control parameters remain unchanged for the upright, velocity, and steering loops of the two-wheeled self-balancing car, the following two sections will introduce two commonly used filtering algorithms for the car, namely the complementary filtering algorithm and traditional Kalman filtering algorithm.
为了进行对比实验,在两轮自平衡车的直立环、速度环和转向环的 PD 控制参数保持不变的情况下,下面两节将介绍两种常用的汽车滤波算法,即互补滤波算法和传统卡尔曼滤波算法。

3.2. Kalman Filtering Algorithm
3.2.卡尔曼滤波算法

The prior estimation of the angle and angular velocity of the two-wheeled self-balancing car is designed in the same way as (8) and (9), while the covariance matrix of the posterior estimate is
两轮自平衡车角度和角速度的先验估计设计方法与 (8) 和 (9) 相同,而后验估计的协方差矩阵为
Pk=IKk1HAPk1AT+Q,Kk=K1kK2k=p11kp11k+rp21kp11k+r,
θcfk=θ^c(k)+P(k)(θc(k)θ^c(k)),
where the meanings of I,H,A,P(k), and θcfk are the same as in Equation (10), Q=q00q. θ^ck is computed using Equation (9).
其中 I,H,A,P(k) , 和 θcfk 的含义与公式 (10) 相同, Q=q00q .3# 的计算使用公式 (9)。

3.3. Complementary Filtering Algorithm
3.3.互补滤波算法

The complementary filtering algorithm, with its characteristics of low computational complexity, high reliability, and low precision requirements for inertial devices, is widely used in the attitude applications of various robots. The complementary filtering algorithm combines a low-pass filter and a high-pass filter, which are then overlaid to enhance the accuracy of attitude angular velocity [20]. The principle of the complementary filter is illustrated in Figure 6.
互补滤波算法具有计算复杂度低、可靠性高、对惯性设备精度要求低等特点,被广泛应用于各种机器人的姿态应用中。互补滤波算法结合了低通滤波器和高通滤波器,然后将两者叠加以提高姿态角速度的精度[20]。互补滤波器的原理如图 6 所示。
From Figure 7, it can be observed that in the low-frequency range below the cutoff frequency of the low-pass filter, the accelerometer primarily influences, while in the high-frequency range above the cutoff frequency of the high-pass filter, the gyroscope dominates. By adjusting the cutoff frequency of the filter, the filtering effects on the gyroscope and accelerometer can be tuned. The time-domain expression of the output angular velocity after the complementary filter is as follows:
从图 7 中可以看出,在低于低通滤波器截止频率的低频范围内,主要受加速度计的影响,而在高于高通滤波器截止频率的高频范围内,主要受陀螺仪的影响。通过调节滤波器的截止频率,可以调整陀螺仪和加速度计的滤波效果。互补滤波器后输出角速度的时域表达式如下:
θ(k)=λθm(k)(1λ)[θ(k1)+Δtθk]
where the proportional coefficient λ=ΔtΔt+τ, which represents the degree of trust idifferent data, Δt is the sampling time, τ is the time constant of the filter, the angle transformed from the accelerometer is denoted as θm(k), the gyroscope measures angular velocity as θk, and θ(k) represents the angle output after the filtering algorithm is processed.
其中,比例系数 λ=ΔtΔt+τ 表示对不同数据的信任程度, Δt 是采样时间, τ 是滤波器的时间常数,加速度计转换的角度表示为 θm(k) ,陀螺仪测量的角速度表示为 θkθ(k) 表示滤波算法处理后的角度输出。
Figure 7. The principle of complementary filter.
图 7.互补滤波器的原理。

4. Experimental Verification
4.实验验证

This experiment compares the time for a dual-wheel self-balancing car to return to balance from an unbalanced state and the angular fluctuations in the balanced state under the fuzzy Kalman filtering algorithm, Kalman filtering algorithm [21], and complementary filtering algorithm [20]. The self-balancing car is placed on the ground, and it is rotated around the motor axis to find the angle at which the car approaches balance, which is considered the mechanical center of the robot. In this experiment, the mechanical center of the robot is defined as 0°.
本实验比较了模糊卡尔曼滤波算法、卡尔曼滤波算法[ 21] 和互补滤波算法[ 20] 下双轮自平衡车从不平衡状态恢复平衡的时间以及平衡状态下的角度波动。将自平衡小车放在地面上,绕电机轴旋转,找到小车接近平衡的角度,该角度被认为是机器人的机械中心。在本实验中,机器人的机械中心定义为 0°
The CH340G driver for the USB to TTL module was installed, MCUISP v0.995 software was used to flash the pre-written program into the STM32 microcontroller (STMicroelectronics corporation from Geneva, Switzerland), the robot was connected to the PC using a MicroUSB cable, the MiniBalance 3.5 software was opened, the appropriate port was selected, and the baud rate was set to 115,200. This configuration allows the operator to view the data waveform of the robot’s inclination angle through the software. To ensure the stable operation of the dual-wheel self-balancing car depicted in Figure 1, it is imperative to fine-tune the controller parameters governing the car’s upright, speed, and steering loops. The PD controller parameters for the upright loop are set as: Kp=225 and Kd=1.08; the PI controller parameters for the speed loop are set as: Kp=160 and Ki=0.80; the PD controller parameters for the steering loop are set as: Kp=42 and Kd=0.40. The covariance of process noise and measurement noise are set as q=0.25 and r=0.16; the filtering period is set as T=0.005, i.e., filtering is performed every 5 milliseconds.
安装 USB 转 TTL 模块的 CH340G 驱动程序,使用 MCUISP v0.995 软件将预先编写的程序闪存到 STM32 微控制器(瑞士日内瓦意法半导体公司)中,使用 MicroUSB 电缆将机器人连接到 PC,打开 MiniBalance 3.5 软件,选择适当的端口,并将波特率设置为 115 200。通过这种配置,操作员可以通过软件查看机器人倾角的数据波形。为确保图 1 所示的双轮自平衡小车稳定运行,必须对控制小车直立、速度和转向环路的控制器参数进行微调。直立环路的 PD 控制器参数设置为0# 和 Kd=1.08 ;速度环路的 PI 控制器参数设置为: Kp=160Ki=0.80 ;转向环路的 PI 控制器参数设置为: Kp=160Ki=0.80 :速度环的 PI 控制器参数设置为: Kp=160Ki=0.80 ;转向环的 PD 控制器参数设置为: Kp=42Kd=0.40 :4# 和 Kd=0.40 。过程噪声和测量噪声的协方差设为 q=0.25r=0.16 ;滤波周期设为 T=0.005 ,即每 5 毫秒滤波一次。
Measurements were conducted to observe the car’s behavior under three different filtering algorithms as it transitioned from tilting backward at angles of 10°, 20°, and 30° (denoted as −10°, −20°, and −30°), as well as tilting forward at angles of 10°, 20°, and 30° (denoted as 10°, 20°, and 30°), until it reached a balanced state. Subsequently, angle fluctuation graphs were generated, as depicted in Figure 8, Figure 9, Figure 10, Figure 11, Figure 12 and Figure 13. To assess the variations in the car’s stability across the three filtering algorithms, the integral absolute error (IAE) was employed as the error metric, where IAE=k=200600ek.
在三种不同的滤波算法下,小车分别以 10°、20° 和 30°(分别表示为 -10°、-20° 和 -30°)的角度向后倾斜,以及以 10°、20° 和 30°(分别表示为 10°、20° 和 30°)的角度向前倾斜,直至达到平衡状态。随后,生成了角度波动图,如图 8、图 9、图 10、图 11、图 12 和图 13 所示。为了评估小车稳定性在三种过滤算法中的变化,采用了积分绝对误差(IAE)作为误差指标,其中 IAE=k=200600ek .
Figure 8. Angular fluctuations of −10° back to equilibrium [20,21].
图 8.-10°角波动恢复平衡[ 20, 21]。
Figure 9. Angular fluctuations of −20° back to equilibrium [20,21].
图 9.-20°角波动恢复平衡[ 20, 21]。
Figure 10. Angular fluctuations of −30° back to equilibrium [20,21].
图 10.-30°角波动恢复平衡[ 20, 21]。
Figure 11. Angular fluctuations of 10° back to equilibrium [20,21].
图 11.10° 角波动恢复平衡[ 20, 21]。
Figure 12. Angular fluctuations of 20° back to equilibrium [20,21].
图 12.20° 角波动恢复平衡[ 20, 21]。
Figure 13. Angular fluctuations of 30° back to equilibrium [20,21].
图 13.30° 角波动恢复平衡[ 20, 21]。
Figure 8, Figure 9, Figure 10, Figure 11, Figure 12 and Figure 13 depict the effectiveness of the proposed fuzzy Kalman filtering algorithm, Kalman filtering algorithm [21], and complementary filtering algorithm [20] in restoring the system to a balanced state when the vehicle is tilted backward or forward by 10°, 20°, and 30°. Table 2 presents the time taken for the system to return to a balanced state under each algorithm, while Table 3 shows the IAE metric values for each algorithm at various tilt angles. The first 200 scales are the adjustment time for the two-wheeled self-balancing car at a certain starting angle, and the filtering algorithm is added at around the 200th scale. From the simulation results, it is evident that the jitter of the two-wheeled self-balancing car is minimized when employing the designed Kalman filtering algorithm proposed in this study compared to the other two algorithms. Additionally, the time required for the system to recover to a balanced state from the same angle is shorter, and the absolute error is smaller than with the other two algorithms. Note that there is a visible difference between positive and negative tilting, which may be caused by the measurement error in the experimental process.
图 8、图 9、图 10、图 11、图 12 和图 13 描述了当车辆向后或向前倾斜 10°、20° 和 30°时,所提出的模糊卡尔曼滤波算法、卡尔曼滤波算法 [ 21] 和互补滤波算法 [ 20] 恢复系统平衡状态的效果。表 2 列出了每种算法下系统恢复平衡状态所需的时间,表 3 则显示了每种算法在不同倾斜角度下的 IAE 指标值。前 200 个刻度是两轮自平衡车在某个起始角度下的调整时间,在第 200 个刻度左右加入了过滤算法。从仿真结果可以看出,与其他两种算法相比,采用本研究提出的卡尔曼滤波算法设计的两轮自平衡车的抖动最小。此外,与其他两种算法相比,系统从同一角度恢复到平衡状态所需的时间更短,绝对误差更小。需要注意的是,正倾斜和负倾斜之间存在明显差异,这可能是由实验过程中的测量误差造成的。
Table 2. Equilibrium time for different angles (unit: seconds).
表 2.不同角度的平衡时间(单位:秒)。
Table 3. Tilt angle integral absolute error.
表 3.倾斜角积分绝对误差

5. Conclusions 5.结论

In this paper, an attitude estimation algorithm based on a fuzzy Kalman filter is proposed, which uses fuzzy logic to correct the tilt angle of a two-wheeled self-balancing car, so as to optimize the state of the Kalman filter and improve the balance performance of the car. Under the same controller parameters, the effects of the fuzzy Kalman filtering algorithm, Kalman filter algorithm [21], and complementary filtering algorithm [20] are compared by experimenting with the two-wheeled self-balancing car, and the results show that the fuzzy Kalman filter algorithm designed in this note makes the two-wheeled self-balancing car more quickly and precisely return to the balance position. The fuzzy Kalman filter algorithm can effectively realize the balance control of two-wheeled cars, which has certain reference significance for the design and research of speed loops and steering rings of racing balance cars.
本文提出了一种基于模糊卡尔曼滤波器的姿态估计算法,利用模糊逻辑对两轮自平衡车的倾角进行修正,从而优化卡尔曼滤波器的状态,提高小车的平衡性能。在相同的控制器参数下,通过对两轮自平衡车的实验,比较了模糊卡尔曼滤波算法、卡尔曼滤波算法[ 21]和互补滤波算法[ 20]的效果,结果表明,本文设计的模糊卡尔曼滤波算法使两轮自平衡车更快速、精确地回到平衡位置。模糊卡尔曼滤波算法能有效实现两轮车的平衡控制,对赛车平衡车速度环和转向环的设计与研究具有一定的参考意义。

Author Contributions 作者供稿

Conceptualization, S.X.; data curation, F.M.; formal analysis, S.X.; funding acquisition, Y.M.; methodology, S.X.; software, F.M.; supervision, S.X.; writing—original draft, Y.M.; writing—review and editing, Y.M. All authors have read and agreed to the published version of the manuscript.
构思,S.X.;数据整理,F.M.;形式分析,S.X.;资金获取,Y.M.;方法学,S.X.;软件,F.M.;监督,S.X.;写作-原稿,Y.M.;写作-审阅和编辑,Y.M.。所有作者均已阅读并同意手稿的出版版本。

Funding 资金筹措

This research was funded by the National Natural Science Foundation (NNSF) of China under grant number 62103057 and enterprises and institutions supporting scientific and technological projects under grant number S2326061.
本研究得到了国家自然科学基金(批准号:62103057)和企事业单位科技项目(批准号:S2326061)的资助。

Institutional Review Board Statement
机构审查委员会声明

Not applicable. 不适用。

Informed Consent Statement
知情同意声明

Not applicable. 不适用。

Data Availability Statement
数据可用性声明

The original contributions presented in the study are included in the article.
研究报告中提出的原创性贡献已收录在文章中。

Conflicts of Interest 利益冲突

The authors declare no conflicts of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.
作者声明无利益冲突。资助者在研究设计、数据收集、分析或解释、手稿撰写以及结果发表的决定中均未发挥任何作用。

References 参考资料

  1. Arndt, D.; Bobrow, J.E.; Peters, S.; Iagnemma, K.; Dubowsky, S. Two-wheel self-balancing of a four-wheeled vehicle. IEEE Control. Syst. Mag. 2011, 31, 29–37. [Google Scholar]
    Arndt, D.; Bobrow, J.E.; Peters, S.; Iagnemma, K.; Dubowsky, S. Two-wheel self-balancing of a four-wheeled vehicle.IEEE Control.Syst.Mag.2011, 31, 29-37.[ 谷歌学术]
  2. Ji, P.; Zhu, Y.; Cheng, C.; Du, X. Design of self-balancing two-wheeled vehicle control system based on STM32. Electron. Sci. Technol. 2014, 27, 96–99. [Google Scholar]
    Ji, P.; Zhu, Y.; Cheng, C.; Du, X. 基于 STM32 的自平衡两轮车控制系统设计。Electron.Sci.2014, 27, 96-99.[ 谷歌学术]
  3. Wu, J.; Sun, L. Two-wheeled self-balancing robot control method study. J. Harbin Univ. Sci. Technol. 2014, 19, 22–26. [Google Scholar]
  4. Sun, J.; Gao, G.; Pan, H.; Mao, R. Attitude information fusion processing of quadrotor based on nonlinear complementary filtering algorithm. Sens. World 2017, 23, 14–19. [Google Scholar]
  5. Liu, K.; Bai, M.; Ni, Y. Two-wheel self-balanced car based on Kalman filtering and PID algorithm. In Proceedings of the 2011 IEEE 18th International Conference on Industrial Engineering and Engineering Management, Changchun, China, 3–5 September 2011; pp. 281–285. [Google Scholar]
  6. Fu, X.; Zhao, M.; Zhou, W. Attitude detection of mobile robot based on complementary filter Algorithm. Meas. Control. Technol. 2015, 34, 31–33. [Google Scholar]
  7. Li, J.; Wang, Y.; Wei, C.; Zhang, P. A survey on the application of Kalman filtering method in power system. Power Syst. Prot. Control. 2014, 42, 135–144. [Google Scholar]
  8. Hu, K.; Li, Y.; Liu, W. Control algorithm of the quadrotor aircraft based on Kalman filter. J. Detect. Control. 2020, 42, 50–55. [Google Scholar]
  9. Li, Q.; Chu, J.; Li, R.; Wang, H. Moving object tracking algorithm for mobile robot based on Kalman filter. Transducer Microsyst. Technol. 2008, 27, 66–71. [Google Scholar]
  10. Filho, L.C.; Filho, J.F.; da Silva, N.B.; Branco, K.C. Attitude estimation of a simulated flight and GPS positioning with Kalman filter. In Proceedings of the International Conference on Unmanned Aircraft Systems, Denver, CO, USA, 9–12 June 2015; pp. 742–750. [Google Scholar]
  11. Wu, T.; Bai, R.; Zhu, L.; Qian, Z. Design of a navigation posture reference system based on Kalman filtering. J. Sens. Technol. 2016, 29, 531–535. [Google Scholar]
  12. Li, Y.; Tong, S.; Li, T. Adaptive fuzzy output-feedback control for output constrained nonlinear systems in the presence of input saturation. Fuzzy Sets Syst. 2014, 248, 138–155. [Google Scholar] [CrossRef]
  13. Li, L.; Zhao, L.; Tang, X.; He, W.; Li, F. Attitude estimation algorithm based on fuzzy Kalman filter. Instrum. Tech. Sens. 2019, 100–105, 110. [Google Scholar]
  14. Wang, L.; Li, H. Parking kinematic modeling based on fuzzy Kalman filter speed estimation. J. Chongqing Univ. Technol. (Nat. Sci.) 2021, 35, 63–70. [Google Scholar]
  15. Gomes, D.; Serra, G. Interval type-2 evolving fuzzy Kalman filter for processing of unobservable spectral components from uncertain experimental data. J. Frankl. Inst. 2024, 361, 637–669. [Google Scholar] [CrossRef]
  16. Peng, S.; Miao, Y.; Xiong, R.; Bai, J.; Cheng, M.; Pecht, M. State of charge estimation for a parallel battery pack jointly by fuzzy-PI model regulator and adaptive unscented Kalman filter. Appl. Energy 2024, 360, 122807. [Google Scholar] [CrossRef]
  17. Yang, X.; Zhang, W.; Gao, H.; Mi, H. Study on obstacle avoidance of mobile robot based on fuzzy control. Transducer Microsyst. Technol. 2017, 36, 51–54. [Google Scholar]
  18. Yan, L.; Qu, Q.; Bai, T.; Shu, D.; Zhou, C. Simulation analysis of loop tracking algorithm based on extended Kalman filter. Firepower Command. Control. 2022, 47, 14–17. [Google Scholar]
  19. Yuan, X.; Li, H. Fuzzy system of center of gravity method based on input-output data and its generalized approximability. Fuzzy Syst. Math. 2011, 25, 85–92. [Google Scholar]
  20. Liang, G.; Du, M.; Zhou, Z.; Liu, C.; Wen, Y. Attitude control based on complementary filter for two-wheel self-balanced car. Meas. Control. Technol. 2015, 34, 72–74. [Google Scholar]
  21. Liu, E.; Jiang, X. Kalman filter-based attitude detection of two-wheeled self-balancing vehicle. Autom. Instrum. 2015, 2, 52–54. [Google Scholar]
Figure 1. Photograph of the two-wheeled self-balancing car.
Applsci 14 05296 g001
Figure 2. Block diagram of the circuit system.
Applsci 14 05296 g002
Figure 3. Inverted pendulum system for the two-wheeled self-balancing car.
Applsci 14 05296 g003
Figure 4. Kalman filter update schematic.
Applsci 14 05296 g004
Figure 5. Residual mean affiliation distribution.
Applsci 14 05296 g005
Figure 6. Residual variance affiliation distribution.
Applsci 14 05296 g006
Figure 7. The principle of complementary filter.
Applsci 14 05296 g007
Figure 8. Angular fluctuations of −10° back to equilibrium [20,21].
Applsci 14 05296 g008
Figure 9. Angular fluctuations of −20° back to equilibrium [20,21].
Applsci 14 05296 g009
Figure 10. Angular fluctuations of −30° back to equilibrium [20,21].
Applsci 14 05296 g010
Figure 11. Angular fluctuations of 10° back to equilibrium [20,21].
Applsci 14 05296 g011
Figure 12. Angular fluctuations of 20° back to equilibrium [20,21].
Applsci 14 05296 g012
Figure 13. Angular fluctuations of 30° back to equilibrium [20,21].
Applsci 14 05296 g013
Table 1. Fuzzy rule table.
Input e¯kInput P^ekOutput αk, βk
SS
SMM
LS
SM
MML
LL
SM
LML
LL
Table 2. Equilibrium time for different angles (unit: seconds).
−10°−20°−30°10°20°30°
Fuzzy Kalman filtering algorithm0.751.051.600.831.011.63
Kalman filtering algorithm (Liu 2015) [21]0.951.302.001.021.212.12
Complementary filtering algorithm (Liang 2015) [20]1.451.802.451.431.852.39
Table 3. Tilt angle integral absolute error.
−10°−20°−30°10°20°30°
Fuzzy Kalman filtering algorithm255.84243.43335.70337.07232.82352.51
Kalman filtering algorithm (Liu 2015) [21]302.27298.31398.30356.58271.24473.89
Complementary filtering algorithm (Liang 2015) [21]592.61378.13632.18697.28455.38609.13
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Ma, Y.; Meng, F.; Xiong, S. Design and Implementation of a Two-Wheeled Self-Balancing Car Using a Fuzzy Kalman Filter. Appl. Sci. 2024, 14, 5296. https://doi.org/10.3390/app14125296

AMA Style

Ma Y, Meng F, Xiong S. Design and Implementation of a Two-Wheeled Self-Balancing Car Using a Fuzzy Kalman Filter. Applied Sciences. 2024; 14(12):5296. https://doi.org/10.3390/app14125296

Chicago/Turabian Style

Ma, Yimin, Fanhao Meng, and Shuangshuang Xiong. 2024. "Design and Implementation of a Two-Wheeled Self-Balancing Car Using a Fuzzy Kalman Filter" Applied Sciences 14, no. 12: 5296. https://doi.org/10.3390/app14125296

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Citations

No citations were found for this article, but you may check on Google Scholar

Article Access Statistics

Created with Highcharts 4.0.4Chart context menuArticle access statisticsArticle Views19. Jun20. Jun21. Jun22. Jun23. Jun24. Jun25. Jun26. Jun27. Jun28. Jun29. Jun30. Jun1. Jul2. Jul3. Jul4. Jul5. Jul6. Jul7. Jul8. Jul9. Jul10. Jul11. Jul12. Jul13. Jul14. Jul0100200300400
For more information on the journal statistics, click here.
Multiple requests from the same IP address are counted as one view.
Back to Top 返回页首Top
Arndt, D.; Bobrow, J.E.; Peters, S.; Iagnemma, K.; Dubowsky, S. Two-wheel self-balancing of a four-wheeled vehicle. IEEE Control. Syst. Mag. 2011, 31, 29–37. [Google Scholar]