mirror of
https://github.com/Team4388/2022NoWayHome.git
synced 2026-06-09 08:48:07 -06:00
added a constant
This commit is contained in:
@@ -100,7 +100,7 @@ public final class Constants {
|
|||||||
public static final int DEGREES_PER_ROT = 0; //""//
|
public static final int DEGREES_PER_ROT = 0; //""//
|
||||||
public static final int TURRET_MOTOR_POS_AT_ZERO_ROT = 0; //""//
|
public static final int TURRET_MOTOR_POS_AT_ZERO_ROT = 0; //""//
|
||||||
public static final int TURRET_MOTOR_ROTS_PER_ROT = 0; //""//
|
public static final int TURRET_MOTOR_ROTS_PER_ROT = 0; //""//
|
||||||
|
public static final double ENCODER_TICKS_PER_REV = 2048; //""//
|
||||||
|
|
||||||
|
|
||||||
/* Turret Constants */
|
/* Turret Constants */
|
||||||
|
|||||||
@@ -5,21 +5,17 @@
|
|||||||
package frc4388.robot.subsystems;
|
package frc4388.robot.subsystems;
|
||||||
|
|
||||||
import java.util.Base64.Encoder;
|
import java.util.Base64.Encoder;
|
||||||
|
|
||||||
import com.ctre.phoenix.motorcontrol.NeutralMode;
|
import com.ctre.phoenix.motorcontrol.NeutralMode;
|
||||||
import com.ctre.phoenix.motorcontrol.TalonFXControlMode;
|
import com.ctre.phoenix.motorcontrol.TalonFXControlMode;
|
||||||
import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX;
|
import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX;
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj.smartdashboard.*;
|
import edu.wpi.first.wpilibj.smartdashboard.*;
|
||||||
import edu.wpi.first.math.controller.BangBangController;
|
import edu.wpi.first.math.controller.BangBangController;
|
||||||
import edu.wpi.first.math.controller.SimpleMotorFeedforward;
|
|
||||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
import frc4388.robot.Constants.ShooterConstants;
|
import frc4388.robot.Constants.ShooterConstants;
|
||||||
import frc4388.utility.ShooterTables;
|
import frc4388.utility.ShooterTables;
|
||||||
import frc4388.utility.Gains;
|
import frc4388.utility.Gains;
|
||||||
import frc4388.utility.controller.IHandController;
|
import frc4388.utility.controller.IHandController;
|
||||||
import com.revrobotics.RelativeEncoder;
|
|
||||||
import com.revrobotics.*;
|
|
||||||
|
|
||||||
public class BoomBoom extends SubsystemBase {
|
public class BoomBoom extends SubsystemBase {
|
||||||
public WPI_TalonFX m_shooterFalconLeft = new WPI_TalonFX(ShooterConstants.SHOOTER_FALCON_BALLER_ID);
|
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
|
//Testing purposes resetting gyros
|
||||||
//resetGryoAngleADj();
|
//resetGryoAngleADj();
|
||||||
//shooterTrims = new Trims(0,0);
|
//shooterTrims = new Trims(0,0);
|
||||||
feedforward.calculate(15, 20); // feedforward.calculate(velocity, acceleration);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/** Creates a new BoomBoom. */
|
/** Creates a new BoomBoom. */
|
||||||
public BoomBoom(WPI_TalonFX shooterFalconLeft, WPI_TalonFX shooterFalconRight) {
|
public BoomBoom(WPI_TalonFX shooterFalconLeft, WPI_TalonFX shooterFalconRight) {
|
||||||
m_shooterFalconLeft = shooterFalconLeft;
|
m_shooterFalconLeft = shooterFalconLeft;
|
||||||
m_shooterFalconRight = shooterFalconRight;
|
m_shooterFalconRight = shooterFalconRight;
|
||||||
|
|
||||||
int closedLoopTimeMs = 1;
|
int closedLoopTimeMs = 1;
|
||||||
//LEFT FALCON
|
//LEFT FALCON
|
||||||
m_shooterFalconLeft.configFactoryDefault();
|
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.configClosedLoopPeriod(0, closedLoopTimeMs, ShooterConstants.SHOOTER_TIMEOUT_MS);
|
||||||
m_shooterFalconLeft.configSupplyCurrentLimit(ShooterConstants.SUPPLY_CURRENT_LIMIT_CONFIG, ShooterConstants.SHOOTER_TIMEOUT_MS);
|
m_shooterFalconLeft.configSupplyCurrentLimit(ShooterConstants.SUPPLY_CURRENT_LIMIT_CONFIG, ShooterConstants.SHOOTER_TIMEOUT_MS);
|
||||||
|
|
||||||
|
|
||||||
//RIGHT FALCON
|
//RIGHT FALCON
|
||||||
m_shooterFalconRight.configFactoryDefault();
|
m_shooterFalconRight.configFactoryDefault();
|
||||||
m_shooterFalconRight.setNeutralMode(NeutralMode.Coast);
|
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 controller
|
||||||
//Controls a motor with the output of the BangBang conroller and a feedforward
|
//Controls a motor with the output of the BangBang conroller and a feedforward
|
||||||
//Shrinks the feedforward slightly to avoid over speeding the shooter
|
//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));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user