3 * Evaluation of the position.
5 * check the distance of predicted and measured states and evaluate
8 * @param mcl the MCL model
9 * @param data measured data (x, y, turning)
11 void mcl_laser_pos(struct mcl_model *mcl, void *data)
13 struct mcl_particle *parts = (struct mcl_particle *)mcl->parts;
14 double xdiff, ydiff, dist, avdist=0;
16 double x = ((double *)data)[0];
17 double y = ((double *)data)[1];
18 /*double angle = ((double *)data)[2];*/
20 /* evaluate the weights of each particle */
21 for (i=0; i<mcl->count; i++) {
22 xdiff = parts[i].x - x;
23 ydiff = parts[i].y - y;
24 dist = fabs(sqrt(xdiff*xdiff + ydiff*ydiff));
27 /* evaluate weights with gaussian probability density */
28 parts[i].weight *= evaluate_gaussian(dist, mcl->eval_sigma);
31 /* adjust the evaluation values */
33 if (avdist > mcl->maxavdist) {
34 if (mcl->noisecycle > mcl->maxnoisecycle) {
35 mcl->flag = MCL_RESET;