added a constant

This commit is contained in:
Abhishrek05
2022-01-28 17:17:24 -07:00
parent d2694e2b61
commit debdb1c087
2 changed files with 2 additions and 14 deletions
@@ -5,21 +5,17 @@
package frc4388.robot.subsystems;
import java.util.Base64.Encoder;
import com.ctre.phoenix.motorcontrol.NeutralMode;
import com.ctre.phoenix.motorcontrol.TalonFXControlMode;
import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX;
import edu.wpi.first.wpilibj.smartdashboard.*;
import edu.wpi.first.math.controller.BangBangController;
import edu.wpi.first.math.controller.SimpleMotorFeedforward;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc4388.robot.Constants.ShooterConstants;
import frc4388.utility.ShooterTables;
import frc4388.utility.Gains;
import frc4388.utility.controller.IHandController;
import com.revrobotics.RelativeEncoder;
import com.revrobotics.*;
public class BoomBoom extends SubsystemBase {
public WPI_TalonFX m_shooterFalconLeft = new WPI_TalonFX(ShooterConstants.SHOOTER_FALCON_BALLER_ID);
@@ -40,8 +36,6 @@ public Turret m_turretSubsystem;
SimpleMotorFeedforward feedforward = new SimpleMotorFeedforward(69, 42, 0); //get real values later
/*
@@ -51,15 +45,11 @@ public BoomBoom(){
//Testing purposes resetting gyros
//resetGryoAngleADj();
//shooterTrims = new Trims(0,0);
feedforward.calculate(15, 20); // feedforward.calculate(velocity, acceleration);
}
/** Creates a new BoomBoom. */
public BoomBoom(WPI_TalonFX shooterFalconLeft, WPI_TalonFX shooterFalconRight) {
m_shooterFalconLeft = shooterFalconLeft;
m_shooterFalconRight = shooterFalconRight;
int closedLoopTimeMs = 1;
//LEFT FALCON
m_shooterFalconLeft.configFactoryDefault();
@@ -72,7 +62,6 @@ feedforward.calculate(15, 20); // feedforward.calculate(velocity, acceleration);
m_shooterFalconLeft.configClosedLoopPeriod(0, closedLoopTimeMs, ShooterConstants.SHOOTER_TIMEOUT_MS);
m_shooterFalconLeft.configSupplyCurrentLimit(ShooterConstants.SUPPLY_CURRENT_LIMIT_CONFIG, ShooterConstants.SHOOTER_TIMEOUT_MS);
//RIGHT FALCON
m_shooterFalconRight.configFactoryDefault();
m_shooterFalconRight.setNeutralMode(NeutralMode.Coast);
@@ -139,8 +128,7 @@ public void setShooterGains() {
//Controls a motor with the output of the BangBang controller
//Controls a motor with the output of the BangBang conroller and a feedforward
//Shrinks the feedforward slightly to avoid over speeding the shooter
m_shooterFalconLeft.set(controller.calculate(encoder.getRate(), targetVel) + 0.9 * feedforward.calculate(targetVel));
m_shooterFalconLeft.set(controller.calculate(Encoder.getRate(), targetVel) + 0.9 * feedforward.calculate(targetVel));
}
}