# Sensor model and Inverse sensor model using occupancy grid mapping with lidar for particle filter

I'm a bit confused about how one goes about calculating the sensor model $$p(z_t|x_t, m)$$ and inverse sensor model for position $$p(x_t |z_t,m_{t-1})$$.

From this answer, it seems like one way for calculating the inverse sensor model would be to compare the current lidar scan with the raycasted lidar scan, and then comparing them by using ICP for example.

For the sensor model $$p(z_t|x_t, m)$$, I've just been taking a product of the probabilities from the map, but I know that this is an incorrect method.

What are the standard ways of computing $$p(z_t|x_t, m)$$ and $$p(x_t|z_t, m_{t-1})$$ when using a lidar with an occupancy grid for a particle filter?