2011-06-24 139 views
2

我建立使用以下作爲靈感自動迷宮求解器:OpenCV的基於迷宮迷宮求解器

http://www.youtube.com/watch?v=Prq78ctJ2Rk&feature=related 我已經建立了迷宮控制用步進電機和我使用下面的步進電機控制板:

http://www.sparkfun.com/products/10025

我使用視覺系統來控制迷宮求解器。我也發現這個地方的問題已經解決了一個鏈接:

http://cse.logicol.org/?p=52

他們用模板匹配識別球。在上面的鏈接中提到的團隊也上傳了一個視頻,看起來他們具有canny邊緣檢測功能,以查找路徑並執行PID算法。

http://www.youtube.com/watch?v=8b5ARjT22bg&feature=player_embedded

現在,我也確定了OpenCV的模板匹配和邊緣檢測。我還通過USB串口建立了我的步進控制器。我如何實現導航算法?我如何實現PID控制?理論上我知道PID控制的概念,但我只是不知道如何使用攝像頭的信息來實現它。我只是無法讓球跟隨線路。

請找到我迄今爲止獲得的結果的附加圖像。

西

+0

什麼附加圖片? –

+0

由於新的用戶限制,我無法附加圖片。 – Sai

回答

0

我不太明白你的問題,但如果你問什麼命令分給ballgiven其位置在這裏是我的猜想:

1. you find the location of the ball. 
2. you have the line of the desired path drown on the board and detected 
using canny. 
3. Find the closest point to the ball which is on the path line. If 
it was a straight line then the calculation is simple geometrical 
formulae dist(point,line). Let us call the result D. 
4. The resulting point on the line is where the ball should be. 
5. Advance distance D along the path line. This would give you your 
destination point. 
6. Subtract ball coordinates from destination point, and then, using atan2() 
method to calculate in which direction to move the ball. 
7. Activate motores to tilt board in that direction. 

澄清步驟5.爲什麼我說沿路徑推進距離D?因爲這樣可以將球引導至最多45度的路徑線上。這給你相對平穩的電機運動。

如果我不明白你的問題,請告訴我,我會糾正我的回答