mirror of
https://github.com/Team4388/To-Shoot-TShirt.git
synced 2026-06-08 16:28:07 -06:00
E
This commit is contained in:
@@ -44,4 +44,14 @@ public final class Constants {
|
||||
public static final int HORN_SOLENOID_ID = 0;
|
||||
//Todo: Change ID with new id on the robot
|
||||
}
|
||||
}
|
||||
public static final class ShooterConstants {
|
||||
public static final int SHOOTER_SOLENOID_0_ID = 1;
|
||||
public static final int SHOOTER_SOLENOID_1_ID = 2;
|
||||
public static final int SHOOTER_SOLENOID_2_ID = 3;
|
||||
public static final int SHOOTER_SOLENOID_3_ID = 4;
|
||||
public static final int SHOOTER_SOLENOID_4_ID = 5;
|
||||
public static final int SHOOTER_SOLENOID_5_ID = 6;
|
||||
public static final int SHOOTER_SOLENOID_6_ID = 7;
|
||||
public static final int SHOOTER_SOLENOID_7_ID = 8;
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,16 @@ public class RobotContainer {
|
||||
private final XboxController m_driverXbox = new XboxController(OIConstants.XBOX_DRIVER_ID);
|
||||
private final XboxController m_operatorXbox = new XboxController(OIConstants.XBOX_OPERATOR_ID);
|
||||
|
||||
private final Solenoid[] tubes = {
|
||||
m_robotMap.ShooterSolenoid0,
|
||||
m_robotMap.ShooterSolenoid1,
|
||||
m_robotMap.ShooterSolenoid2,
|
||||
m_robotMap.ShooterSolenoid3,
|
||||
m_robotMap.ShooterSolenoid4,
|
||||
m_robotMap.ShooterSolenoid5,
|
||||
m_robotMap.ShooterSolenoid6,
|
||||
m_robotMap.ShooterSolenoid7};
|
||||
|
||||
/**
|
||||
* The container for the robot. Contains subsystems, OI devices, and commands.
|
||||
*/
|
||||
@@ -67,19 +77,27 @@ public class RobotContainer {
|
||||
private void configureButtonBindings() {
|
||||
/* Driver Buttons */
|
||||
// test command to spin the robot while pressing A on the driver controller
|
||||
new JoystickButton(getDriverJoystick(), XboxController.A_BUTTON)
|
||||
/*new JoystickButton(getDriverJoystick(), XboxController.A_BUTTON)
|
||||
.whileHeld(() -> m_robotDrive.driveWithInput(0, 1));
|
||||
|
||||
*/
|
||||
/* Operator Buttons */
|
||||
// activates "Lit Mode"
|
||||
// activates ""🔥👌💯" Mode"™⁋
|
||||
/*
|
||||
new JoystickButton(getOperatorJoystick(), XboxController.A_BUTTON)
|
||||
.whenPressed(() -> m_robotLED.setPattern(LEDPatterns.LAVA_RAINBOW))
|
||||
.whenReleased(() -> m_robotLED.setPattern(LEDConstants.DEFAULT_PATTERN));
|
||||
|
||||
// BWAHHHHHHHHHHHH
|
||||
new JoystickButton(getOperatorJoystick(), XboxController.RIGHT_TRIGGER_AXIS)
|
||||
*/
|
||||
// Fire horn
|
||||
new JoystickButton(getOperatorJoystick(), XboxController.LEFT_TRIGGER_AXIS)
|
||||
.whenPressed(() -> m_robotHorn.hornSet(true))
|
||||
.whenReleased(() -> m_robotHorn.hornSet(false));
|
||||
|
||||
new JoystickButton(getOperatorJoystick(), XboxController.RIGHT_TRIGGER_AXIS)
|
||||
.whenPressed(() -> new ShootYourShot(true)) /*Fire one per once triger*/
|
||||
.whenReleased(() -> new ShootYourShot(false));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -70,6 +70,16 @@ public class RobotMap {
|
||||
leftBackMotor.setInverted(InvertType.FollowMaster);
|
||||
rightBackMotor.setInverted(InvertType.FollowMaster);
|
||||
}
|
||||
|
||||
/* Horn subsystem */
|
||||
public final Solenoid HornSolenoid = new Solenoid(HornConstants.HORN_SOLENOID_ID);
|
||||
}
|
||||
|
||||
/* Shooter subsystem */
|
||||
public final Solenoid ShooterSolenoid0 = new Solenoid(ShooterConstants.SHOOTER_SOLENOID_0_ID);
|
||||
public final Solenoid ShooterSolenoid1 = new Solenoid(ShooterConstants.SHOOTER_SOLENOID_1_ID);
|
||||
public final Solenoid ShooterSolenoid2 = new Solenoid(ShooterConstants.SHOOTER_SOLENOID_2_ID);
|
||||
public final Solenoid ShooterSolenoid3 = new Solenoid(ShooterConstants.SHOOTER_SOLENOID_3_ID);
|
||||
public final Solenoid ShooterSolenoid4 = new Solenoid(ShooterConstants.SHOOTER_SOLENOID_4_ID);
|
||||
public final Solenoid ShooterSolenoid5 = new Solenoid(ShooterConstants.SHOOTER_SOLENOID_5_ID);
|
||||
public final Solenoid ShooterSolenoid6 = new Solenoid(ShooterConstants.SHOOTER_SOLENOID_6_ID);
|
||||
public final Solenoid ShooterSolenoid7 = new Solenoid(ShooterConstants.SHOOTER_SOLENOID_7_ID);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
package frc4388.robot.commands;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||
|
||||
public class ShootYourShot extends CommandBase {
|
||||
private Solenoid[] m_solenoids = {};
|
||||
private int counter;
|
||||
|
||||
/** Creates a new ShootYourShot
|
||||
*. */
|
||||
public ShootYourShot(Solenoid[] solenoids) {
|
||||
m_solenoids = solenoids;
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
public void initialize() {}
|
||||
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
ShootTube.ShootTubeSet(m_solenoids[counter]);
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
counter += 1;
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -10,12 +10,13 @@ import edu.wpi.first.wbilib.Solnoid;
|
||||
|
||||
public class ShootTube extends SubsystemBase {
|
||||
/** Creates a new ShootTube. */
|
||||
public ShootTube() {
|
||||
m_solenoid = new solenoid(0);
|
||||
Solenoid m_solenoids;
|
||||
public ShootTube(Solenoid[] solenoids) {
|
||||
m_solenoids = solenoids;
|
||||
}
|
||||
|
||||
public void ShootTubeset(boolean arg) {
|
||||
m_solenoid.set(arg);
|
||||
public void ShootTubeSet(boolean arg, Solenoid tube) {
|
||||
tube.set(arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user