邢強(qiáng) 虞凱西 谷玉之
摘 要: 為實(shí)現(xiàn)智能車(chē)在狹長(zhǎng)通道內(nèi)的避障,提出基于距離的間距平衡避障策略:控制小車(chē)沿兩障礙物間距的中點(diǎn)方向前進(jìn),沿中間平衡通過(guò)。小車(chē)以STC12C5A60S2為主控單元,將兩超聲波測(cè)距傳感器對(duì)稱(chēng)、垂直分布在車(chē)頭前進(jìn)方向;根據(jù)檢測(cè)距離,單片機(jī)PCA模塊產(chǎn)生PWM波控制舵機(jī)轉(zhuǎn)向,實(shí)現(xiàn)無(wú)碳小車(chē)避障。該方法模仿生物視覺(jué)避障,建立基于距離參數(shù)構(gòu)建間距平衡策略,實(shí)現(xiàn)在狹長(zhǎng)通道下的單片機(jī)控制的實(shí)時(shí)避障,具有運(yùn)算量小、運(yùn)動(dòng)靈敏、運(yùn)行穩(wěn)定等特點(diǎn)。實(shí)驗(yàn)表明,間距平衡避障策略,方法簡(jiǎn)單,并能有效實(shí)施實(shí)時(shí)避障。
關(guān)鍵詞: 間距平衡; 避障策略; 超聲波測(cè)距傳感器; 生物視覺(jué); 無(wú)碳小車(chē); STC12C5A60S2
中圖分類(lèi)號(hào): TN752.6?34 文獻(xiàn)標(biāo)識(shí)碼: A 文章編號(hào): 1004?373X(2018)20?0097?03
Abstract: A distance?based spacing equilibrium obstacle avoidance strategy is proposed to realize obstacle avoidance of the intelligent vehicle running in the long narrow lane. The controlled vehicle moves ahead along the midpoint of the spacing between two obstacles, and passes in equilibrium. STC12C5A60S2 is taken as the main control unit of the vehicle, and two range?finding ultrasonic sensors are symmetrically and vertically installed on the head of the vehicle at the forward motion direction. The PCA module of the SCM generates PWM waves to control the rotation direction of the steering mechanism according to the detection distance, and realize obstacle avoidance for the carbon?free vehicle. In this method, biological vision is simulated for obstacle avoidance to establish the spacing equilibrium strategy based on distance parameters, so as to realize real?time SCM controlled obstacle avoidance in the long narrow lane. The method has characteristics of small computation quantity, flexible motion and stable operation. The experimental results show that the spacing equilibrium obstacle avoidance strategy is simple, and can effectively implement real?time obstacle avoidance.
Keywords: spacing equilibrium; obstacle avoidance strategy; range?finding ultrasonic sensor; biological vision; carbon?free vehicle; STC12C5A60S2
傳統(tǒng)移動(dòng)機(jī)器人避障法中的可視圖法、柵格法、自由空間法等,僅可實(shí)現(xiàn)對(duì)障礙信息已知的環(huán)境避障。在智能避障法中,人們以障礙物為約束條件將路徑規(guī)劃轉(zhuǎn)換為一個(gè)優(yōu)化問(wèn)題,研究集中于尋找最優(yōu)序列配置的人工智能算法:如遺傳算法[1]、 神經(jīng)網(wǎng)絡(luò)[2]和其他算法如粒子群(PSO)算法[3]、 Layer?iterative 梯度函數(shù)算法[4]、 基于多項(xiàng)式空間變換方法[5]。這些方法雖然最終可以找到最優(yōu)序列,但都比較耗時(shí),不利于在線操作[6]。
在仿生避障法中,人們提出基于光流的路徑規(guī)劃法[7?10],通過(guò)光流參數(shù)構(gòu)建平衡策略[11?12],實(shí)現(xiàn)避障,在實(shí)時(shí)系統(tǒng)中表現(xiàn)良好。
要實(shí)現(xiàn)基于單片機(jī)的小車(chē)實(shí)時(shí)避障,需減小傳感器的信號(hào)采集量與信號(hào)處理量。源自光流參數(shù)路徑規(guī)劃策略,以檢測(cè)距離作為避障參數(shù),構(gòu)建間距平衡的避障策略。實(shí)施中以STC12C5A60S2為主控單元,HC?SR0超聲波模塊為測(cè)距傳感器,基于間距平衡避障策略,實(shí)現(xiàn)小車(chē)在狹長(zhǎng)賽道內(nèi)的智能避障。
間距平衡避障策略在于:傳感器檢測(cè)左右對(duì)稱(chēng)環(huán)境下的距離,當(dāng)某一側(cè)的偏距較大時(shí),舵機(jī)控制向該側(cè)偏轉(zhuǎn),控制小車(chē)沿兩間距的中點(diǎn)方向前進(jìn)。原理如圖1所示。
圖1中:a,b為兩路超聲波測(cè)出的距離;c為由a,b邊構(gòu)成的三角形中∠C的對(duì)邊。當(dāng)a=b時(shí),小車(chē)前進(jìn)方向?yàn)锳′B邊的中點(diǎn)方向;當(dāng)a,b邊長(zhǎng)度發(fā)生變化時(shí),小車(chē)前進(jìn)方向依舊為AB邊的中點(diǎn)方向(即保持兩檢測(cè)點(diǎn)間距相等)。對(duì)于對(duì)稱(chēng)分布的傳感器而言,小車(chē)前進(jìn)方向就需要調(diào)整前進(jìn)角度,即為相應(yīng)的偏轉(zhuǎn)角[α]。根據(jù)圖中幾何關(guān)系、阿波羅尼斯定理及三角函數(shù)關(guān)系,得舵機(jī)轉(zhuǎn)角[α]:
此方法能使小車(chē)前進(jìn)方向沿著兩測(cè)距點(diǎn)的中點(diǎn)方向前進(jìn),保持間距相等。當(dāng)小車(chē)通過(guò)障礙物時(shí),兩點(diǎn)間距需要滿(mǎn)足[a2+b2>W](W為小車(chē)的寬度),否則不通過(guò)。
2.1 無(wú)碳小車(chē)結(jié)構(gòu)設(shè)計(jì)
設(shè)計(jì)的三輪式電控“無(wú)碳小車(chē)”,右后輪為驅(qū)動(dòng)主動(dòng)輪,由下落砝碼經(jīng)傳動(dòng)比為4、模數(shù)為1的單級(jí)齒輪驅(qū)動(dòng)機(jī)構(gòu)提供前進(jìn)動(dòng)力;左后輪為行進(jìn)從動(dòng)輪,從動(dòng)輪與驅(qū)動(dòng)輪間的差速由地面的運(yùn)動(dòng)約束確定;前輪為轉(zhuǎn)向輪,由舵機(jī)控制實(shí)現(xiàn)轉(zhuǎn)向。兩超聲波傳感器對(duì)稱(chēng)、且相互垂直分布在小車(chē)前端,結(jié)構(gòu)與傳感器分布如圖2所示。
2.2 無(wú)碳小車(chē)的硬件電路設(shè)計(jì)
避障小車(chē)采用STC12C5A60S2單片機(jī)為主控芯片,較STC89C52來(lái)說(shuō),不再進(jìn)行12分頻,運(yùn)行速度比傳統(tǒng)的51單片機(jī)快7~12倍;擁有2路PWM波可當(dāng)作DA使用,和較高的定時(shí)器或I/O口的利用率與程序運(yùn)行速度,有助于簡(jiǎn)化編程。
測(cè)距傳感器采用HC?SR04超聲波測(cè)距模塊;兩模塊呈垂直對(duì)稱(chēng)分布,通過(guò)P1端口與單片機(jī)連接,實(shí)現(xiàn)兩路超聲波信號(hào)采集。該超聲波模塊工作測(cè)距原理如下:經(jīng)發(fā)射器發(fā)出8個(gè)頻率40 kHz的信號(hào);通過(guò)換能器接收反饋信號(hào)并產(chǎn)生電壓信號(hào),經(jīng)A/D轉(zhuǎn)換輸出回響信號(hào)。單片機(jī)采集超聲波脈沖由傳感器發(fā)出到接收所經(jīng)歷的時(shí)間為t,超聲波在空氣中傳播的速度為c,則傳感器與目標(biāo)物間的距離D可表示為:[D=ct2]。
3.1 程序設(shè)計(jì)與實(shí)現(xiàn)
平衡避障法實(shí)現(xiàn)的關(guān)鍵在于:測(cè)距傳感器的間距檢測(cè);PWM波實(shí)現(xiàn)[α]舵機(jī)轉(zhuǎn)向的控制。
兩測(cè)距模塊的測(cè)距程序如圖4a)所示,依次實(shí)現(xiàn)對(duì)兩傳感器的信號(hào)觸發(fā)與距離判斷。在舵機(jī)轉(zhuǎn)向控制程序中,根據(jù)式(1)獲得航角偏差,通過(guò)STC12C5A60S2的PCA模塊實(shí)現(xiàn)PWM波的輸出,舵機(jī)轉(zhuǎn)角信號(hào)的輸出與控制程序流程如圖4b)所示。在主程序中,根據(jù)超聲波傳感器測(cè)得的距離算出當(dāng)前位置與目標(biāo)位置的航角偏差,判斷左轉(zhuǎn)、右轉(zhuǎn)或直行;通過(guò)PCA模塊實(shí)現(xiàn)舵機(jī)對(duì)應(yīng)轉(zhuǎn)角的控制,實(shí)現(xiàn)避障操作。
3.2 實(shí)驗(yàn)與結(jié)果
根據(jù)第五屆全國(guó)大學(xué)生工程訓(xùn)練綜合能力競(jìng)賽命題“無(wú)碳小車(chē)”電控組要求:小車(chē)初始重力勢(shì)能由在400 mm高度質(zhì)量為1 kg的砝碼提供;賽道總長(zhǎng)度30 m,道面寬度1.2 m,賽道邊緣設(shè)有高度為80 mm的道牙擋板;賽道上隨機(jī)設(shè)置多個(gè)障礙墻,障礙墻高度約80 mm,相鄰障礙墻之間最小間距為1 m,每個(gè)障礙墻長(zhǎng)度為60~75 cm不等;設(shè)計(jì)的無(wú)碳小車(chē)長(zhǎng)寬(W×H)分別為150 mm×280 mm;車(chē)寬與障礙物的間距符合小車(chē)通行條件。
將設(shè)計(jì)的小車(chē)放置在起點(diǎn)中點(diǎn),起點(diǎn)偏障礙一側(cè),起點(diǎn)遠(yuǎn)離障礙一側(cè)進(jìn)行試驗(yàn),均能成功避障。無(wú)碳小車(chē)實(shí)物與避障測(cè)試圖如圖5所示。
為了實(shí)現(xiàn)在狹長(zhǎng)通道內(nèi)的避障,提出基于間距平衡的避障策略。該方法基于單片機(jī)和傳感器原理,以STC12C5A60S2單片機(jī)為主控芯片,以HC?SR04為測(cè)距傳感器實(shí)現(xiàn)了對(duì)舵機(jī)ES08MD的轉(zhuǎn)向角度控制,實(shí)現(xiàn)“無(wú)碳小車(chē)”的避障測(cè)試實(shí)驗(yàn)。實(shí)驗(yàn)是在既定運(yùn)動(dòng)方向的情況下實(shí)現(xiàn)的,具有一定的局限性;但實(shí)驗(yàn)結(jié)果證明該避障小車(chē)與方法能夠很好按照預(yù)期完成避障動(dòng)作,具有運(yùn)動(dòng)靈敏、效果好、運(yùn)行穩(wěn)定等優(yōu)點(diǎn)。
參考文獻(xiàn)
[1] 鄭來(lái)芳,孫煒,歐陽(yáng)明華,等.結(jié)合光流和人工勢(shì)場(chǎng)的風(fēng)管機(jī)器人避障方法[J].計(jì)算機(jī)工程與應(yīng)用,2016,52(9):243?247.
ZHENG Laifang, SUN Wei, OUYANG Minghua, et al. Obstacle detection method for duct cleaning robot combining optical flow and artificial potential field [J]. Computer engineering and applications, 2016, 52(9): 243?247.
[2] ATIA M, NOURELDIN A. Recursive genetic algorithm for robot manipulator motion planning in the existence of obstacles [J]. Recent advances in computer science and information engineering, 2012, 124: 571?581.
[3] ZHANG Q, JI L, ZHOU D, et al. Nonholonomic motion planning for minimizing base disturbances of space manipulators based on multi?swarm PSO [J]. Robotica, 2015, 35(4): 861?875.
[4] XIE S, WU P, PENG Y, et al. The obstacle avoidance planning of USV based on improved artificial potential field [C]// Proceedings of IEEE International Conference on Information and Automation. Hailar: IEEE, 2014: 746?751.
[5] KORAYEM M H, NAZEMIZADEH M, NOHOOJI H R. Optimal point?to?point motion planning of non?holonomic mobile robots in the presence of multiple obstacles [J]. Journal of the Brazilian Society of Mechanical Sciences and Engineering, 2014, 36(1): 221?232.
[6] KORAYEM M H, NAZEMIZADEH M, RAHIMI H N. Dynamic optimal payload path planning of mobile manipulators among moving obstacles [J]. Advanced robotics, 2014, 28(20): 1389?1402.
[7] 張小東,孫國(guó)鵬.基于光流的旋翼無(wú)人機(jī)障礙物檢測(cè)方法[J].測(cè)繪與空間地理信息,2017,40(5):73?77.
ZHANG Xiaodong, SUN Guopeng. Obstacle detection method based on optical flow for rotor UAV [J]. Geomatics & spatial information technology, 2017, 40(5): 73?77.
[8] 胡覺(jué)暉,李一民,潘曉露.改進(jìn)的光流法用于車(chē)輛識(shí)別與跟蹤[J].科學(xué)技術(shù)與工程,2010,10(23):5814?5817.
HU Juehui, LI Yimin, PAN Xiaolu. An improved optical flow algorithm in vehicle identification and tracking [J]. Science technology and engineering, 2010, 10(23): 5814?5817.
[9] 張磊,項(xiàng)學(xué)智,趙春暉.基于光流場(chǎng)與水平集的運(yùn)動(dòng)目標(biāo)檢測(cè)[J].計(jì)算機(jī)應(yīng)用,2009,29(4):972?975.
ZHANG Lei, XIANG Xuezhi, ZHAO Chunhui. Motion object detection based on optical flow field and level set [J]. Journal of computer applications, 2009, 29(4): 972?975.
(上接第99頁(yè))
[10] 沈美麗,宋華軍.基于角點(diǎn)檢測(cè)的光流目標(biāo)跟蹤算法[J].電子器件,2007,30(4):1397?1399.
SHEN Meili, SONG Huajun. Optic flow target tracking method based on corner detection [J]. Chinese journal of electron devices, 2007, 30(4): 1397?1399.
[11] SOUHILA K, KARIM A. Optical flow based robot obstacle avoidance [J]. International journal of advanced robotic systems, 2007, 4(1): 13?16.
[12] FRANCESCHINI N. Small brains, smart machines: from fly vision to robot vision and back again [J]. Proceedings of the IEEE, 2014, 102(5): 751?781.