The determination relays on the convergence of the loop:
To determine location we have to do a 360° scan in the same orientation as during the data collect. We use the compass to set the robot in this requested orientation.
Do the scan and submit the result to the AI and get in return the most likely locations sorted by probability [(X1,Y1,p1),(X2,Y2,p2)…]. Apply these probabilties to the particles.
Make the hypothesys the robot is at the particle location with the highest probability (X,Y, heading).
Choose a direction and a distance to move the robot. Compute the new theoritical position based on the hypothesys, find the closest learnt location and get the corresponding compass orientation (NO)
Move the robot and the particles, align the robot with NO and restart the process and estimate the new position
After a few moves if new theoritical positions and new estimated position are consistent we found the actual location.