Made Janky Code

Added Manual Shooter
This commit is contained in:
Kerem
2020-02-15 13:34:53 -07:00
parent 3e248bd186
commit 24a2a43a44
4 changed files with 44 additions and 12 deletions
@@ -79,6 +79,10 @@ public final class Constants {
public static final int SHOOTER_TIMEOUT_MS = 30;
public static final Gains SHOOTER_GAINS = new Gains(0.4, 0.0005, 13, 0.05, 0, 1.0);
//#Janky
public static final int SHOOTERROTATION_SPARK_ID = 9;
//#Janky
public static final double ENCODER_TICKS_PER_REV = 2048;
}
@@ -72,7 +72,11 @@ public class RobotContainer {
// continually sends updates to the Blinkin LED controller to keep the lights on
m_robotLED.setDefaultCommand(new RunCommand(() -> m_robotLED.updateLED(), m_robotLED));
// runs the drum shooter in idle mode
m_robotShooter.setDefaultCommand(new RunCommand(() -> m_robotShooter.runDrumShooter(0.15), m_robotShooter));
//#Janky
m_robotShooter.setDefaultCommand(new RunCommand(() -> m_robotShooter.runShooterWithInput(m_operatorXbox), m_robotShooter));
//#Janky
// drives the leveler with an axis input from the driver controller
m_robotLeveler.setDefaultCommand(new RunLevelerWithJoystick(m_robotLeveler, getDriverController()));
// runs storage motor at 50 percent
@@ -10,26 +10,36 @@ package frc4388.robot.subsystems;
import com.ctre.phoenix.motorcontrol.NeutralMode;
import com.ctre.phoenix.motorcontrol.TalonFXControlMode;
import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX;
import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkMax.IdleMode;
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc4388.robot.Gains;
import frc4388.robot.Constants.DriveConstants;
import frc4388.robot.Constants.ShooterConstants;
import frc4388.utility.controller.IHandController;
public class Shooter extends SubsystemBase {
public WPI_TalonFX m_shooterFalcon = new WPI_TalonFX(ShooterConstants.SHOOTER_FALCON_ID);
public static Gains m_shooterGains = ShooterConstants.SHOOTER_GAINS;
public static Shooter m_shooter;
public static IHandController m_controller;
double velP;
/**
double input;
public static CANSparkMax m_shooterRotate = new CANSparkMax(ShooterConstants.SHOOTERROTATION_SPARK_ID, MotorType.kBrushless);
/*
* Creates a new Shooter subsystem.
*/
public Shooter() {
m_shooterFalcon.configFactoryDefault();
m_shooterRotate.setIdleMode(IdleMode.kBrake);
m_shooterFalcon.setNeutralMode(NeutralMode.Coast);
m_shooterFalcon.setInverted(false);
@@ -86,4 +96,26 @@ public class Shooter extends SubsystemBase {
m_shooterFalcon.set(TalonFXControlMode.Velocity, targetVel); //Init PID
}
}
//PLZ Help I Have No Idea What I Am Doing
//Help PLZ
//I Am Desperate
//PLZ
//PLZ
//With A Cherry On Top
//#Janky
public void runShooterWithInput(IHandController controller) {
/* m_controller = controller;
input = controller.getLeftXAxis();
* System.err.println(input);
* m_shooterFalcon.set(TalonFXControlMode.PercentOutput, 0.3);
*/
input = controller.getLeftXAxis();
System.err.println(input);
m_shooterRotate.set(input);
}
//#Janky
}
@@ -15,7 +15,6 @@ import com.revrobotics.CANSparkMax;
import com.revrobotics.ControlType;
import com.revrobotics.SparkMax;
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
@@ -57,13 +56,6 @@ public class Storage extends SubsystemBase {
public void runStorage(final double input) {
m_storageMotor.set(input);
final boolean beam_on = m_beamSensors[0].get();
if (beam_on) {
System.err.println("Beam on");
} else {
System.err.println("Beam off");
}
}
public void resetEncoder()