A modification to the robot was made to improve the observation loop from lab 10, as it was slow and produced a high pitched whine when the motors were driven too weak to spin. There's a link to a video of the old observation loop below.
The modiciations were simple, with the robot's wheels being taped over to reduce friction, and the PID tuning being retuned to adjust for the easier motion of the wheels. The deadzone of the wheels was also reduced, or the range within the setpoint that the robot will take a measurment and start a new turn after being within it for a period of time. The direction of the motion was also reversed to be compatible with the localization script. The hugely improved observation loop is shown below.
No other modiciations were made from the lab 10 mapping code on the board, as it did exactly what I needed to: send a requested number of sensor measurements over Bluetooth.
A Jupyter Lab notebook was provided to pass the robot's observation data through the Bayes filter. The code simply ran an observation loop on the robot, waited to receive the data over Bluetooth, and passed it through the Bayes filter that was described in lab 11 to predict where the robot is on the map. The observation loop was implemented in the way shown below.
I then ran the observation and update step at the marked points on the setup in the lab room. Below is a video showing the four runs.
The outputs of the Bayes are in the following table. The predictions were pretty close to the true state.
GT Coords | GT Pos. (mm) | GT Angle | Pred. Coords | Pred. Pos. (mm) | Pred. Angle |
---|---|---|---|---|---|
(2,2) | -914, 610 | 0° | (2,2,9) | -914, -610 | 10° |
(10,1) | -1524, -914 | 0° | (10,1,9) | -1524, -914 | 10° |
(5,9) | 0, 914 | 0° | (6,8,8) | 305, -1219 | -10° |
(10,7) | 1524, 914 | 0° | (11,7,8) | 1829, 914 | -10° |
The filter's performance was limited by the fact that angular measurements are predicted in increments starting from 10°, while the sensor readings from the robot start at 0°. This did have a significant impact on the results, however, as the predicted angles were still as close as possible to the ground theory (GT), which was 0° for all update steps. This slight difference in angle, along with the fact that distance sensor uncertainty was higher than angular uncertainty, may have led to the flight differences in positions for the latter two trials. The update step of the algorithm, however, proves to be an effective way of estimating the robot's location.
You've really localized the end of the report!