Buy an Axon, Axon II, or Axon Mote and build a great robot, while helping to support SoR.
0 Members and 1 Guest are viewing this topic.
|-----o finish |start
No, it could conceivably create a full map of the maze as it runs (although the mega168 might have some memory issues given it only has 1k of RAM), but this version is designed for non-looped mazes where that's not necessary.
No, it could conceivably create a full map of the maze as it runs (although the mega168 might have some memory issues given it only has 1k of RAM), but this version is designed for non-looped mazes where that's not necessary. Instead, it builds up a list of intersections it's visited, and if it ever reaches a dead end, it back-tracks, eliminates the false paths from the lists, and modifies its record of which way to turn at the intersections it revisits. In the end, all I have in memory is a list of what to do at all of the intersections in the direct path from start to finish.For example, imagine a maze that looks like a plus, where the start is at the bottom and the finish is on the right:Code: [Select] |-----o finish |startThe robot would hit the first intersection, identify that it is possible to turn left, record an "L" for left, and then turn left. The intersection string would now read "L". It would then reach the end of the left branch, note the end of the path, record "B" for back, and turn around. It would reach the intersection again, turn left, and record an "L". Once again, it would reach a dead end, record "B", return to the center intersection, record an "L", and turn left. This would take it to the finish line. Its intersection string would now read:LBLBLIf you note that LBL (left-back-left) is equivalent to S (straight), and LBS (left-back-straight) is equivalent to R (right), you get that this reduces to:(LB(LBL))(LB(S))RAs my robot runs the maze, it is performing this type of reduction as it goes to keep the intersection list as trimmed as possible.- Ben