0% found this document useful (0 votes)
4 views9 pages

Proportional Line Follower

This document provides a lesson on creating a proportional line follower robot using light sensor readings to calculate error and make corrections. It outlines the steps for computing error, scaling it for correction, and tuning the proportional constant for optimal performance. The lesson is designed for users of SPIKE Prime and includes practical tips for implementation.

Uploaded by

Lukácsné Gabi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views9 pages

Proportional Line Follower

This document provides a lesson on creating a proportional line follower robot using light sensor readings to calculate error and make corrections. It outlines the steps for computing error, scaling it for correction, and tuning the proportional constant for optimal performance. The lesson is designed for users of SPIKE Prime and includes practical tips for implementation.

Uploaded by

Lukácsné Gabi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

PRIME LESSONS

By the Makers of EV3Lessons

PROPORTIONAL LINE FOLLOWER


BY SANJAY AND ARVIND SESHAN
LESSON OBJECTIVES

¢ Learn to create a proportional line follower


¢ Learn how to calculate error and correction
¢ Learn how to use variables and math blocks

© 2020 FLLTutorials, Last edit 05/25/2020 2


HOW FAR IS THE ROBOT FROM THE LINE?

¢ 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)

Light Sensor Measured Area:


Reading = 100
Reading = 50 Reading = 25 Reading = 75
Reading = 0

Line

© 2020 FLLTutorials, Last edit 05/25/2020 3


LINE FOLLOWING

¢ Computing an error à how far is the robot from a target


¢ Robots follow the edge of line à target should be a sensor reading of 50
¢ Error should indicate how far the sensor’s value is from a reading of 50

¢ 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

© 2020 FLLTutorials, Last edit 05/25/2020 4


HOW DO YOU MAKE A PROPORTIONAL LINE FOLLOWER?

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.

© 2020 FLLTutorials, Last edit 05/25/2020 5


CHALLENGE

Compute Error error

Distance from line =


(Light sensor reading - Target Reading)

Compute Correction

Scale the error to determine a correction amount.


Use this to adjust power input on move block.

Apply Correction

Use the correction and a base power to control


each motor.

© 2020 FLLTutorials, Last edit 05/25/2020 6


PROPORTIONAL LINE FOLLOWER

Part 1: Compute the Error


Our goal is to stay at the edge of
the line (light sensor = 50)
Part 2: Apply the correction
The error in part 1 is multiplied
by a Constant of Proportionality
(0.3). This will be different for each
robot/application. See slide 8 to
learn how to tune this number.

© 2020 FLLTutorials, Last edit 05/25/2020 7


KEY STEP: TUNING THE CONSTANT

¢ 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

© 2020 FLLTutorials, Last edit 05/25/2020 8


CREDITS

¢ This lesson was created by Sanjay Seshan and Arvind Seshan for SPIKE Prime Lessons
¢ More lessons are available at www.primelessons.org

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International


License.
© 2020 FLLTutorials, Last edit 05/25/2020 9

You might also like