Line-Maze Algorithm solved..... but???
RichardV2
Posts: 4
I completed the initial code for a line maze robot.
I know how to "unwind" all the bad/dead ends so that the robot can avoid all the dead ends the second time through.
I just don't know how to store the shortest path from run #1 and then use it in run #2.
Say after run #1, my shortest path is: LRSSRLSR (L = left, R = right, S = straight)
I have LRSSRLSR in an array (actually as numbers instead of letters) when the program shuts down at the end of run #1. What do I do with this so the robot knows to follow this path on run #2???
I know how to "unwind" all the bad/dead ends so that the robot can avoid all the dead ends the second time through.
I just don't know how to store the shortest path from run #1 and then use it in run #2.
Say after run #1, my shortest path is: LRSSRLSR (L = left, R = right, S = straight)
I have LRSSRLSR in an array (actually as numbers instead of letters) when the program shuts down at the end of run #1. What do I do with this so the robot knows to follow this path on run #2???
Comments
Read EEPROM byte
If 0 then
...write 1 to EEPROM byte for next trip
...GoThroughMazeFromScratch
else
...readShortestPathFromEEPROM
...follow shortest path
endif
If EEPROM stays the same from the last program, then this won't work... Or can I write a zero to the EEPROM byte when I download the code?
·
When you use "DATA" statements in your code, each time you 'download' a new program, those DATA statements are written to eeprom, and can be read with "READ" and changed with "WRITE".
There IS a way of "reserving" EEPROM space from being cleared -- I think it's an option of the DATA statement.
If you don't "download" a new program, whatever you WRITE to eeprom stays until you WRITE something new to eeprom. You can only WRITE each location a million times, so be careful during testing.