Files
2022NoWayHome/src/main/java/frc4388/utility/Gains.java
T

61 lines
1.9 KiB
Java
Raw Normal View History

2021-12-06 16:38:29 -07:00
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package frc4388.utility;
/** Add your docs here. */
public class Gains {
2022-03-05 11:07:54 -07:00
public double kP;
public double kI;
public double kD;
public double kF;
public int kIzone;
public double kPeakOutput;
public double kmaxOutput;
public double kminOutput;
2021-12-06 16:38:29 -07:00
2022-01-11 11:05:52 -07:00
/**
* Creates Gains object for PIDs
* @param kP The P value.
* @param kI The I value.
* @param kD The D value.
* @param kF The F value.
* @param kIzone The zone of the I value.
* @param kPeakOutput The peak output setting the motors to run the gains at, in both forward and reverse directions. By default 1.0.
*/
public Gains(double kP, double kI, double kD, double kF, int kIzone, double kPeakOutput)
{
2022-03-05 11:07:54 -07:00
this.kP = kP;
this.kI = kI;
this.kD = kD;
this.kF = kF;
this.kIzone = kIzone;
this.kPeakOutput = kPeakOutput;
this.kmaxOutput = this.kPeakOutput;
this.kminOutput = -this.kPeakOutput;
2022-01-11 11:05:52 -07:00
}
2021-12-06 16:38:29 -07:00
2022-01-11 11:05:52 -07:00
/**
* Creates Gains object for PIDs
* @param kP The P value.
* @param kI The I value.
* @param kD The D value.
* @param kF The F value.
* @param kIzone The zone of the I value.
* @param kMinOutput The lowest output setting to run the gains at, usually in the reverse direction. By default -1.0.
* @param kMaxOutput The highest output setting to run the gains at, usually in the forward direction. By default 1.0.
*/
public Gains(double kP, double kI, double kD, double kF, int kIzone, double kMinOutput, double kMaxOutput)
{
2022-03-05 11:07:54 -07:00
this.kP = kP;
this.kI = kI;
this.kD = kD;
this.kF = kF;
this.kIzone = kIzone;
this.kminOutput = kMinOutput;
this.kmaxOutput = kMaxOutput;
this.kPeakOutput = (Math.abs(this.kminOutput) > Math.abs(this.kmaxOutput)) ? Math.abs(this.kminOutput) : Math.abs(this.kmaxOutput);
2022-01-11 11:05:52 -07:00
}
2021-12-06 16:38:29 -07:00
}