Problem with driving subsystem

For our robot right now, it can move using the Xboxcontroller; however, there is a big issue with the robot drifting to the side when it is driving forward. Because of this, the robot keeps driving incorrectly as the robot always turns after moving forward a certain duration of time. Is this perhaps a programming issue? According to some people in the electrical and mechanical groups in my robotics team, the drift has nothing to do with the hardware of the robot, leading me to believe this is perhaps a software issue.

Our GitHub for the robot: https://github.com/FRC-4509-MechBulls/2020-Season-Command-Based/tree/master/src/main/java/frc/robot

In our code, left trigger is to move forward, right trigger is moving backwards, and the left joystick is rotating the robot.

I would greatly appreciate the help to get our robot ready for competition!

I don’t see anything obviously wrong with this code (some questionable choices in variable naming aside); your drive command is pretty standard.

Try writing a command that simply sends .5 to both sides of the drive, and see how straight your robot drives. I am somewhat skeptical of the claims of your electrical and mechanical groups.

1 Like

Looks pretty standard.
I would make sure you have some deadband. Your code sets it to zero which is bad when you noise from your controllers. The default is 2%. Something in the range of .02 to .05 seem to work well.

In my experience, problems like this tend to be mechanical or electrical problems, despite what your mechanical and electrical teams have told you. The common things I have seen cause this problem are

  1. The chain on one side is considerably tighter than the other
  2. The chain on one side is scrubbing against something
  3. The chain on one side is skipping
  4. A motor on one side has a loose connection or the connection is cut somewhere

All of these things can easily cause a drivetrain to drift in one direction while holding straight. Drivetrain code tends to be fairly simple and there aren’t many places that would cause this problem. I would have your other subgroups investigate more.

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