Implementation Discussion
Unfortunately, I was unable to achieve accurate and reliable localization results using my ToF sensor data and the provided
localization program, which I documented in my Lab 11 writeup. Even though my polar plot of the ToF sensor readings looked like the robot's
surroundings, the localization algorithm would predict the wrong location the majority of the time. If I had more time, I would continue
to debug my localization since it is the most reliable way to complete Lab 12; however, I had to leave campus early, so I will not be using
localization in my map navigation, as it will likely provide innacurate results.
Instead, I will still try to be as accurate as possible with my navigation by using feedback control to detect the robot's current state
and determine its next move. My approach divides the map traversal into two parts: straight-line forward pathing and counterclockwise
rotation. At every waypoint, the robot rotates to a set angle using closed-loop feedback control. The decision to continue rotating or
stop depends on the input yaw value received from the robot's IMU. This method works well because the IMU performs very rapid data collection,
so the angle that the robot turns to is relatively precise and consistent. To travel from waypoint to waypoint, the robot is programmed
to move forward a certain distance by driving the motors for a predetermined period of time. This open-loop method for straight-line movement
is used because my robot's ToF sensors sometimes mistakenly detect things that are not there, causing it to output inaccurate measurements that
are much lower than they should be. Since the navigation task is quite long, I would need the ToF sensors to consistently output accurate
readings, so I decided to forego this method. In the end, I found that this combination of turning and moving forward worked sufficiently well
for my robot to navigate the map.