熊超偉 王峰 揭云飛 智凱旋 李學易
摘要:為了實現單軌車輛的自平衡控制,設計了一種基于PID控制的單軌自平衡小車控制系統,該系統將STM32作為主控制器,通過加速度計和陀螺儀采集到的加速度和角速度信號進行數據融合得到小車傾角,然后經過PID控制算法來調整PWM的占空比來控制直流減速電機的轉速和舵機的轉向,進而實現單軌車輛的自平衡控制。該控制算法使用STM32微處理器,控制模型自行車,實現機器人自行車的自動平衡。關鍵詞:PID控制; 機器人自行車;自平衡; STM32; 加速度計; 陀螺儀; 數據融合
中圖分類號:TP273 文獻標識碼:A 文章編號:1009-3044(2018)19-0274-02
Abstract:In order to realize the self-balanced control of monorail vehicles, a monorail self-balancing vehicle control system based on PID control is designed. The system uses STM32 as the main controller and obtains acceleration and angular velocity signals collected by accelerometers and gyroscopes for data fusion. The tilt angle of the trolley then passes through a PID control algorithm to adjust the duty cycle of the PWM to control the speed of the DC geared motor and the steering of the steering gear, thereby realizing the self-balanced control of the monorail vehicle. The control algorithm uses the STM32 microprocessor to control the model bike and achieve automatic balance of the robot bike.
Key words: PID control; robotic bicycle; self-balancing; STM32; accelerometer; gyro; data fusion
1 引言
目前,電動小型單軌車輛被廣泛應用于城市短距離交通。這些車輛不僅價格便宜,而且也節能環保,深受廣大用戶的歡迎。然而,單軌車輛一個突出的問題就是安全性,由于單軌車輛本身是不穩定的[1],并且在駕駛過程中也受駕駛人技術水平影響,單軌車輛出事故的概率也遠高于汽車。
雖然左右輪平衡車Segway問世以來,技術和市場都比較成功,但由于其左右輪的設計結構使得它的制動距離比較的長,這樣使得其剎車方式在很大程度上限制了平衡車的性能和應用范圍。因此,為了讓不穩定的單軌車輛變成安全穩定的交通工具,對單軌車輛自平衡控制的研究就具有十分重要的意義[2]。
單軌自平衡控制系統整體可以分為姿態自平衡,速度控制以及轉向控制。通過對姿態傳感器采集到的信息進行數據融合得到傾角,并經過PID控制算法來得到所需的控制量進而控制驅動電機和舵機來達到單軌小車的自平衡。……