After some tests, we concluded that the threshold used to determine whether or not we are at the edge of the mars platform should not be static. We implemented a dynamic threshold that updates every time we know we are in the table and the results are as desired. Here is the video: