# A Particle PHD Filter for Dynamic Grid Map Building towards Indoor Environment
## 3 The Proposed Framework for Building Dynamic Grid Map
### Particle Weights Update  
Using Equation (10) to update the particle weight is still difficult to operate. Here, we draw on the method of paper [23]. The weight of particles is updated in the unit of a grid cell. Suppose that \(\left\{x_{p,k+1|k^{\prime}}^{i,c}w_{p,k+1|k^{\prime}}^{i,c}\right\}_{i=1:N_{ p,k+1|k}^{c}}\) represents the predicted particle set of the grid cell \(c\) from time \(k\) to \(k+1\). Then, the PHD of the dynamic point object RFS in the grid cell \(c\) can be expressed as:  
\[D_{p,k+1|k}(x_{k+1})=\sum\limits_{i=1:N_{p,k+1|k}^{c}}w_{p,k+1|k}^{i,c}\delta (x_{k+1}-x_{p,k+1|k}^{i,c}). \tag{32}\]  
According to the definition of PHD, the integral of PHD on the grid cell \(c\) is equal to its occupation probability, which is  
\[D_{p,k+1|k}(x_{k+1})=\sum\limits_{i=1:N_{p,k+1|k}^{c}}w_{p,k+1|k}^{i,c}\delta (x_{k+1}-x_{p,k+1|k}^{i,c}). \tag{33}\]  
Since the occupancy probability of the grid cannot exceed one, the sum weights of the particle set of a grid cell needs to be reduced accordingly to make the sum of particle weights one or slightly smaller when the sum of particle weights exceeds one. Based on this, the predicted free mass value can be calculated:  
\[m_{p,k+1|k}^{c}(F_{k+1})=\min(\alpha(t)m_{k}^{c}(F_{k}),1-\sum\limits_{i=1:N_ {p,k+1|k}^{c}}w_{p,k+1|k}^{i,c}) \tag{34}\]  
where \(\alpha(t)\in[0,1]\) describes the decreasing prediction reliability related to the time interval. Assuming that at time \(k+1\), the grid cell \(c\) obtains the measured mass value \(m_{k+1}^{c}(O_{k+1})\) and \(m_{k+1}^{c}(F_{k+1})\) through laser scan. Then, we can use the Dempster-Shafer rule [32] to combine the predicted mass value and the measured mass value to get the updated mass value \(m_{k+1}^{c}(O_{k+1})\) and \(m_{k+1}^{c}(F_{k+1})\). Then, we can use the updated mass value of occupancy \(m_{k+1}^{c}(O_{k+1})\) to update the weight of the predicted particle set \(\left\{x_{p,k+1|k^{\prime}}^{i,c}w_{p,k+1|k}^{i,c}\right\}_{i=1:N_{p,k+1|k}^{ c}}\):  
\[w_{p,k+1}^{i,c}=\mu_{A}^{c}\widetilde{w}_{p,k+1|k}^{i,c} \tag{35}\]  
where \(\mu_{A}^{c}=\left(\sum\limits_{i=1:N_{p,k+1|k}^{c}}\widetilde{w}_{p,k+1|k}^{ i,c}\right)^{-1}m_{k+1}^{c}(O_{k+1})\). The state of the particles remains unchanged during the update process. After such processing, the sum of the particle weights of the grid cell \(c\) is equal to \(m_{k+1}^{c}(O_{k+1})\).  
In order to improve the tracking speed of the dynamic target, the newborn particles of the grid cell \(c\) are directly generated according to the measurements. Assuming that the measured occupancy probability of grid \(c\) is \(m^{c}_{z_{k+1}}(O_{k+1})\), then the number of new particles generated is \(N^{c}_{b,k+1}=M_{b}m^{c}_{z_{k+1}}(O_{k+1})\), and the sum of the weights of the particle set is \(P_{b}m^{c}_{z_{k+1}}(O_{k+1})\). When \(m^{c}_{z_{k+1}}(O_{k+1})\) is not zero, the weight of each particle is \(w^{i,c}_{b,k+1}=P_{b}/M_{b}\), and when it is zero, no particles are generated. Finally, the PHD of the dynamic point object RFS of grid \(c\) at time \(k+1\) can be expressed as:  
\[D_{k+1}(x_{k+1})=\sum_{i=1:N^{c}_{p,k+1}}w^{i,c}_{p,k+1}|\delta(x_{k+1}-x^{i,c }_{p,k+1|k})+\sum_{i=1:N^{c}_{b,k+1}}w^{i,c}_{b,k+1}|\delta(x_{k+1}-x^{i,c}_{p, k+1}). \tag{36}\]