SuperPUDS is our main driving block and is very important. It combines DriveStr8, which uses gyro errors to drive mostly straight, and PowerUp, a block that gradually changes power over a specific amount of time.
SuperPUDSVariable is the most basic version - it simply ends on a variable. This one needs other action from outside the block to end it, unlike the others which end in the block alone.
SuperPUDS can have any ending condition you need - you can change the variable to a different condition or just use the base SuperPUDSVariable - the latter is used in our new SuperPUDSTouch block.
Overall, SuperPUDS is a very universal block that is very reliable as well. But, we still need to discuss the components.
PowerUp
PowerUp is the “PU” portion of SuperPUDS. It allows changing the motor power: for instance, it can start the motors slowly and then speed them up. Many teams call this “ramping up,” and the reverse is “ramping down.” (Really, PowerUp is simpler. It doesn’t do anything with motors. It just outputs a number that changes over time. We wire this output into a motor block as the Power input.)
Our old PowerUp was incredibly over-complicated. We didn't know linear functions at that time, so we ended up writing very complicated code that was basically a linear function. Now that we do know them, we can easily write the program in a jiffy!
DriveStr8
Okay, DriveStr8 is really complicated. Get ready.
DriveStr8 is a PID Gyro controller. It didn’t start out this complicated. Originally, DriveStr8 was inspired by
Builderdude35’s video “How to Make your Robot Drive Straight with the EV3 Gyro.” He shows how to write a proportional controller: in a loop, over and over,
- Read the Gyro angle
- Subtract it from the desired heading (call the difference the “error”)
- Multiply the error by a gain (this makes it “proportional”)
- Wire that into a Move Steering block as the Steer input, so that the Robot steers back to the desired heading.
This is also really commonly used for Line Following, using Reflected Light Intensity instead of the Gyro. This is something every FLL team should learn.
Builderdude35 has a lot of videos on Line Following, too. The one called “
PID Line Follower for EV3 - The Ultimate Line Follower!” sounds really great, but we watched it and Did. Not. Get. It. What is PID?
YouTube has lots of videos on PID. They tell you that it stands for “Proportional Integral Derivative.” We know what proportional means. The other two words are from Calculus, though. Finally, we found
a video that explains it as past, present, and future errors, and that made enough sense for us to figure it out.
Present error is the current error in the Gyro. This is the P term, for Proportional. There are two big problems with using just a proportional Gyro controller:
- It wobbles a lot.
- It settles on the wrong value most of the time. (Ask for a heading of 20, and you’ll maybe get 17 or 22 instead.) This doesn’t seem like a huge deal, as the Gyro’s accuracy is supposed to be 3 degrees anyway, but we wanted something more reliable.
This picture shows a test we did, with a marker taped onto the robot. The robot started with a Gyro reading of 0, and we ran SuperPUDS for 5 seconds with a desired heading of 20 degrees. The orange lines show it driving with only proportional control (using only the present error). It’s really wobbly in the beginning, and in three different tests, it didn’t do a very good job driving in a repeatable path.
Here’s a corresponding plot of the Gyro readings. The orange line was from one of these tests. You can see that it settled at around 17 degrees.
Fixing the Wrong Value Issue
The fix for the “wrong value” issue is the past error. This is sort of like the robot attempting to learn from its mistakes. It adds together all of the previous errors. That’s a bit strange, so let’s say it again: the past error adds together all of the previous errors. Why would you do this? Because it tells you if you’re continually wrong to the same side. If, instead, you wobble back and forth, then the cumulative value is around zero. If you’re always wrong to the same side, then the cumulative error keeps growing.
So, we can take the past error times a gain, which is typically low for later on when the numbers get big. This helps the robot get aligned to where it should be, not where it’s been if that was wrong.
The blue lines in the above pictures show what happens when we include the past error. It gets the 20 degrees correct, but it’s still wobbly at the beginning.
Fixing the Wobbles
We can fix the wobbling by asking the robot to predict the future. This is based on the gyro rate, which the robot kindly will give us. This means we don’t have to guess what it is. If the gyro rate is high, then the robot is steering hard, and it will probably overshoot the desired heading. Did you catch that? We’re predicting the future heading, based on the current rate! We can apply another steering correction to counteract this. Being able to accurately predict allows for straighter driving more consistently. The green lines in our pics show the effect of including the future error. Notice how consistent they are, compared to without the future correction!
Is your mind blown?

Until next time, keep building!