PID Line Follower for EV3 (Part 2) - K Values and How to Improve Performance
HTML-код
- Опубликовано: 17 авг 2024
- The PID line follower is the ultimate EV3 line following program. It is mathematically complex, but it can compensate for a lot of errors and keep your robot right on track. It is a popular line follower to use in FLL or WRO. Previously, I taught you how to program a PID line follower. Today, I will demonstrate the line follower in action with my robot, Sirius, provide some sample K values you can try with your own EV3 robot, and discuss ways to make it more accurate and reliable. I will also discuss the practicality of using a PID line follower in an FLL or WRO competition.
My Patreon supporters for more than $5 for the month of August were: Stephen Rozmiarek and Turnabout Akamia. Thank you very much!
My supporters on Patreon contribute additional funding that allow me to build up and improve this channel and to make more videos. If you would like to help, you can support me here: / builderdude35
Special thanks to my friend Preston Nichols for designing Builderdude35's awesome new introduction and logo!
My Website: builderdude35.com/
Builderdude35 RUclips: / @builderdude35
EV3 PID Line Follower: • PID Line Follower for ... Наука
For the people who have their robot spinning in circles when any Ki value is used the fix is to put another write integral variable set to 0 in the loop, It only works if the variable is at the start of the loop or the end. The reason that this fixes it is the integral is getting higher and higher as the program runs and makes the robot go in circles
I hope this allows the program to use Ki. :)
Does work it fixes the problem and makes it even better Thanks
The problem is, this effectively removes the integral term; it's just the same as if you had just set the Ki to zero. Then, what you really have is just a PD line follower.
@@Builderdude35 ok well it makes a difference for me and Ki at least does some thing beside making the robot spin in circles, you should try it
Very professional by a teenager: congratulations!
I would suggest testing and showing the performance of your line follower in different situations. Straight, wide curves and sharp curves, also curves in multiple directions.
Thanks for the suggestion! I will make an expanded demonstration video when I get the chance.
Have you made it yet, I can't find a video were it did turns?@@Builderdude35
@@vivangupta4928 Not yet. Stay tuned.
The kD of my WRO-Robot is a lot higher than the kP and it works perfect. I didn't use the kI.
put your error values in an array with the index going from 1 to 50 and then starting at 1 again and on and on. Then sum the array for your integral value. Experiment with the number of elements of the array. This gives it a memory for errors recently but not for ever. This is kind of a reset term to clear the integral out of old obsolete data. The number of elements is dependent on how many samples you get from the loop and the ground speed of the robot. You can make it beep every time the array index hits 0 again and then when following the line its memory is the length of travel between beeps... Turn this beep off after you are happy.
Greetings from Philippines!
Your videos are awesome it helps our team to prepare for the upcoming competition! Thanks a lot Dude! You always impress me. I am looking forward to see more awesome tutorial videos! I am very curious about your talents and skills, are stuffs about Arduino's beyond your boundaries? Thank you very much!
Thanks for taking the time to share some feedback! I have done several projects outside of MINDSTORMS; I have done a few projects with the Raspberry Pi; you can find these videos on my channel. I also just recently made a MIDI controller for my friend, which used an Arduino Leonardo; I don't have a video for it yet.
Please add a video for a 2 sensor PID line follower
It's coming soon!
Is this the same concept for a gyro sensor PID program too?
yes
How can you do a P or PID control with medium motors, Any recommendations you can give me?
how do i a stop term? i mean how do i make my robot stop after a N' of cm? (i know how to drive by cm but i dont know how to stop the PID)
Ok. Here's why the integral doesn't work here. This is a highly non-linear control feedback system. Feedback is quasi linear only in a small zone where the sensor can see the edge. Once it drifts off the edge, it has no clue how far away from the edge you are. The error only works up to a point. This makes error cancellation impossible. If you had a gradient gray, you could make use of the integral term.
Thank you for sharing! I think you may be on to something. Maybe this is a possible tutorial topic for the future!
If you do, I'd be interested to contribute. The integral term probably needs a simple high pass filter to "strip off" the long term DC component of the integral anyway. From a control perspective, the integral is probably only relevant for the prior few seconds or so, not from the beginning of time. Even a grayscale line method will likely build up a long term error component due to system tolerance and quantization errors, et. al.
I'm a volunteer robotics instructor in Detroit Public Schools for a few years now, and an Electrical Engineer with about 35 year's experience. Thank you for your videos; they are some of the best EV3 videos out there.
Rob Jones hi can you explain why the integral part doesnt work and what changes to the program would make it work?
Hey builderdude35, my robot can not get the curves and turnes I think you need to make another video and add some extra code blocks for turns and curves.
Hey Dude,
Bro i made this program working perfectly but i wanted to know how to make a program that can tackle gaps in the line or if the PID can tackle this
can you pls tell me how
Conveniently enough, I already have a video on the topic: ruclips.net/video/LXdm6-Gl0WE/видео.html This will teach you how to go over intersections, but the procedure is the same with a gap; the robot will ignore the empty space and resume when the line is reacquired. This works with every type of line follower.
thnx
If we change the colour sensor block to a gyro block and fine tune the K values will it work as a gyro PID?
Absolutely! The principles behind gyro following and line (color sensor) following are the same, so you can definitely adapt the code for PID gyro.
my program will not turn right now. It does a complete 180 when it approaches a 90 degree right turn. How do I fix it
I'm not sure. Maybe give the K values a little more fiddling. If that doesn't work, try a different line follower (like 3-sensor) that is easier to adjust.
How can I programm my robot to follow the other side of the black line?
Simply negate the k values (kp, ki, kd). See my first PID line following video.
Can the PID Line follower do turns??? I am getting very annoyed at this point
PID can certainly do turns. That is generally facilitated by the Kp for gentle turns, and the Ki for very sharp turns.
I have a couple questions for anyone who can answer them. 1. My robot just turns in circles, how do I fix that? 2. Does this program work with curves and turns?
Yes, the program definitely works on all types of curves. If your robot is driving in circles, your robot is either 1) not seeing the line and the color sensor target needs to be adjusted or 2) your k values need adjusting.
Builderdude35 Thank you very much! That was very helpful.
I've tried everything I could and it doesn't work. However, I am using gears on my robot. Does that affect the performance?
The gears will make the robot's driving more sensitive and possibly harder to adjust as a result. It is mostly in those K values. Keep trying!
how do you know all this?
It's simple... I'm a wizard! ;)
"Integral" and "Derivative" --> Having fun with "Applied Mathematics" ! :)
Yes indeed! You can do some awesome things with calculus!
My line follower just turns in circles
Mine was a port mistake
LOL
why always ur vid