Programming is so frustrating

My team and I are using pros for the programming part of the comp, we coded a PID loop and we finished tuning it with a bit of struggle. However, we noticed that our trajectory is inconsistent, the robot is kind of deviating while executing the program and it s so frustrating cuz the inputs (distances and angles) are literally the same, we’re being extremely careful about the initial position of our robot, and we try to put it at the exact same position each time but the result are always varying. We tuned our constants pretty well i think , we even started all over again to tune as well as we could. It’s quite discouraging at this point , and I would like to know if anyone else has encountered those kinds of problems and how did you fix them ? Would really appreciate the help!!

1 Like

what sensors are you using? and have you considered using slew rate to limit acceleration so those sensors have an easier time?

2 Likes

PID loops are extremely annoying to tune. what you described happens to my low firction IQ robot too so dont be discouraged :slight_smile:

2 Likes

We aren’t using any sensors , just the motor’s encoders.

1 Like

also keep in mind that if your build has friction or is inconsistent, your robot wont be able to move consistently no matter how good your code is.

5 Likes

additionally, your problem could be that if you throttle your drive at the start of your motion, your wheels will slip a varying amount which will lead to inaccurate values in your motor encoders. using tracking wheels will eliminate this issue, the way tracking wheels work is that they are unpowered omni wheels, mounted on a lever that is rubber banded into the ground. An external encoder reads the value of these wheels. here’s a good topic about them:

this will give you a more reliable sensor value for how far your robot has travelled, instead of how far your wheels have spun.

if you don’t have room or don’t want to have tracking wheels, you can always lower your acceleration which will reduce but not eliminate wheel slipping.

6 Likes

Thank you for the help , we actually considered using tracking wheels or inertial sensors for more accuracy, but the problem is that we can’t find them in our country and we can’t really afford them

1 Like

in that case then I would reduce your robot’s acceleration and possibly even your top speed in order to reduce the error in your encoders from wheel slippage.

3 Likes

An easy way to tell if it is wheels slipping due to fast movements is to slow all of your driving down to 1/4 speed and seeing if it is more accurate that way. If it is still having issues then you probably have something jank in the code or the drive.

4 Likes

We may actually try this out , thanks !

If your robot isn’t traveling straight, it’s very likely that this is a hardware issue, and the inconsistencies in PID are likely due to it being untuned.

3 Likes

Make sure your drive-base doesn’t have a bunch of friction or else that may affect the consistency of your PID. I would recommend trying your best to align the shafts.

4 Likes