Just saying if you think i am waiting for the full program answer, I am not. I have my program it just needs some twitting to make the last sequence work. And i have not found the solution therefore i am enquiring for some guidance. Please do not hesitate to ask me question if you have any unknowns as i need to finish this asap.
5.else if there are walls and it is backtracking, it will travel to an area where there is still room for mapping.
This implies that you know that the robot is backtracking. This implies that you know that where you are has already been searched. This implies that you know where you are. How do you know where you are?
PaulS:
This implies that you know that the robot is backtracking. This implies that you know that where you are has already been searched. This implies that you know where you are. How do you know where you are?
I have initialized an empty array say MAP[5][5]
And have determined the robot coordinates at the start is on MAP[1][1]; and from there it will scan the surroundings and start mapping.
I also have an array shifter function to move the entire array either on the x axis or y axis.
The map is determined that the outter rim is fully walled.
Yes however, on bigger unknown maps.. i will encounter a combination of walls and backtrack leaving the robot stuck at that point. And this usually happens when the map is still partially mapped out so i have problem getting it over to the other nearest point on the unknown map. I do have the A* path finder program code. now the thing is to search for the closest unmapped area first. which is normally those left behind by the right sensor as the robot tends to turn left and move straight
Hi guys. Sorry if the information wasn't enough. However i have found my solution. I will put it together in this reply.
Thank you for those who bothered to reply, help, thought about it and viewed it. I sincerely thank you for your time.
As there is predetermined array, there is a limit.
And since the robot's location is known and updated i can use it.
Thus i apply the ring search which spreads out in all direction to search for the area. (sorry if the term ring search is wrong)
This is one of the simplier search pattern to implement though not the most efficient as it repeatedly checks over the same areas.
int x = -1, y = -1;
while ( unmapped area not found){
for(int Xcoord = x; Xcoord<= abs(x); Xcoord++){
for(int Ycoord = y; Ycoord<= abs(y); Ycoord++){
robotXpos += Xcoord;
robotYpos += Ycoord;
if(MAP[robotXpos][robotYpos]!=0)
continue;
else {
umapped area found
move to MAP[Xcoord][Ycoord];
}
}
}
x-=1;
y-=1;
Just a question to anyone reading. Would it be wise to actually start from the outter rim instead from the robot directly?
Though i say that it has to be the closest unmapped aread to the robot. However with the left hand search algorithm and being stuck. It can be assumed that the surrounding have mostly been explored instead of those much further away.