I'm trying to implement A* on arduino uno. But when I enter my critical method(find_path) which does all the work, it disturbs every other method before and after it even if they are not directly related.Kindly help.
code.txt (8.68 KB)
I'm trying to implement A* on arduino uno. But when I enter my critical method(find_path) which does all the work, it disturbs every other method before and after it even if they are not directly related.Kindly help.
code.txt (8.68 KB)
Too many large arrays to fit in RAM? Perhaps they need to be PROGMEM?
Is it possible that the problem will be resolved if I go from 2kb ram to 8kb ram?
static int open_list[100][2]={{-1,-1},{-1,-1},{-1,-1},{-1,-1}
Stupid waste of memory.
Why don't you try using sensible datatypes?
are u saying that the use of int for this in not a good idea?I tried to use char but when I print its value on 16*2 lcd it doesn't work there.
You may have to print a char as a number explicitly, otherwise it may try and print it as an ascii value.
This sketch should illustrate the problem:
void setup() {
Serial.begin( 9600 );
Serial.println( 'a' );
Serial.println( 'a', DEC );
}
void loop() {}
OUTPUT:
a
97
Now I've decreased the size of my code by using chars instead of ints and decreased the size of arrays as well but one problem is persists that after one call to find_path(), it starts from the beginning even though the whole code is residing in setup() not in loop();
please help
thanks in advance
What are you running this on?
It sounds to me like you're still short of memory.
Could you put the original map into EEPROM or something like that?
Can you post your code as it is now?
I've decreased the size of every array and I'm using char instead of int.But its not working still
code.txt (6.76 KB)
for(int j = 0; j < map[i].length; j++){
if(in_wall(i,j))
System.out.print(2 + " ");
else
System.out.print(map[i][j] + " ");
}
System.out.println();
WTF? Yeah, this is commented out, but, still, WTF? GET RID OF CRAP THAT ISN'T BEING USED!
There is a menu item, under Tool, called Auto Format. Learn to use it! Do not post such crappy looking code again.
"It doesn't work" is just too lame. The code does something. You expect it to do something. The only thing we know at this point is that what it does is not what you want. All I can suggest is that you fix the code so it does what you want. No clue how to do that since I don't know what ti does or what you want it to do.
Thank you very much Pauls, ur words were really inspiring
I figured out the problems in the logic, now the code is working fine.