go_away

Author Topic: Bayes Rule / worth the calculation time and which values to use?  (Read 483 times)

0 Members and 1 Guest are viewing this topic.

Offline robvoiTopic starter

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 0
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 if not hit. (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 (see code below). As most people do it this way the answer is most likely yes :-).

What do p1 and p2 mean in this specific example - lets say for an IR 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.

Would be nice if someone could enlighten me  ;D

Thanks
Robert

Code: [Select]
p = 0.5
n = 0.5

def pos(p0, p1, p2): #p0=hidden variable probability; p1=sensitivity of test; p2=specitivity of test
    return (p0 * p1)/(p0 * p1 + (1-p0) * (1-p2))

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


for x in xrange(5):
    p = pos(p, 0.8, 0.9)
print p

for x in xrange(5):
    n = neg(n, 0.8, 0.9)
print n

Offline jwatte

  • Supreme Robot
  • *****
  • Posts: 1,343
  • Helpful? 81
Re: Bayes Rule / worth the calculation time and which values to use?
« Reply #1 on: January 30, 2014, 03:51:35 PM »

p0 is the occupancy value you're updating
p1 is the sensitivity -- if it's occupied, how likely are you to detect it?
p2 is the specificity -- if it's not occupied, how likely are you to read a "not occupied"?

Note that p2 is really high for cells between you and the echo, but the cells in the "arc" at the echo distance have a much lower p2, because any cell occupied at the distance of the echo could generate the echo, even if the most-straight-ahead cell is empty.

I'd use p1 of 0.8 or so, p2 of 0.8 for the cells "before" the echo distance, and perhaps 0.2 or 0.3 for the cells "at" the echo distance, as a first crude initial guess.

Offline robvoiTopic starter

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 0
Re: Bayes Rule / worth the calculation time and which values to use?
« Reply #2 on: January 31, 2014, 01:12:25 AM »
Thanks a lot for the answer. I'll give this a try!

 


Get Your Ad Here