The integral part "remembers" the errors that the robot has made in the past and we can compensate for those errors. This will make the robot return back to the line that we would like to keep it aligned.
- 10 Jan 2018
Every 0.01 seconds we get the value of the Gyro sensor and constantly add it to the Integral Part. If the absolute value of the Integral part is increasing with time this means we are moving away from the line. If the absolute value of the Integral part is decreasing, we are moving toward the line. If the value of the Integral part is 0, it means the gyro sensor is detecting a value of 0 and the robot is moving straight.
Data logging the Integral part
We could display the value of the Integral part constantly on the screen, but it is much better if we just logged it into a file. Than we could examine the file, plot the data, and we would have an understanding of how the integral part changes over time.
This is an EV3-G project that contains two programs implementing an Integral compensation - integral part of the PID algorithm. The first program is for a Five Minute Bot and the second program is for Box Robot. The things that you should be careful when using the program for your robot are the direction of the motors in the steering block; whether the motors in the steering block are written as "B+C" or "C+B" and the coefficients in the two math blocks. The coefficients that we've chosen should work for most of the robots, but will probably not work for some of them. If they don't work, write to us, comment below in the comment section or drop us an email.
The program that we are about to implement includes some integral part. And the idea is very simple. The integral part remembers the errors that the robot has made while moving forward or while trying to move forward. And then we try to compensate for these errors so we are trying to return the robot back to the line not only to keep it straight but also probably make an error in the opposite direction and return the robot back to the line.
As you saw from the recordings as we move away from the line we try to return back to the line. And this is the integral part and it makes the robot move or keep the straight line in a much better way. And in the next few videos of the course we'll discuss how exactly we are implementing this program. But I hope that you get the general idea that you move away from the line, you remember how much you moved and you try to return back to the line without crossing it.
Courses and lessons with this Tutorial
This Tutorial is used in the following courses and lessons