Book Image

Learning Lego Mindstorms EV3

By : Gary Garber
Book Image

Learning Lego Mindstorms EV3

By: Gary Garber

Overview of this book

Table of Contents (19 chapters)
Learning LEGO MINDSTORMS EV3
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
10
Other Programming Languages
Index

Analyzing gain constants


In the previous chapter, we discussed proportional and PID control algorithms. When it was time to determine the best gain, derivative, and integral constants, we largely left things up to trial and error. Patient use of data logging would allow us to quantitatively analyze the quality of various values of these constants. This would be particularly useful in line tracking as we can graph the error function and corrections as a function of time, and compare this to the location along the line being tracked (and the degree of curvature at that point).

In the following program, we are going to analyze the performance of a simple proportional line tracker similar to the one we used in Chapter 8, Advanced Programming and Control. After resetting the motor rotation sensors, we use a Data Logging block to record values from the Color Sensor and the Motor Rotation sensors. We are recording the Reflected Light Intensity of the Color Sensor, which is plugged into port 3. Instead...