Bayes rule - practical application for IR distance sensor and ocupancy grid building

Hi,

I have a robot using IR and Sonar sensors for measuring distances. I build an occupancy map/grid. So far I use a simple integer based system to "calculate" the probability of a cell being occupied. Something like +1 if sensor hit and -1 for all calls between 0 and sensor reading-1. If the number in the array for one cell if above the threshold the cell is counted as occupied and via versa for unoccupied. All between in uncertain. (a bit more complex but based on this idea)

I now wonder if it is worth to use a Bayes theorem based solution for this (first code snip below). As most people do it this way the answer is most likely yes :-).

What do p1 and p2 mean in this specific example - let's say for an IR distance sensor? I understand the examples when the theorem is explained. But somehow I can't translate them to the IR sensor situation. (my mind got a bit stuck here) I have no clue what and how to estimate the values I should put in there and how to apply them to my array/map.

Would be nice if someone could enlighten me :-) If somehow possible with some pseudo code.

Thanks Robert


Bayes functions -- but how to apply?

def pos(p0, p1, p2):
    return (p0 * p1)/(p0 * p1 + (1-p0) * (1-p2))
def neg(p0, p1, p2):
return (p0 (1-p1))/(p0 (1-p1) + (1-p0) * p2)

occupancy grid

It’s about occupancy grid mapping:

http://en.wikipedia.org/wiki/Occupancy_grid_mapping

The goal is to estimate the probability of a cell on a grid map beeing occupied.

My question is if there is a way using Bayes rule which is better than my pure weighted hit counting.