Don't ad-block us - support your favorite websites. We have safe, unobstrusive, robotics related ads that you actually want to see - see here for more.
0 Members and 1 Guest are viewing this topic.
Starting WavefrontOld Map:0 W 0 0 0 W0 W 0 0 0 00 W 0 0 W 00 W 0 0 0 00 5 4 3 2 00 0 0 0 0 0Starting UnpropagateUnpropagation Complete:0 W 0 0 0 W0 W 0 0 0 00 W 0 0 W 00 W 0 0 0 00 0 R 0 0 00 0 0 0 0 0Adding Goal:0 W 0 0 0 W0 W 0 0 0 00 W 0 G W 00 W 0 0 0 00 0 R 0 0 00 0 0 0 0 0Finished Wavefront:0 W 0 0 0 W0 W 0 0 0 00 W 2 G W 00 W 3 0 0 00 0 R 0 0 00 0 0 0 0 0
Starting WavefrontOld Map:0 W 0 0 0 W0 W 0 0 0 00 W 0 0 W 00 W 0 0 0 00 5 4 3 2 00 0 0 0 0 0Starting UnpropagateUnpropagation Complete:0 W 0 0 0 W0 W R 0 0 00 W 0 0 W 00 W 0 0 0 00 0 0 0 0 00 0 0 0 0 0Adding Goal:0 W 0 0 0 W0 W R 0 0 00 W 0 G W 00 W 0 0 0 00 0 0 0 0 00 0 0 0 0 0Sweep #: 00 W 0 0 0 W0 W R 2 3 45 W 2 G W 56 W 3 2 3 45 0 4 3 4 56 0 5 4 5 6Finished Wavefront:0 W 0 0 0 W6 W R 2 3 47 W 2 G W 56 W 3 2 3 47 5 4 3 4 58 6 5 4 5 6
Starting WavefrontOld Map:0 W 0 0 0 W0 W 0 0 0 00 W 0 0 W 00 W 0 0 0 00 5 4 3 2 00 0 0 0 0 0Starting UnpropagateUnpropagation Complete:0 W 0 0 0 W0 W R 0 0 00 W 0 0 W 00 W 0 0 0 00 0 0 0 0 00 0 0 0 0 0Adding Goal:0 W 0 0 0 W0 W R 0 0 00 W 0 0 W 00 W 0 G 0 00 0 0 0 0 00 0 0 0 0 0Sweep #: 00 W 0 0 0 W0 W R 0 0 00 W 0 2 W 00 W 2 G 2 34 0 3 2 3 45 0 4 3 4 5Sweep #: 10 W 0 0 0 W0 W R 3 4 56 W 3 2 W 45 W 2 G 2 34 4 3 2 3 45 5 4 3 4 5Finished Wavefront:0 W 0 0 0 W7 W R 3 4 56 W 3 2 W 45 W 2 G 2 35 4 3 2 3 46 5 4 3 4 5Go DOWN
int map[6][6]= {{0,255,0,0,0,255}, {0,255,0,0,0,0}, {0,255,0,0,255,0}, {0,255,0,0,0,0}, {0,5,4,3,2,0}, {0,0,0,0,0,0}};int main(void) { //declare robot location and start propagation min_node_location=propagate_wavefront(1,2); }int propagate_wavefront(int robot_x, int robot_y){//clear old wavefrontunpropagate(robot_x, robot_y);//start location to begin scan at goal locationmap[3][3]=goal;while(counter<20)//allows for recycling until robot is found { x=0; y=0; while(x<6 || y<6)//while the map hasnt been fully scanned { //if this location is a wall or the goal, just ignore it if (map[x][y] != wall && map[x][y] != goal) { //a full trail to the robot has been located, finished! if (min_surrounding_node_value(x, y) < reset_min && map[x][y]==robot) { printf("Finished Wavefront:\n"); print_map(); //tell robot to start moving down path return min_node_location; } //record a value in to this node else if (minimum_node!=reset_min)//if this isnt here, 'nothing' will go in the location map[x][y]=minimum_node+1; } //go to next node and/or row x++; if (x==6 && y!=6) { y++; x=0; } } printf("Sweep #: %d\n",counter); print_map(); counter++; } return 0;}//this function looks at a node and returns the lowest value around that nodeint min_surrounding_node_value(int x, int y) { minimum_node=reset_min;//reset minimum //right if(x < 5)//not out of boundary if (map[x+1][y] < minimum_node && map[x+1][y] != nothing) { minimum_node = map[x+1][y]; min_node_location=1; } //left if(x > 0) if (map[x-1][y] < minimum_node && map[x-1][y] != nothing) { minimum_node = map[x-1][y]; min_node_location=2; } //top if(y < 5) if (map[x][y+1] < minimum_node && map[x][y+1] != nothing) { minimum_node = map[x][y+1]; min_node_location=3; } //bottom if(y > 0) if (map[x][y-1] < minimum_node && map[x][y-1] != nothing) { minimum_node = map[x][y-1]; min_node_location=4; } return minimum_node; }
//go to next node and/or rowx++;if (x==6 && y!=6) { y++; x=0; }
//go to next node and/or rowy++;if (y==6 && x!=6) { x++; y=0; }
strange that you are not getting the same symptoms now you have changed the scan order.what about if the goal is above the robot on the map?
I can give you all the code to play around with the map if you want . . .
You wrote "while (x != 6 || y != 6)". || stands for logical OR. You probably need to replace it with && which is AND.
heh. i feel your pain.i was faced with a similar problem a few months ago with my inter ic network protocol.it turned out to be a buffer overflowing in a certain set of conditions.perfectly obvious one i had worked out what was going on but brain melting trying to spot where it was happening in the first place.
heh, i'll be too busy with my own mapping algorithm soon.
map[y][x] = 5;
map[x][y] = 5;
How do you create the grid? I can see how it could be easily created from a camera above, but how is it done with a IR sensor mounted so low?
How do you give it a destination to go to? Is it instructed to simply go 5 units straight ahead or is there something more behind it?
Does it stop to scan or to calculate?
can the robot move outside the 6x6 matrix?
I assume you dont use C
so you dont have direct access to the fast vector structure for example
a what what? its all done on a microcontroller, so I'm limited on fanciness . . .
Have you tried to make it work in larger environment?
Is matrix manipulation very costly to do?
Trig on a Micro isn't that bad as long as you use piece wise linear interpolation.
Use a dynamic array (a vector).. build a compass into your robot and let it run around the house, dynamicly resizing the array
Here is a question . . . so when the robot cannot find a clear path I have it delete its entire map to start over. This works really well for small maps. But for large maps this is bad because travel/scan time is expensive . . . anyone can think of an intelligent way to rescan previously blocked areas efficiently? A scan takes between .3 and 2 seconds . . . I can think of a few ideas but they all have flaws . . .