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

Поділитися
Вставка
  • Опубліковано 18 гру 2024

КОМЕНТАРІ • 106

  • @AlexSnopow
    @AlexSnopow 5 років тому +3

    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 UA-cam)
    P.S Спасибо :)

  • @robocodex
    @robocodex 2 роки тому +4

    I love these tutorials and I had the idea to remake it for SPIKE Python. I translated it and it worked nicely

  • @emrobotics3635
    @emrobotics3635 3 роки тому

    You save our FLL Robot Game!, THANKYOU SO MUCH

  • @eserkhan6284
    @eserkhan6284 4 місяці тому

    Thanks! You saved my FLL!

  • @martinbichon685
    @martinbichon685 6 років тому +4

    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 😊

  • @thetitans2289
    @thetitans2289 3 роки тому +1

    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!

  • @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 !

  • @XLemonpop
    @XLemonpop Рік тому

    4 years later and it still works, using it rn for coding class. Hell yeah.

  • @chunkytakodachi8105
    @chunkytakodachi8105 4 роки тому +1

    How do you know if the ki, kp , and kid and is values are too big or small? Please reply!

  • @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.

  • @stephanieargyle7537
    @stephanieargyle7537 3 роки тому +1

    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!

  • @teamphoenix3258
    @teamphoenix3258 4 роки тому +2

    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!

  • @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!

  • @Ziad_414
    @Ziad_414 3 роки тому

    I have a question why we put the target as zero not one?

  • @headsh0tted616
    @headsh0tted616 5 років тому +1

    Hi can you help with adjusting the kp ki and kd

  • @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.

  • @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?

  • @steelyray
    @steelyray 3 роки тому

    Could you update this to the Prime hub mechanics?

  • @jdn_181
    @jdn_181 5 років тому +9

    you have ruind my life my dad makes me watch you every day

  • @shivpat6522
    @shivpat6522 11 місяців тому

    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.

  • @husseinkhazem619
    @husseinkhazem619 6 років тому +1

    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  6 років тому +3

      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.

  • @kernall32
    @kernall32 6 років тому +1

    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 5 років тому

      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?

  • @titansimracing2603
    @titansimracing2603 6 років тому +1

    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 років тому +1

      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 років тому +1

      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 років тому +1

      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.

  • @xaitr2886
    @xaitr2886 6 років тому +1

    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 років тому +1

      Here is the link to the video: ua-cam.com/video/TdzxopzcIsY/v-deo.html

    • @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

  • @omgtntlol
    @omgtntlol 5 років тому +1

    ummm why did you include the link of this vid into the description????

  • @yoink7324
    @yoink7324 5 років тому

    Hello builderdude! What would you change if you were trying to go backwards?

  • @javierlozanoguiler722
    @javierlozanoguiler722 6 років тому +1

    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 6 років тому +1

      Please I really need it

    • @Builderdude35
      @Builderdude35  6 років тому

      You will need to negate the K values to drive in reverse, as well as set the new target to 180 degrees.

    • @trsta19
      @trsta19 6 років тому

      @@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?

  • @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

  • @r3xpowpow931
    @r3xpowpow931 5 років тому

    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.

  • @noahdrzewicki4974
    @noahdrzewicki4974 6 років тому

    How do you make it go a certain distance for rotations with this program

    • @Builderdude35
      @Builderdude35  6 років тому +1

      See my tutorial on programming loop exits.

  • @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!

  • @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.

  • @huokuziinc.4333
    @huokuziinc.4333 6 років тому

    Would you need to adjust the variables based on speed?

    • @huokuziinc.4333
      @huokuziinc.4333 6 років тому

      By variables I meant k values

    • @huokuziinc.4333
      @huokuziinc.4333 6 років тому

      I found that with a proportional gyro drive-straight program I needed too

    • @Builderdude35
      @Builderdude35  6 років тому

      You may need to decrease the Kp and Kd if you drive at a faster speed.

  • @anonymousincongito9890
    @anonymousincongito9890 6 років тому

    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  6 років тому

      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.

  • @adonut8271
    @adonut8271 6 років тому

    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  6 років тому

      If the gyro sensor is positioned upside down, you will need to simply negate all K values.

    • @adonut8271
      @adonut8271 6 років тому

      @@Builderdude35 eyyy it worked, thanks m8

    • @huokuziinc.4333
      @huokuziinc.4333 6 років тому

      I would suggest fixing the direction of the gyro. Most gyro sensor programs and tutorials don't accommodate for upside-down gyros.

  • @rits7dl
    @rits7dl 5 років тому

    should kp be less than or greater than 1?

    • @Builderdude35
      @Builderdude35  5 років тому

      It depends completely on your robot.

  • @rochesterrobotics5259
    @rochesterrobotics5259 6 років тому

    Does it matter if your gyro is mounted 90 degrees to the drive motors?

    • @Builderdude35
      @Builderdude35  6 років тому

      Nope, as long as the rotation axis is vertical, any orientation will work.

  • @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 років тому +1

      I think it may be that your Kd is too large. Try a smaller value.

  • @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!

  • @MrCoollolman
    @MrCoollolman 5 років тому

    Do you have a Python Program Form this ?

  • @ritamr2690
    @ritamr2690 6 років тому

    i do not understand why you need to multiply by kp

  • @mochapera
    @mochapera 6 років тому

    How to use?

  • @camcon8172
    @camcon8172 6 років тому +1

    Thx mate your the best

  • @ritamr2690
    @ritamr2690 6 років тому

    I use the block, and then use it again later in the program and it doesn't work

    • @Builderdude35
      @Builderdude35  6 років тому

      Make sure you reset the gyro (not recalibrate!) before each time you use it.

  • @shivani-jy5ew
    @shivani-jy5ew 6 років тому

    I was lost. You must be so smart!

  • @shivani-jy5ew
    @shivani-jy5ew 6 років тому

    Oh, now I think I get it.

  • @ritamr2690
    @ritamr2690 6 років тому

    can you go backward with this

    • @Builderdude35
      @Builderdude35  6 років тому

      Yes, but you will need to negate all of the K values.

  • @mochapera
    @mochapera 6 років тому

    I dont knew how to put how many rotchin

  • @Felix-wq6yb
    @Felix-wq6yb 6 років тому

    Sorry to be that guy but drive is spelled wrong in the thumbnail

    • @Builderdude35
      @Builderdude35  6 років тому +1

      Wow, that's hilarious! Thanks for letting me know! :D

  • @user-ym8tw5ny9z
    @user-ym8tw5ny9z Рік тому

    👍

  • @coding4me440
    @coding4me440 5 років тому

    i figured out an easier way