Drive difting

As Im preping for Norcal sig event, our auton is drifting to the right even though it is told in the program to go forward. This is also happening in user control but isnt noticable, its only noticeable in the program. Some things I’ve tried to do was;

  • Make sure the shafts are in the motor proper

  • Tested Auton on a Completely Flat surface

  • Replace Inertial and Brain(Brain is updated to latest Firmware also)

If you have had a similar problem and overcome please share some ideas.
Thanks for helping :slightly_smiling_face: - 27301D

This is a visual of what i mean:

1 Like

Try bracing the robot. One side of the robot might be slanted just a little bit, causing the robot to move at an angle rather than going straight. If that doesn’t work, then try checking each motor one by one. A motor might be slower than another. If all the motors are at the same speed, then your last hope is to check the drive train’s friction. If one side of the drive train has more friction than the other, then it might slow down that side, causing the robot to slightly drift.

2 Likes

I would recommend going into devices, and checking each drive motor individually.

Are you using the built in Vex drivetrain controller in your code? If not, and you have your own drive PID, I’d recommend including a second PID controller into the function that holds the robot at the angle it starts at. This means that, while the robot drives, it’ll keep it self driving along a straight line.

2 Likes

This could be a lot of things. Weight distribution, friction in axels, motor issues, code problems, like what Mano said, your bracing, so just double check the robot and use the process of elimination.

This works well for making my drive pid go straight mine is more like this:


This is just eyeballed so the straightness of these is not 100% accurate but close.

It really does make a difference and the code is pretty simple to implement ours is something around this

double LError = Rabsoulute-Labsoulute ;
double LDerivative = LError - LprevError;
LIntergal = LIntergal + LTotalError;
if (fabs(LError) > .2){
LmotorPower = (LError * dLkp + LDerivative  * dLkd + LIntergal * dLki) + RmotorPower;
}
else{
  LmotorPower = RmotorPower;
}

It only changes the Lmotorpower based on the difference in motor sides. This keeps it mostly straight It has some flaws like you have to give it a 200 millisecond delay between turns and driving or else it corrects the turns overshoot (it causes it to go slightly not as far).

3 Likes

Sorry I have been not replying to the amazing information you guys have given me, I was on a trip that limited my Safari use on my phone :smiling_face_with_tear: and have left my computer at home. I have finally got a chance to read all of this and figured out what happened. I have 2 full length braces, but the front of the bot needed one because it was making the drive-train bend.

What I mean:
Screenshot 2024-02-21 2.20.48 PM
Thanks for the help guys. :grin:

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.