Driving straight is, and always will be a challenge with these robots. As a coach, I have beaten it into submission using the PI part of PID. I can make my robot drive straight for 4-5 feet and only be off ~1/2". That said, I did not share that solution with my team because... well... it's FLL... kids to the work. It's quite a bit more involved than a simple Proportional loop. My kids did implement a pretty rudimentary proportional control loop that simply reads the gyro, multiplies it by some kp (which they need to determine - it's heavily dependent on wheel sizes and robot weight) and plugs that value into a move steering block. That will get you 90% of what you need, especially if you stick to lower power levels. On the subject of Gyro Drift - there is an easy way to cure it. I share this freely because the problem of gyro drift is so frustrating for so many teams. Lego should have included a block like this in the EV3 software, but they didn't. A mostly undocumented feature of the gyro is that when you switch between Angle+Rate measurement and Angle measurement, it forces the Gyro to recalibrate. Under the hood, it actually returns NaN (not a number) until the calibration is complete. If your robot is moved at all while this calibration is happening, you will get gyro drift. We can exploit this feature by creating a 'recalibrate' MyBlock that simply reads Angle+Rate, then waits for 'Angle' to return Zero. As soon as that condition is hit, you're good to go and should see no drift. Note that this process can take 1-2 seconds, so it's something that you want to do ~once/match. We do ours during the 1 minute setup. My team has tested this extensively and it works 100% of the time. The MyBlock should look like this (ours has a sound at the end so we know it's done): [image: Inline image 1] On Tue, Oct 20, 2015 at 3:23 PM, Cedric D'Costa <[log in to unmask]> wrote: > Our kids have experienced that going in a straight line is a challenge. > The Robot works differently > based on battery power or some unknown variables. Even the code found > online using the > Gyro sensor does not always work. The EV3 will gradually steer to the > right or left. > Sometime just the basic Move tank or Move steering works. This has led to > a level of uncertainty > during programming. > > Has anyone managed to make the EV3 go in a straight line consistently? Our > success rate has been > 3 out of 5 on an average using the Gyro so we're not sure how it will > perform on Competition day. > > Thanks, > Cedric > > On Tue, Oct 20, 2015 at 1:48 PM, Frank Levine <[log in to unmask]> > wrote: > >> PID is good when you have non-straight lines, because it will react to >> the 'D' term as the line starts to turn away. In practice, PID is not easy >> to program (correctly) in EV3. I have tried. It also requires a level of >> math that my team has not learned yet. They're in 5th grade now... maybe >> next year. I do think that PID would be good for straight line driving >> using the gyro. For almost all normal FLL tasks, just doing 'P' will get >> you where you need to go. >> >> On Tue, Oct 20, 2015 at 1:44 PM, Thomas (Tweeks) Weeks < >> [log in to unmask]> wrote: >> >>> Thanks.. Great resource. :) >>> >>> >>> Still didn't see any pure PID straight line tutorials though.. although >>> I DID like the "straight line" tutorial and how it used degrees. >>> >>> :) >>> >>> >>> Tweeks >>> ------------------------------ >>> *From:* Todd J Lennox <[log in to unmask]> >>> *Sent:* Tuesday, October 20, 2015 1:04 PM >>> *To:* Thomas (Tweeks) Weeks >>> *Cc:* [log in to unmask] >>> *Subject:* Re: [VADCFLL-L] Any good EV3 Code Examples for a Straight >>> Line PID program? >>> >>> Try EV3 lessons. They have some really good stuff. >>> >>> Sent from my iPhone >>> >>> On Oct 20, 2015, at 12:35 PM, Thomas (Tweeks) Weeks < >>> [log in to unmask] <[log in to unmask]>> wrote: >>> >>> I've seen a few videos and sites talking about PID based line following >>> and balance bot applications.. but our kids just want to see a good example >>> of straight line PID code (without trying to teach them calculus). >>> >>> >>> I can do this in C, but I'm not savvy enough with the mindstorms GUI >>> tools to show them how to do it in Lego. >>> >>> >>> Tweeks >>> ------------------------------ >>> To UNSUBSCRIBE or CHANGE your settings, please visit >>> https://listserv.jmu.edu/archives/vadcfll-l.html and select "Join or >>> leave the list". >>> VADCFLL administrative announcements are sent via >>> VADCFLL-ANNOUNCEMENTS-L. Visit >>> https://listserv.jmu.edu/archives/vadcfll-announcements-l.html to >>> subscribe. >>> >>> ------------------------------ >>> To UNSUBSCRIBE or CHANGE your settings, please visit >>> https://listserv.jmu.edu/archives/vadcfll-l.html and select "Join or >>> leave the list". >>> VADCFLL administrative announcements are sent via >>> VADCFLL-ANNOUNCEMENTS-L. Visit >>> https://listserv.jmu.edu/archives/vadcfll-announcements-l.html to >>> subscribe. >>> >> >> ------------------------------ >> To UNSUBSCRIBE or CHANGE your settings, please visit >> https://listserv.jmu.edu/archives/vadcfll-l.html and select "Join or >> leave the list". >> VADCFLL administrative announcements are sent via >> VADCFLL-ANNOUNCEMENTS-L. Visit >> https://listserv.jmu.edu/archives/vadcfll-announcements-l.html to >> subscribe. > > > -- To UNSUBSCRIBE or CHANGE your settings, please visit https://listserv.jmu.edu/archives/vadcfll-l.html and select "Join or leave the list". -- VADCFLL administrative announcements are sent via VADCFLL-ANNOUNCEMENTS-L. Visit https://listserv.jmu.edu/archives/vadcfll-ANNOUNCEMENTS-l.html to subscribe.