src/main/java/frc/robot/subsystems/DriveTrainSubsystem.java
/**
     * Function uses Feedforward and PID controllers to tank drive robot
     * 
     * @param leftSetpoint  voltage setpoint m/s
     * @param rightSetpoint voltage setpoint m/s
     */
Function uses Feedforward and PID controllers to tank drive robot

@param leftSetpoint  voltage setpoint m/s
@param rightSetpoint voltage setpoint m/s
Function uses Feedforward and PID controllers to tank drive robot @param leftSetpoint voltage setpoint m / s @param rightSetpoint voltage setpoint m / s
public void driveFeedforwardPID(double leftSetpoint, double rightSetpoint) {
        double leftOut = lPIDMotorController.calculate(getLeftEncoderRate(),
                leftSetpoint * 1000);
        double rightOut = rPIDMotorController.calculate(getRightEncoderRate(),
                rightSetpoint * 1000);
        tankDriveVolts(leftOut * 12, rightOut * 12);
        SmartDashboard.putNumber("getLeftEncoderRate()", -getLeftEncoderRate());
        SmartDashboard.putNumber("getRightEncoderRate()", getRightEncoderRate());
        SmartDashboard.putNumber("leftSetpoint * 1000", -leftSetpoint * 1000);
        SmartDashboard.putNumber("leftSetpoint * 1000", leftSetpoint * 1000);
        SmartDashboard.putNumber("Left driveFeedforwardPID", leftOut);
        SmartDashboard.putNumber("Right driveFeedforwardPID", rightOut);
    }
public void driveFeedforwardPID ( double leftSetpoint , double rightSetpoint ) { double leftOut = lPIDMotorController . calculate ( getLeftEncoderRate ( ) , leftSetpoint * 1000 ) ; double rightOut = rPIDMotorController . calculate ( getRightEncoderRate ( ) , rightSetpoint * 1000 ) ; tankDriveVolts ( leftOut * 12 , rightOut * 12 ) ; SmartDashboard . putNumber ( "getLeftEncoderRate()" , - getLeftEncoderRate ( ) ) ; SmartDashboard . putNumber ( "getRightEncoderRate()" , getRightEncoderRate ( ) ) ; SmartDashboard . putNumber ( "leftSetpoint * 1000" , - leftSetpoint * 1000 ) ; SmartDashboard . putNumber ( "leftSetpoint * 1000" , leftSetpoint * 1000 ) ; SmartDashboard . putNumber ( "Left driveFeedforwardPID" , leftOut ) ; SmartDashboard . putNumber ( "Right driveFeedforwardPID" , rightOut ) ; }
Function uses Feedforward and PID controllers to tank drive robot
Function uses Feedforward and PID controllers to tank drive robot
// double leftOut = feedforward.calculate(leftSetpoint) // + lPIDMotorController.calculate(getLeftEncoderRate(), leftSetpoint / 100); // double rightOut = feedforward.calculate(rightSetpoint) // + rPIDMotorController.calculate(getRightEncoderRate(), rightSetpoint / 100); // if (Math.abs(leftOut) < Constants.DriveTrain.MOTOR_MIN_VOLTAGE_OUT) // leftOut = 0; // if (Math.abs(rightOut) < Constants.DriveTrain.MOTOR_MIN_VOLTAGE_OUT) // rightOut = 0;