2

I am building an automatic maze solver using the following as an inspiration:

http://www.youtube.com/watch?v=Prq78ctJ2Rk&feature=related I have built the maze control with steppers and I am using the following stepper motor control board:

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

I am using a vision system to control the maze solver. I also found a link where this problem has been solved:

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

They have used template matching to identify the ball. The team mentioned in the above link also uploaded a video where it looks like they have canny edge detection for finding the path and executing a PID algorithm.

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

Now, I have also established template matching and edge detection in opencv. I have also established controls of my stepper via USB serial port. How do I implement the navigation algorithm? How do I implement the PID control? I know the concept of PID control theoretically but I just don't know to implement it using the information from the camera. I am just clueless about making the ball follow the line.

Please find an attached image of the result I have obtained so far.

Sai

Taryn
  • 242,637
  • 56
  • 362
  • 405
Sai
  • 21
  • 2

1 Answers1

0

I didn't quite understand your question but If you ask what commands give to the ballgiven its position here is my guess:

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.

Clarification to step 5. Why did I say to advance distance D along the path? Because thus you direct the ball in at most 45 degrees of the path line. This gives you relatively smooth motor movement.

If I didnt understand your question please tell me and I will correct my answer

DanielHsH
  • 4,287
  • 3
  • 30
  • 36