Wheels keep stuttering during autonomous

Our wheels keep having trouble in autonomous- we can’t make any progress because they keep going back and forth. It was working last week so I don’t know what’s wrong. It works fine in TeleOp.
Here’s our code

For reference we use mecanum wheels

Not exactly sure what’s going on here with limited information, but I would take a look at DriveTrainSubsystem.autoReverse():

  public boolean autoReverse() {

    spinMotorBackwards();

    if ( frontLeftTalon.getSelectedSensorPosition() <= ((Constants.ROTATIONAL_CONSTANT / 2) * -Constants.AUTO_DISTANCE_BACKWARDS)) {
      // frontLeftTalon.getSelectedSensorPosition() >= 0  
      spinMotorBackwards();
      return true;
    } else {
      stopMotor();
      return false;
    }
    
  }

When your if condition is false you are commanding the motors to spin backwards and stop in the same iteration. I don’t think you want the spinMotorBackwards() call before the if block.

2 Likes

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