Proportional Line Follower
Proportional Line Follower
¢ Reflected light sensor readings show how “dark” the measured area is on average
¢ Calibrated readings should range from 100 (on just white) to 0 (on just black)
Line
¢ Making a correction à make the robot take an action that is proportional to the error.
You must multiply the error by a scaling factor to determine the correction.
¢ To follow a line a robot must turn towards the edge of the line
¢ The robot must turn more sharply if it is far from a line
¢ How do you do this: You must adjust steering input on move block
Pseudocode:
1. Compute the error = Distance from line = (Light sensor reading - Target Reading)
2. Scale the error to determine a correction amount. Adjust your scaling factor to
make you robot follow the line more smoothly.
3. Use the Correction value (computed in Step 2) to adjust the robot’s turn towards
the line.
Compute Correction
Apply Correction
¢ Note, the 0.3 constant in the previous slide is specific to our robot – you
need to tune this value for yourself
¢ This constant is called the Proportional Constant, or Constant of
Proportionality
¢ The most common way to tune your constant is trial and error.
¢ This can take time. Here are some tips:
¢ Start with your constant as1.0 adjust by ±0.5 initially
¢ Adjust to a point where the controller is pretty smooth
¢ Adjust ±0.1 for fine tuning
¢ This lesson was created by Sanjay Seshan and Arvind Seshan for SPIKE Prime Lessons
¢ More lessons are available at www.primelessons.org