Even More Janky Code

Storage
This commit is contained in:
Sebastian
2020-02-15 16:01:28 -08:00
parent 0cf61e1893
commit 57cc8a26e6
3 changed files with 23 additions and 14 deletions
@@ -79,9 +79,8 @@ public class RobotContainer {
m_robotShooter.setDefaultCommand(new RunCommand(() -> m_robotShooter.runDrumShooter(0.15), m_robotShooter));
// 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
m_robotStorage.setDefaultCommand(new RunCommand(() -> m_robotStorage.runStorage(0.0), m_robotStorage));
}
/**
* Use this method to define your button->command mappings. Buttons can be created by
@@ -139,8 +138,13 @@ public class RobotContainer {
new JoystickButton(getOperatorJoystick(), XboxController.A_BUTTON)
.whileHeld(new RunCommand(() -> m_robotStorage.runStoragePositionPID(0.5)));
//Prepares storage for intaking
new JoystickButton(getOperatorJoystick(), XboxController.LEFT_TRIGGER_AXIS)
.whileHeld(new RunCommand(() -> m_robotStorage.storageIntake()));
.whileHeld(new RunCommand(() -> m_robotStorage.storageIntake(m_robotIntake)));
//Runs storage to outtake
new JoystickButton(getOperatorJoystick(), XboxController.RIGHT_TRIGGER_AXIS)
.whileHeld(new RunCommand(() -> m_robotStorage.storageOuttake()));
}
/**
@@ -17,16 +17,20 @@ import edu.wpi.first.wpilibj.Spark;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc4388.robot.Constants.IntakeConstants;
public class Intake extends SubsystemBase {
CANSparkMax m_intakeMotor = new CANSparkMax(IntakeConstants.INTAKE_SPARK_ID, MotorType.kBrushless);
CANSparkMax m_extenderMotor = new CANSparkMax(IntakeConstants.EXTENDER_SPARK_ID, MotorType.kBrushless);
CANDigitalInput m_extenderForwardLimit;
CANDigitalInput m_extenderReverseLimit;
/**
* Creates a new Intake.
*/
public Intake() {
CANDigitalInput m_extenderForwardLimit;
CANDigitalInput m_extenderReverseLimit;
m_intakeMotor.restoreFactoryDefaults();
m_extenderMotor.restoreFactoryDefaults();
@@ -50,7 +54,7 @@ public class Intake extends SubsystemBase {
* Runs intake motor
* @param input the percent output to run motor at
*/
public void runIntake(double input) {
public void runIntake(final double input) {
m_intakeMotor.set(input);
}
@@ -58,7 +62,7 @@ public class Intake extends SubsystemBase {
* Runs extender motor
* @param input the percent output to run motor at
*/
public void runExtender(double input) {
public void runExtender(final double input) {
m_extenderMotor.set(input);
}
}
@@ -9,12 +9,14 @@ package frc4388.robot.subsystems;
import com.ctre.phoenix.motorcontrol.can.TalonSRX;
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
import com.revrobotics.CANDigitalInput;
import com.revrobotics.CANEncoder;
import com.revrobotics.CANPIDController;
import com.revrobotics.CANSparkMax;
import com.revrobotics.ControlType;
import com.revrobotics.SparkMax;
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
import com.revrobotics.CANDigitalInput.LimitSwitchPolarity;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.Encoder;
@@ -95,7 +97,6 @@ public class Storage extends SubsystemBase {
m_storageMotor.set(0);
}
}
public void storageIntake(Intake intake) {
m_intake = intake;
if (m_beamSensors[1].get() == false){
@@ -110,11 +111,11 @@ public void storageIntake(Intake intake) {
}
}
public void storageOuttake() {
m_storageMotor.set(1);
m_storageMotor.set(1);
/*
*If shooting move storage motor until top sensor is tripped
*If intaking move storage motor until bottom sensor is tripped
*/
}
/*
*If shooting move storage motor until top sensor is tripped
*If intaking move storage motor until bottom sensor is tripped
*
*/
}