Continuing with the Proportional algorithm for following lines. Smooth and stable this is the first part of the PID.
- #176
- 01 Nov 2015
- 5:01
- LEGO MINDSTORMS, LEGO MINDSTORMS EV3
- FIRST LEGO League, EV3-G, Advanced, EV3, Light and Color Sensor, FLL, Programming
Previous episodes:
English
Previously we started implementing a program for following a line with a proportional algorithm and the program should work like this.
But in the last video we finished with a program that was doing something like this.
Obviously the program is not working and we should improve our proportional algorithm to follow the line very smoothly.
The problem is in the program and the way we calculate the values for motorR (motor Right) and for motorL (motor Left). What we are doing is the following. We subtract 40 and we get the value of motorR and we subtract from 40 and we get for motorL. As you saw the robot should move on the edge between the white and the black and for this let's imagine what will happen. For motorL and motorR. For motorR we'll constantly have the following value 70-40 and it will be equal to 30
and for motorL the value will be constantly 40-70
equal to -30 and this is the case for when we are over white. Let's zoom a little more. When we are over white this will be the values for the 2 motors and this will make a very sharp turn, the whole robot. Then when we are over black, let's say that the value actually 15 and 40-15 will be 25 and this will be for motorL and for motorR we'll have 15-40 and this will be equal to -25 and this is a loop that continues forever and that's why you saw the whole robot just jiggling in one place and not moving forward. What we should add to our program is a constant speed and we want this constant speed to be 15 so we have a constant speed of 15 and then we add the proportion to this constant speed. Let's do this in the program. I'll have to change the blocks. First I'll change this block to make it an advanced block and the formula for it will be а (the value detected by the sensor) (a-40) +15 and and for motorL we'll have the same formula but it will be (40-a)+15.
Let's run the program and see how it works.
As you can see the robot is now following the line. Finding and then following the line and again, I'll start it from a larger angle.
So we basically have a working program. In the next video we'll improve this program by adding a constant and this constant will direct how fast we find the line.
Currently it takes 2-3 seconds to find the line.
Of course, you can download the program below the video and the instructions to building this robot. In the next video we'll improve it to make it find the line faster.
Курсове и занятия включващи този Урок
Този Урок е използван в следните курсове и занятия.
FIRST LEGO League Competition. Constructing and Programming a Robot Base
This course if used by teams, mentors and students to structure the preparation for the Robotics Game of the FIRST LEGO League Robotics Competitions. One thing that is common each year at FLL is that experience matters a lot. Our goal with this course is to quickly bring new teams up to speed with experienced teams and to share some new tricks, patterns, constructions with the more experienced teams.
- 42
- 249:53
- 10
Faster and more precise line following
The next very good way on following line is to use a Proportional, Integral, Differential algorithm. Now, this could get quite complex so we have sciped the Integral and Differential Part from the next few videos and we have implemented only the Proportional. A very good line following that should do the job for nearly any competition.
- 4
- 1
- 0
- 3d_rotation 0