2
$\begingroup$

I am trying to calculate likelihood of laser scan($Z$) at give pose($x$) with known map ($m$) using beam based model

$P\left(z_t|x_t,m \right)=\prod_{i=1}^{n}P'\left(z_i|x_t,m \right)$

My scan has 360 rays i.e $n=360$, When i calculate $P\left(z_t|x_t,m \right)$ it becomes zero as multiplication all propabilities $<1.$

In ROS amcl they are using ad-hoc which works better like

$P\left(z_t|x_t,m \right)+=\sum_{i=1}^{n}P'\left(z_i|x_t,m \right)*P'\left(z_i|x_t,m \right)*P'\left(z_i|x_t,m \right)$

later they normalise it with number of particle to get weight of each particle.

My query is how to get probability normalised and not zero with single calculation (i.e image in case of single particle)

Thanks.

$\endgroup$
1
$\begingroup$

When you have to multiply so many (often low) probability values or in this case probability densities, you are bound to get in trouble because of limited floating-point accuracy. It is advisable to instead sum up their logarithms, since this will give you a more accurate result.

$\log p\left(z_t|x_t,m \right)=\sum_{i=1}^{n} \log p'\left(z_i|x_t,m \right)$

If you try to compute the probability $p\left(z_t|x_t,m \right)$ by exponentiating its logarithm above, you will most likely still get 0. But in a particle filter, you can arbitrarily scale the measurement model likelihoods (weights are later normalized anyway), which corresponds to adding the same constant to the logarithms above for each particle.

What amcl does is a dirty hack that seems to work well but has no probabilistic foundation as far as I can tell.

My query is how to get probability normalised and not zero with single calculation (i.e image in case of single particle)

Use logarithms as shown above, but check whether you really need the actual probability (density), since it will be dangerously close to 0.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.