Stuck on programming a part of a algorithm

Hi everyone, i am in need of some guidance.

I current have a robot similar to a micro mouse. However I am using it to do unknown area mapping with a 1 for wall and 0 for space.

Currently i have used a modified left hand algorithm for the search function.

The robot has 3 sensors. front left and right.

It will first scan the 3 directions and follow a sequence.

The sequence is:

  1. check left if there is no wall or not visited before it will turn left and scan again.

  2. else if it will check front if there is no wall or not visited before it will move straight and scan again.

3.else if it will check right if there is no wall or not visited before it will turn right and scan again.

4.if all sides are covered by wall it will do a U turn

5.else if there are walls and it is backtracking, it will travel to an area where there is still room for mapping.

I am currently stuck at the 5th part of the program. I have no idea how to get my robot there and need help.

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.

I have initialized an empty array say MAP[5][5]

So, you assume certain characteristics of the maze. Hmmm.

And have determined the robot coordinates at the start is on MAP[1][1];

What is at MAP[0][0]? Does MAP[n][m] mean a cell or a wall or opening? What possible values can be in MAP[n][m]?

The map is determined that the outter rim is fully walled.

So, there are no entry points or exit points. Hmmm.

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

bump. urgent help pls.

crystalyst:
bump. urgent help pls.

If you have additional useful information to add then, by all means, do so.

"Bump" is neither useful nor information. Do not do that again.

Do not cross-post. Other thread removed.

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.