徐澤遠
摘要 [目的]設(shè)計并制作一套簡易旋轉(zhuǎn)倒立擺及其控制裝置。[方法]采用9S12XE單片機作為簡易旋轉(zhuǎn)倒立擺及控制裝置的監(jiān)測和控制系統(tǒng)的核心,采用L298驅(qū)動直流電機作為動力。通過編碼器及最優(yōu)控制策略LQR在平衡點附近給出系統(tǒng)的線性化模型,對系統(tǒng)的穩(wěn)定性、能控性進行調(diào)試。[結(jié)果]應(yīng)用Lagrange方程對試驗采用的單級旋轉(zhuǎn)倒立擺系統(tǒng)進行建模,獲得了旋臂長度(r)、水平和豎直方向的角位移(Q)、擺桿質(zhì)心與鉸鏈距離(L)4者的最佳平衡點與動態(tài)方程;優(yōu)化LQR控制器獲得最優(yōu)狀態(tài)反饋增益矩陣;進行計算機編程,應(yīng)用9s12XE單片機控制,并執(zhí)行試驗;結(jié)果表明旋轉(zhuǎn)臂的轉(zhuǎn)動頻率趨近于擺桿的轉(zhuǎn)周期則擺桿能到達正負155度以上,能很快地完成設(shè)計要求的基本動作,并且能迅速進入PID控制器調(diào)控范圍,完成堅立狀態(tài)。[結(jié)論]經(jīng)誤差分析表明該裝置的穩(wěn)定性良好,誤差范圍可控制在正負15度之內(nèi);調(diào)試結(jié)果證明,已實現(xiàn)了倒立擺的平衡控制。
關(guān)鍵詞 旋轉(zhuǎn)倒立擺;角度編碼器;最優(yōu)控制策略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 設(shè)計目的
設(shè)計并制作一套簡易旋轉(zhuǎn)倒立擺及其控制裝置(圖1)。該裝置必須滿足下例條件:①擺桿從處于自然下垂狀態(tài)開始,驅(qū)動電機帶動旋轉(zhuǎn)臂作往復(fù)旋轉(zhuǎn)使擺桿擺動,并盡快達到或超過正負60度;②直至完成圓周運動;③外力將擺桿由自然下垂狀態(tài)拉起至165度位置,外力撤除同時,啟動控制旋轉(zhuǎn)臂使擺桿保持倒立狀態(tài)時間不少于5s;期間旋轉(zhuǎn)臂的轉(zhuǎn)動角度不大于90度。
2 方案
根據(jù)項目要求,設(shè)計的系統(tǒng)模塊組成為電機模塊、傳感器模塊(作為輸入),微控制器模塊MCU(作為處理中心),電機驅(qū)動模塊(作為輸出)。
2.1 電機模塊 采用直流電機。直流電機是依靠直流電驅(qū)動的,在小型電器上應(yīng)用廣泛。直流電機可實現(xiàn)平滑調(diào)速。
2.2 傳感器模塊 絕對值型旋轉(zhuǎn)編碼器是一種速度位移傳感器,是模擬電壓量輸出,需采用AD直接采樣,旋轉(zhuǎn)編碼器的模擬輸出電壓經(jīng)ADC轉(zhuǎn)換后,輸出二進制編碼給單片機,單片機據(jù)此作出分析與下一步控制。
3 理論分析與計算
3.1 系統(tǒng)數(shù)學(xué)模型的建立
對旋轉(zhuǎn)倒立擺系統(tǒng)建立數(shù)學(xué)模型,并對試驗采用的單級旋轉(zhuǎn)倒立擺系統(tǒng)的數(shù)學(xué)模型進行分析(圖2)。由圖2可知,在忽略各種阻力和摩擦的條件下,旋臂和擺桿可以抽象為2個勻質(zhì)桿,其中旋臂長度為r,相對其水平方向零位的角位移為θ;擺桿質(zhì)心與鉸鏈距離為L,相對其豎直方向零位的角位移為α。
軟件和硬件系統(tǒng)具備良好的穩(wěn)定性,能滿足基礎(chǔ)部分的要求。
參考文獻
[1]段旭東,許可.單級旋轉(zhuǎn)倒立擺的建模與控制仿真[J].機器人技術(shù)與應(yīng)用,2002(5):43-46.
[2] 李保林,呂躍,袁浩.一級旋轉(zhuǎn)倒立擺的模糊控制[J].實驗室科學(xué),2008(5):77-79.