ece4160

Lab 7: Kalman Filter

Estimating Drag and Momentum

I used a step size of 50, which was slightly higher than the PWM value of 40 I used in lab 6.

I found that the steady state speed was roughly 1318 mm/s and that the 90% rise time was 1.353 seconds.

Unknown-28

Unknown-27

Unknown-26

Using the equations given in lecture, I found that d = 0.00077 and m = 0.00045.

Screen Shot 2023-04-01 at 12 58 17 PM

I used u=1 in my calculation of d.

Screen Shot 2023-04-01 at 12 58 31 PM Screen Shot 2023-04-01 at 12 58 43 PM

Initializing KF

In Jupyter Lab, I initialized my A, B, C, process noise, and sensor noise covariance matrices, as well as my state vector. I used the ballpack variance values given in lecture, as I found them to work very well for my system.

The time required for each TOF sensor sample was 0.51 seconds.

Implementing and Testing Kalman Filter in Jupyter Lab

I implemented my Kalman Filter in Jupyter lab and tested it on data from a straight run towards a wall.

Unknown-29

The Kalman filter was pretty close to the actual data after the first couple of seconds, taking some time to match up to the actual values. In this plot, it looks like it took a significant amount of time, but that was because the total run was less than five seconds. Changing the values of the covariance matrices did not show a significant improvement.

4A: Extrapolation

I used the following function to extrapolate every third distance data point based on the previous two TOF sensor readings. I called this function every time two TOF sensor readings had been taken.

A video of a trial with the extrapolated data points is below. I found that the car would reach roughly the correct distance from the wall, but would then oscillate excessively before stopping, even when the TOF and extrapolated distance data showed that the target distance had been reached quickly. After filming this video, I found that I needed to call the function to stop the motors outside of the PID control function to fix the oscillation issue.

Trial

The extrapolated data was somewhat close to the actual data, but it did not predict that the robot would reach the target distance before it did.

Unknown-30