Junction Detector using iPitara
Consider a grid, we want the robot to move from one corner of the grid to another. The most important part of being able to do so would be to detect a junction. Let us see if we can do this…
Here is what the grid looks like:
The first thing that strikes me is that maybe I can develop on the concept of a line sensor. So I use three of the IR sensors.
Thought process:
The most basic way to detect a junction would be that if all the three sensors detect the black line then, a junction has been reached and for other areas it acts like a basic line follower. If the right sensor detect the line then turn right and if the left sensor detects a line then turn left.
Algorithm:
1: start
2: if IR1, IR3 on WHITE AND IR2 on BLACK
3: then GO FWD
4: if IR1 on BLACK AND IR2, IR3 on WHITE
5: then TURN LEFT
6: if IR3 on BLACK AND IR1, IR2 on WHITE
7: then TURN RIGHT
8: if IR1, IR2, IR3 on BLACK
9: then (junction detected)
10: go BACK to STEP 2
11: end
So now that we have detected the junction we can program the robot to go left and right alternately on each junction to reach the other corner of the grid. Try it out!
You can use basic black electric tape to make the grid on the floor.
Consider a grid, we want the robot to move from one corner of the grid to another. The most important part of being able to do so would be to detect a junction. Let us see if we can do this…
Here is what the grid looks like:
The first thing that strikes me is that maybe I can develop on the concept of a line sensor. So I use three of the IR sensors.
Thought process:
The most basic way to detect a junction would be that if all the three sensors detect the black line then, a junction has been reached and for other areas it acts like a basic line follower. If the right sensor detect the line then turn right and if the left sensor detects a line then turn left.
Algorithm:
1: start
2: if IR1, IR3 on WHITE AND IR2 on BLACK
3: then GO FWD
4: if IR1 on BLACK AND IR2, IR3 on WHITE
5: then TURN LEFT
6: if IR3 on BLACK AND IR1, IR2 on WHITE
7: then TURN RIGHT
8: if IR1, IR2, IR3 on BLACK
9: then (junction detected)
10: go BACK to STEP 2
11: end
So now that we have detected the junction we can program the robot to go left and right alternately on each junction to reach the other corner of the grid. Try it out!
You can use basic black electric tape to make the grid on the floor.