Ops Manager Extension: PD Controller

1. Replace position_val() with distance_from_line()

The position_val() function returns integer values only. Putting all black (20) and all white (30) values aside, there are 11 different values that this function can return to represent the position of the line (0-10). This limits you to 11 steering levels in your response.

We have provided you with a template function in the notebook called distance_from_line(). This uses the line follower’s read() function to return a higher precision range of values for line position. This allows you to build a finer-grained response into your proportional controller (more steering levels) to make it more accurate at keeping the line centered.

Read the notes provided in the notebook alongside this template function to understand the range and meaning of values that it can return and make use of this function in your proportional controller code instead of the position_val() function.

Experiment with your new controller code to see if you can improve on your best time.