2011-06-24 87 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度的路径线上。这给你相对平稳的电机运动。

如果我不明白你的问题,请告诉我,我会纠正我的回答