徐澤遠
摘要 [目的]設計并制作一套簡易旋轉倒立擺及其控制裝置。[方法]采用9S12XE單片機作為簡易旋轉倒立擺及控制裝置的監測和控制系統的核心,采用L298驅動直流電機作為動力。通過編碼器及最優控制策略LQR在平衡點附近給出系統的線性化模型,對系統的穩定性、能控性進行調試。[結果]應用Lagrange方程對試驗采用的單級旋轉倒立擺系統進行建模,獲得了旋臂長度(r)、水平和豎直方向的角位移(Q)、擺桿質心與鉸鏈距離(L)4者的最佳平衡點與動態方程;優化LQR控制器獲得最優狀態反饋增益矩陣;進行計算機編程,應用9s12XE單片機控制,并執行試驗;結果表明旋轉臂的轉動頻率趨近于擺桿的轉周期則擺桿能到達正負155度以上,能很快地完成設計要求的基本動作,并且能迅速進入PID控制器調控范圍,完成堅立狀態。[結論]經誤差分析表明該裝置的穩定性良好,誤差范圍可控制在正負15度之內;調試結果證明,已實現了倒立擺的平衡控制。
關鍵詞 旋轉倒立擺;角度編碼器;最優控制策略LQR
中圖分類號 S220.2 文獻標識碼
A 文章編號 0517-6611(2014)26-09216-02
Design of Simple Rotary Inverted Pendulum and Control Device
XU Ze-yuan (College of Mechanical and Electrical Engineering, Northeast Forestry University, Harbin, Heilongjiang 150040)
Abstract [Objective] To design a simple rotary inverted pendulum and control device. [Method] The system uses 9S12XE micro-controller as a core monitoring and controlling system of simple rotary inverted pendulum and control device, using L298 drive DC motors. By the encoder and LQR optimal control strategy given linearized model of the system in the vicinity of the equilibrium point, the systems stability, controllability are debugged to achieve a balanced inverted pendulum control. [Result] Using Lagrange equation, the adopted rotary inverted pendulum was modeled, the optimal balance point and dynamic equation of the length of the rotary arm(r), angular displacement of level and vertical direction(Q), the pendulum mass and hinge distance [L] were obtained; LQR was optimized to obtain the best state; 9512XE single chip microcomputer control was applied to carry out the test. The results showed that pendulum rod can up to above negative 155 angel when the rotation cycle frequency approaches the pendulum rod rotating arm and rapidly complete the basic design requirements. [Conclusion] Through error analysis, it was found that the device has good stability, error range could be controlled within positive and negative 15 angle; the results proved the balance control of inverted pendulum.
Key words Rotary inverted pendulum; Angle encoder; LQR optimal control strategy
1 設計目的
設計并制作一套簡易旋轉倒立擺及其控制裝置(圖1)。該裝置必須滿足下例條件:①擺桿從處于自然下垂狀態開始,驅動電機帶動旋轉臂作往復旋轉使擺桿擺動,并盡快達到或超過正負60度;②直至完成圓周運動;③外力將擺桿由自然下垂狀態拉起至165度位置,外力撤除同時,啟動控制旋轉臂使擺桿保持倒立狀態時間不少于5s;期間旋轉臂的轉動角度不大于90度。
2 方案
根據項目要求,設計的系統模塊組成為電機模塊、傳感器模塊(作為輸入),微控制器模塊MCU(作為處理中心),電機驅動模塊(作為輸出)。
2.1 電機模塊 采用直流電機。直流電機是依靠直流電驅動的,在小型電器上應用廣泛。直流電機可實現平滑調速。
2.2 傳感器模塊 絕對值型旋轉編碼器是一種速度位移傳感器,是模擬電壓量輸出,需采用AD直接采樣,旋轉編碼器的模擬輸出電壓經ADC轉換后,輸出二進制編碼給單片機,單片機據此作出分析與下一步控制。
3 理論分析與計算
3.1 系統數學模型的建立
對旋轉倒立擺系統建立數學模型,并對試驗采用的單級旋轉倒立擺系統的數學模型進行分析(圖2)。由圖2可知,在忽略各種阻力和摩擦的條件下,旋臂和擺桿可以抽象為2個勻質桿,其中旋臂長度為r,相對其水平方向零位的角位移為θ;擺桿質心與鉸鏈距離為L,相對其豎直方向零位的角位移為α。
軟件和硬件系統具備良好的穩定性,能滿足基礎部分的要求。
參考文獻
[1]段旭東,許可.單級旋轉倒立擺的建模與控制仿真[J].機器人技術與應用,2002(5):43-46.
[2] 李保林,呂躍,袁浩.一級旋轉倒立擺的模糊控制[J].實驗室科學,2008(5):77-79.