The occupancy field is a grid that represents the known state of the world. It contains the distance between each point and the nearest known obstacle. This allows the Neato to plan around obstacles by comparing waypoints and positions to their corresponding distance-to-obstacle values. When this distance is below a certain threshold, this implies a high probability of collision with an obstacle.
The build process starts with the obstacle points being read from the ROS network and the merging of the LIDAR and visual points. Then, these locations are saved into a matrix. A k-nearest-neighbors clustering is run on the entirety of the map to extract the closest obstacle to any given point. As can be seen in the first image, yellow points are the LIDAR scan and the darker regions represent farther distances from obstacles. In the second image, the distances are thresholded to highlight no-go zones around obstacles.
The occupancy field currently updates every second. This is an increment that can be tuned, but for performance reasons, lowering it farther may not be desirable since re-builds can trigger repathings, which are time-intensive. Especially with real-world testing, scans are so variable that it is hard to heuristically determine whether a frontier has changed enough to merit re-building. An algorithm that compares old to new scans weighing highly the frontier in front of the robot could perhaps achieve this type of heuristic. One possible drawback is that in real-world testing it has been shown that the odom frame of the robot is unreliable at best due to slippage on all surfaces, so unless a SLAM type of localization is implemented, it might be hard to truly isolate the changes in the frontier from the noise. We also realize that our rates are limited by the speed at which the vision pipeline can run and the speed of the robot. Since the vision pipeline takes on the order of 0.5 - 1 seconds to complete, re-building does not have to be faster and benefits would likely not be realized. One final idea would be to link re-builds to updates from the vision pipeline or a specific amount of time, whichever comes later. These types of optimizations were not the focus of our project due to the existent complexities to overcome.