EV3 Gyro Sensor + PID Algorithm = Extremely Accurate Drive Straight Program

  Рет қаралды 64,956

Builderdude35

Builderdude35

Күн бұрын

Пікірлер: 106
@robocodex
@robocodex 2 жыл бұрын
I love these tutorials and I had the idea to remake it for SPIKE Python. I translated it and it worked nicely
@YYK7
@YYK7 Жыл бұрын
Ask ChatGPT about it 😉😂
@AlexSnopow
@AlexSnopow 5 жыл бұрын
Thank you from Russia! Thanks to your explanation in the video, I was able to use a similar algorithm for the light sensor!)) I like what you do! it’s a pity that nobody’s translating your videos for the Russian segment of KZbin) P.S Спасибо :)
@jdn_181
@jdn_181 5 жыл бұрын
you have ruind my life my dad makes me watch you every day
@omgtntlol
@omgtntlol 5 жыл бұрын
omg a hater
@martinbichon685
@martinbichon685 6 жыл бұрын
Thank you very much dude! 😉 You really help a lot especially since I tried to apply the PID system to the gyro and it didn't turn out so well.. You're the best 😊
@Builderdude35
@Builderdude35 6 жыл бұрын
Thank YOU for watching! :)
@chunkytakodachi8105
@chunkytakodachi8105 4 жыл бұрын
How do you know if the ki, kp , and kid and is values are too big or small? Please reply!
@teamphoenix3258
@teamphoenix3258 4 жыл бұрын
Hi, great video, you have to limit the summative error from integration, because if there is no limit this till grow on each cycle and code is useless. Thx!
@Animal_Kingdom759
@Animal_Kingdom759 4 жыл бұрын
hello! if have a video about pid if you want to see! i have download link too!
@shivpat6522
@shivpat6522 8 ай бұрын
Hi. I realized when doing a 90 degree turn after doing a straight move with the PID, it overturns and underturns. When I do PID after that it takes too long to correct when going straight. Is there any way I can make my PID and turns accurate together.
@omgtntlol
@omgtntlol 5 жыл бұрын
ummm why did you include the link of this vid into the description????
@austinshe3502
@austinshe3502 4 жыл бұрын
why not
@thetitans2289
@thetitans2289 3 жыл бұрын
Thank you! the video really helped with programming our robot and understanding PID in general. Thanks from Israel!
@Builderdude35
@Builderdude35 3 жыл бұрын
I am glad you enjoyed the video! Good luck in FLL!
@stephanieargyle7537
@stephanieargyle7537 3 жыл бұрын
Thank you so much Builderdude35! This is helping us so much in Lego League. From Cookies and Milk FLL team
@Builderdude35
@Builderdude35 3 жыл бұрын
You're very welcome! I love your team name btw! My first FLL team was almost called "Bacon Bits." I hope you crush it in your next FLL competition. Cheers!
@headsh0tted616
@headsh0tted616 5 жыл бұрын
Hi can you help with adjusting the kp ki and kd
@eserkhan6284
@eserkhan6284 2 ай бұрын
Thanks! You saved my FLL!
@kernall32
@kernall32 6 жыл бұрын
I've been having a lot of trouble using the gyro sensor and the different methods. Inevitably, the robot will start to drift off to one direction and then start spinning in place. I'm trying to steer my team towards more sensor use, but I can't make a good demonstration myself. Are my K values the cause or am I doing something else wrong?
@Builderdude35
@Builderdude35 6 жыл бұрын
The K values are likely the culprit, specifically Ki from what you have described. I would encourage you and your team to keep trying, with a smaller Ki value.
@marwinsteiner5817
@marwinsteiner5817 4 жыл бұрын
I've had this issue, but with positive power. My power setting was set to 35 because my robot requires positive power to move forward. It starts ok but then starts to drive increasingly tight spirals until it eventually just spins in place. How to fix?? Is it the Kp values?
@mateusmendonca955
@mateusmendonca955 3 жыл бұрын
Thank you! Your video was great, and helped us so much! I think you should make a video talking about how to make a robot design presentation. Best wishes from Brazil! Obrigado!
@husseinkhazem619
@husseinkhazem619 5 жыл бұрын
good morning, great video really helpful. But i just wanted to ask how do you take the values of kp , ki and kd.
@Builderdude35
@Builderdude35 5 жыл бұрын
Those K values need to be determined via trial-and-error, which can be a tedious process, but it is worth it in the end.
@XLemonpop
@XLemonpop Жыл бұрын
4 years later and it still works, using it rn for coding class. Hell yeah.
@SamuelViagus
@SamuelViagus 5 жыл бұрын
Excellent, but would a two sensor gyro pid make it better? And if it would, where would you put the two gyro sensors?
@emrobotics3635
@emrobotics3635 3 жыл бұрын
You save our FLL Robot Game!, THANKYOU SO MUCH
@yoink7324
@yoink7324 4 жыл бұрын
Hello builderdude! What would you change if you were trying to go backwards?
@steelyray
@steelyray 3 жыл бұрын
Could you update this to the Prime hub mechanics?
@floydbloke258
@floydbloke258 4 жыл бұрын
Thank you for this. I converted it to LeJOS/Java (personal preference, I'm not fond of the EV3 GUI software, probabaly an age-thing :) ) and it works a treat.
@javierlozanoguiler722
@javierlozanoguiler722 5 жыл бұрын
Hey I just used the program and it worked on forward driving in my robot but when I tried driving back it started well but suddenly started turning around. Any suggestions for negative driving
@javierlozanoguiler722
@javierlozanoguiler722 5 жыл бұрын
Please I really need it
@Builderdude35
@Builderdude35 5 жыл бұрын
You will need to negate the K values to drive in reverse, as well as set the new target to 180 degrees.
@trsta19
@trsta19 5 жыл бұрын
@@Builderdude35 Great video. Robot go really Exstremely Straight. Great job. I have the same question like Javier. Driving back. I try to negate K values but no results. Can you show us some example?
@Ziad_414
@Ziad_414 3 жыл бұрын
I have a question why we put the target as zero not one?
@HexhamFoodCo
@HexhamFoodCo 5 жыл бұрын
Hi Kyle hope all going well at mit. Just a little reflection on your book I bought on amazon for kindle. It absolutely fab, brill content, interactive and well illustrated. Only gripe is I use an iPad and the table of contents is really difficult to read in a blue serif type character font, almost as if it was a piece of code. Makes it difficult to scan. Regards Paul
@Builderdude35
@Builderdude35 5 жыл бұрын
MIT went well, but certainly very busy. Thank you for the feedback!
@HexhamFoodCo
@HexhamFoodCo 6 жыл бұрын
EWith any pid system the tuning and establishing the base constant s critical, took us a while but got their eventually...thnx
@xaitr2886
@xaitr2886 6 жыл бұрын
Question, whenever we start the robot driving straight with this code and any other drive straight block it veers of to the right but then corrects itself. This causes the robot to end up over an inch from the target path. Any ideas to fix it?
@Builderdude35
@Builderdude35 6 жыл бұрын
The initial jerk to one side is caused by slight manufacturing differences between the two motors. You can fix this using an acceleration and drive-straight (motor encoders) combo in the first second of driving before switching to the gyro. I have a tutorial on how to make this algorithm.
@Builderdude35
@Builderdude35 6 жыл бұрын
Here is the link to the video: kzbin.info/www/bejne/ipXdqaKmr8h8qbs
@xaitr2886
@xaitr2886 6 жыл бұрын
Thanks for the help I hope it works
@xaitr2886
@xaitr2886 6 жыл бұрын
Hey it turns out it was a problem with the ball caster, we had 2 in each corner and when we tried it with just one in the center it went perfectly straight. Thanks for the suggestions though!
@vamshireddy8948
@vamshireddy8948 5 жыл бұрын
if this happens with different codes it is probably your build
@camcon8172
@camcon8172 6 жыл бұрын
Thx mate your the best
@leocarlton4364
@leocarlton4364 5 жыл бұрын
Hey Kyle, Leo here. Just brushing over these videos again for this year's tournament and I stumbled upon this video. I made the same one for my robot (by description runs on negative 70 power, is very heavy and compact). I haven't had much experience with these followers before and everyone said they are amazing, however i'm having trouble adjusting the K values. I set all but P to 0 like you said, however it always exponentially gains degrees as it goes further. (ive already re calibrated the gyro in my method. I sent you a comment yesterday about that) Ive tried your K values but it went for a small bit and then span in circles. I feel like even a slight Kp value (0.002) doesn't keep the robot straight and large one (5) turns in circles right away. If i put it to 0 its useless (driving blind). How do I work these values?? Have I stuffed something up in the code? I really want to make it to nationals this year and your channel has basically been the best thing ever and I doubt that this problem is your fault. Please help, Leo.
@kissanoita255
@kissanoita255 5 жыл бұрын
I think i might know the problem, if the P is working correctly (like the robot is driving and fixing and stuff) and even a little ki or kd effects it badly thing, it might be that the sum of the errors and the last error variables aren't "carried" over to the next iteration of the loop, if you're doing it in a myblock try to copy all of the code into a normal program and try running it there. (just a guess hopefully it will work).
@leocarlton4364
@leocarlton4364 5 жыл бұрын
@@kissanoita255 Thankyou for your reply but it's all good I figured out the solution. I forgot to negate the K values!
@anonymousincongito9890
@anonymousincongito9890 5 жыл бұрын
Thanks for the video. It worked well while running as a standalone program. When we put it in a myblock it doesn't work. While creating myblock we made sure to select only the required code as shown in your other video. Do you have any suggestions?
@Builderdude35
@Builderdude35 5 жыл бұрын
Remember to reset the gyro angle before the PID algorithm starts; that's usually the biggest error that arises when trying to use these programs in context.
@amirulisham4789
@amirulisham4789 6 жыл бұрын
hi there! i find your video very useful and informative but i stumbled upon a problem. after setting the Kp I tried to set the value for Kd but the robot will jerk to the left and move in fixed position. can you help?
@Builderdude35
@Builderdude35 6 жыл бұрын
I think it may be that your Kd is too large. Try a smaller value.
@r3xpowpow931
@r3xpowpow931 4 жыл бұрын
Hey i loved your video good job, but when I put it into the my block builder and made it into one block i cannot use 2 of the blocks in the same line of code.
@r3xpowpow931
@r3xpowpow931 4 жыл бұрын
Id love if u could help!
@MrCoollolman
@MrCoollolman 4 жыл бұрын
Do you have a Python Program Form this ?
@ritamr2690
@ritamr2690 5 жыл бұрын
i do not understand why you need to multiply by kp
@user-ym8tw5ny9z
@user-ym8tw5ny9z Жыл бұрын
👍
@ritamr2690
@ritamr2690 5 жыл бұрын
I use the block, and then use it again later in the program and it doesn't work
@Builderdude35
@Builderdude35 5 жыл бұрын
Make sure you reset the gyro (not recalibrate!) before each time you use it.
@leocarlton4364
@leocarlton4364 6 жыл бұрын
Awesome video. I have been trying to build something like this for AGES for my into orbit FFL robot and now I have the answer!!! Really nice tutorial, keep it up.
@Builderdude35
@Builderdude35 6 жыл бұрын
Thanks! I'm glad to hear that this was just what you needed !
@Felix-wq6yb
@Felix-wq6yb 6 жыл бұрын
Sorry to be that guy but drive is spelled wrong in the thumbnail
@Builderdude35
@Builderdude35 6 жыл бұрын
Wow, that's hilarious! Thanks for letting me know! :D
@titansimracing2603
@titansimracing2603 6 жыл бұрын
Thank you so much this helps my FLL team so much! Can you combine this with the PID line follower for an ultimate straight program?
@Builderdude35
@Builderdude35 6 жыл бұрын
Absolutely, that will make a really powerful drive-straight algorithm. Maybe I will cover it in a future video!
@titansimracing2603
@titansimracing2603 6 жыл бұрын
Cool, I have a question: our FLL team has been programming and we have really bad wheel slippage. Do you have any suggestions to fix this problem?
@Builderdude35
@Builderdude35 6 жыл бұрын
Which tire/wheel combination are you using? The best way to counter this is to use acceleration and deceleration algorithms to ramp up and ramp down the robot's speed smoothly when it starts and finishes driving. I have videos on how to make these algorithms.
@titansimracing2603
@titansimracing2603 6 жыл бұрын
We are using the wheels that come with the EV3 Education Core Set. The problem is only when we are turning. I cleaned the wheels and made sure no wires are touching the wheels.
@Builderdude35
@Builderdude35 6 жыл бұрын
That is strange, those wheels usually have very good traction. The only thing I can think of next is the weight distribution on your robot. The heaviest part of the robot is (usually) the EV3 brick, and if it is too far away from the wheels, it can increase the robot's moment of inertia and make it very difficult for the robot to turn.
@coding4me440
@coding4me440 4 жыл бұрын
i figured out an easier way
@adonut8271
@adonut8271 5 жыл бұрын
Man plz help, our fll robot is done but the gyro sensor is upside down, what things should i change in the program
@Builderdude35
@Builderdude35 5 жыл бұрын
If the gyro sensor is positioned upside down, you will need to simply negate all K values.
@adonut8271
@adonut8271 5 жыл бұрын
@@Builderdude35 eyyy it worked, thanks m8
@huokuziinc.4333
@huokuziinc.4333 5 жыл бұрын
I would suggest fixing the direction of the gyro. Most gyro sensor programs and tutorials don't accommodate for upside-down gyros.
@rochesterrobotics5259
@rochesterrobotics5259 5 жыл бұрын
Does it matter if your gyro is mounted 90 degrees to the drive motors?
@Builderdude35
@Builderdude35 5 жыл бұрын
Nope, as long as the rotation axis is vertical, any orientation will work.
@noahdrzewicki4974
@noahdrzewicki4974 5 жыл бұрын
How do you make it go a certain distance for rotations with this program
@Builderdude35
@Builderdude35 5 жыл бұрын
See my tutorial on programming loop exits.
@rits7dl
@rits7dl 5 жыл бұрын
should kp be less than or greater than 1?
@Builderdude35
@Builderdude35 5 жыл бұрын
It depends completely on your robot.
@rits7dl
@rits7dl 5 жыл бұрын
what is the easiest way of finding the K values?
@Builderdude35
@Builderdude35 5 жыл бұрын
It is something that must be tested through trial-and-error.
@mochapera
@mochapera 5 жыл бұрын
I dont knew how to put how many rotchin
@mochapera
@mochapera 5 жыл бұрын
Please help me
@shivani-jy5ew
@shivani-jy5ew 6 жыл бұрын
Oh, now I think I get it.
@ritamr2690
@ritamr2690 5 жыл бұрын
can you go backward with this
@Builderdude35
@Builderdude35 5 жыл бұрын
Yes, but you will need to negate all of the K values.
@mochapera
@mochapera 5 жыл бұрын
How to use?
@huokuziinc.4333
@huokuziinc.4333 5 жыл бұрын
Would you need to adjust the variables based on speed?
@huokuziinc.4333
@huokuziinc.4333 5 жыл бұрын
By variables I meant k values
@huokuziinc.4333
@huokuziinc.4333 5 жыл бұрын
I found that with a proportional gyro drive-straight program I needed too
@Builderdude35
@Builderdude35 5 жыл бұрын
You may need to decrease the Kp and Kd if you drive at a faster speed.
@xaitr2886
@xaitr2886 6 жыл бұрын
YES! This will help our FLL team a ton
@rice2392
@rice2392 4 жыл бұрын
Hello sorry to bother you, but do you still have this program on your computer?
@xaitr2886
@xaitr2886 4 жыл бұрын
Yes I do although our team has modified it a fair bit to work with our robot and other programs. He explains how to create the program in the video.
@shivani-jy5ew
@shivani-jy5ew 6 жыл бұрын
I was lost. You must be so smart!
How to Fix EV3 "Gyro Drift" Error
7:40
Creator Academy Australia
Рет қаралды 11 М.
Using The Gyro Sensor For Better Accuracy In FLL
14:33
LEGORobotics Mr. Hino
Рет қаралды 4,4 М.
An Unknown Ending💪
00:49
ISSEI / いっせい
Рет қаралды 57 МЛН
Watermelon magic box! #shorts by Leisi Crazy
00:20
Leisi Crazy
Рет қаралды 58 МЛН
Will A Guitar Boat Hold My Weight?
00:20
MrBeast
Рет қаралды 262 МЛН
PID Line Follower for EV3 - The Ultimate Line Follower!
21:38
Builderdude35
Рет қаралды 255 М.
World’s BEST Lego self-driving car
10:58
Creative Mindstorms
Рет қаралды 138 М.
10 Reasons Why EV3 Was the Golden Age of LEGO MINDSTORMS
12:36
Builderdude35
Рет қаралды 7 М.
The Ultimate EV3 Acceleration MyBlock - Accel Plus Drive-Straight
12:13
"Line Following With The LEGO Mindstorms EV3 Robot Brick: Computer & Program"
13:36
I made a SUPER FAST Line Follower Robot Using PID!
10:02
Shyam Ravi
Рет қаралды 330 М.
Proportional Line Follower for EV3 - Follow the Line Smoothly!
7:59
Builderdude35
Рет қаралды 207 М.
Accurate Turns With The EV3 Gyro Sensor
15:53
Nate Simpkins
Рет қаралды 3,2 М.
An Unknown Ending💪
00:49
ISSEI / いっせい
Рет қаралды 57 МЛН