mirror of
https://github.com/Team4388/RiseOfRidgebotics2020.git
synced 2026-06-09 00:38:00 -06:00
Added Storage Manual and ButtonFox.java
This commit is contained in:
@@ -35,6 +35,7 @@ import frc4388.robot.commands.climber.RunClimberWithTriggers;
|
||||
import frc4388.robot.commands.climber.RunLevelerWithJoystick;
|
||||
import frc4388.robot.commands.drive.DriveStraightToPositionMM;
|
||||
import frc4388.robot.commands.drive.DriveWithJoystick;
|
||||
import frc4388.robot.commands.drive.PlaySongDrive;
|
||||
import frc4388.robot.commands.drive.TurnDegrees;
|
||||
import frc4388.robot.commands.intake.RunIntakeWithTriggers;
|
||||
import frc4388.robot.commands.shooter.CalibrateShooter;
|
||||
@@ -56,6 +57,7 @@ import frc4388.robot.subsystems.Shooter;
|
||||
import frc4388.robot.subsystems.ShooterAim;
|
||||
import frc4388.robot.subsystems.ShooterHood;
|
||||
import frc4388.robot.subsystems.Storage;
|
||||
import frc4388.utility.controller.ButtonFox;
|
||||
import frc4388.utility.controller.IHandController;
|
||||
import frc4388.utility.controller.XboxController;
|
||||
import frc4388.utility.controller.XboxTriggerButton;
|
||||
@@ -169,6 +171,9 @@ public class RobotContainer {
|
||||
new JoystickButton(getDriverJoystick(), XboxController.BACK_BUTTON)
|
||||
.whileHeld(new DisengageRachet(m_robotClimber));
|
||||
|
||||
|
||||
|
||||
|
||||
/* Operator Buttons */
|
||||
// shoots until released
|
||||
new JoystickButton(getOperatorJoystick(), XboxController.RIGHT_BUMPER_BUTTON)
|
||||
@@ -235,6 +240,35 @@ public class RobotContainer {
|
||||
.whileHeld(new ShootPrepGroup(m_robotShooter, m_robotShooterAim, m_robotShooterHood, m_robotStorage), false)
|
||||
//.whenReleased(new ManageStorage(m_robotStorage, StorageMode.RESET))
|
||||
.whenReleased(new InstantCommand(() -> m_robotLime.limeOff()));
|
||||
|
||||
|
||||
|
||||
|
||||
/* Button Fox */
|
||||
// Storage Manual
|
||||
new JoystickButton(getButtonFox(), ButtonFox.LEFT_SWITCH)
|
||||
.whileHeld(new ManageStorage(m_robotStorage, StorageMode.MANUAL))
|
||||
.whenReleased(new ManageStorage(m_robotStorage, StorageMode.RESET));
|
||||
|
||||
// Meg
|
||||
new JoystickButton(getButtonFox(), ButtonFox.MIDDLE_SWITCH)
|
||||
.whileHeld(new PlaySongDrive(m_robotDrive))
|
||||
.whenReleased(new InterruptSubystem(m_robotDrive));
|
||||
|
||||
// Shooter Manual
|
||||
new JoystickButton(getButtonFox(), ButtonFox.RIGHT_SWITCH)
|
||||
.whileHeld(new PlaySongDrive(m_robotDrive))
|
||||
.whenReleased(new InterruptSubystem(m_robotDrive));
|
||||
|
||||
// Goal Shooter Position
|
||||
new JoystickButton(getButtonFox(), ButtonFox.LEFT_BUTTON)
|
||||
.whileHeld(new PlaySongDrive(m_robotDrive))
|
||||
.whenReleased(new InterruptSubystem(m_robotDrive));
|
||||
|
||||
// Trench Shooter Position
|
||||
new JoystickButton(getButtonFox(), ButtonFox.RIGHT_BUTTON)
|
||||
.whileHeld(new PlaySongDrive(m_robotDrive))
|
||||
.whenReleased(new InterruptSubystem(m_robotDrive));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -339,6 +373,11 @@ public class RobotContainer {
|
||||
return m_operatorXbox;
|
||||
}
|
||||
|
||||
public IHandController getButtonFoxObject()
|
||||
{
|
||||
return m_buttonFox;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link edu.wpi.first.wpilibj.GenericHID#GenericHID(int) Generic HID} for the Operator Xbox Controller.
|
||||
* Generic HIDs/Joysticks can be used to set up JoystickButtons.
|
||||
@@ -358,4 +397,15 @@ public class RobotContainer {
|
||||
{
|
||||
return m_driverXbox.getJoyStick();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link edu.wpi.first.wpilibj.GenericHID#GenericHID(int) Generic HID} for the Button Fox.
|
||||
* Generic HIDs/Joysticks can be used to set up JoystickButtons.
|
||||
* @return The IHandController interface for the Button Fox.
|
||||
*/
|
||||
public Joystick getButtonFox()
|
||||
{
|
||||
return m_buttonFox.getJoyStick();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ManageStorage extends CommandBase {
|
||||
/* Used for intaking a ball. Keeps track off when the 2nd ball in storage has moved */
|
||||
boolean m_isStorageEmpty = true;
|
||||
|
||||
public enum StorageMode{IDLE, INTAKE, RESET};
|
||||
public enum StorageMode{IDLE, INTAKE, RESET, MANUAL};
|
||||
StorageMode m_storageMode = StorageMode.IDLE;
|
||||
|
||||
/**
|
||||
@@ -74,6 +74,8 @@ public class ManageStorage extends CommandBase {
|
||||
runIntake();
|
||||
} else if (m_storageMode == StorageMode.RESET) {
|
||||
runReset();
|
||||
} else if (m_storageMode == StorageMode.MANUAL) {
|
||||
runManual();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,6 +129,13 @@ public class ManageStorage extends CommandBase {
|
||||
m_isStorageEmpty = !m_isBallInStorage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches Storage to Manual only
|
||||
*/
|
||||
private void runManual() {
|
||||
m_storage.runStorage(0);
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
package frc4388.utility.controller;
|
||||
|
||||
/**
|
||||
* button fox
|
||||
* @author Ryan Manley
|
||||
*/
|
||||
public class ButtonFox {
|
||||
public static final int RIGHT_SWITCH = 1;
|
||||
public static final int MIDDLE_SWITCH = 2;
|
||||
public static final int LEFT_SWITCH = 3;
|
||||
public static final int RIGHT_BUTTON = 4;
|
||||
public static final int LEFT_BUTTON = 5;
|
||||
}
|
||||
Reference in New Issue
Block a user