mirror of
https://github.com/Team4388/To-Shoot-TShirt.git
synced 2026-06-09 00:38:05 -06:00
USB edition Digital Deluxe
This commit is contained in:
@@ -1,2 +1,2 @@
|
|||||||
# Robot-Essentials
|
# To-Shoot-TShirt
|
||||||
Basic code for any Ridgebotics robot project
|
Code to shoot any small and light object out of a barrel on the T-shirt cannon robot.
|
||||||
@@ -54,4 +54,8 @@ public final class Constants {
|
|||||||
public static final int SHOOTER_SOLENOID_6_ID = 7;
|
public static final int SHOOTER_SOLENOID_6_ID = 7;
|
||||||
public static final int SHOOTER_SOLENOID_7_ID = 8;
|
public static final int SHOOTER_SOLENOID_7_ID = 8;
|
||||||
}
|
}
|
||||||
|
public static final class DebugConstants {
|
||||||
|
public static final boolean SHOW_INFO = true;
|
||||||
|
public static final Str TYPE_INFO = "INFO";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
/* Dumb Command Version, Smart Subsytem Version */
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
|
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
|
||||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||||
@@ -54,6 +53,7 @@ public class RobotContainer {
|
|||||||
|
|
||||||
private final ShootTube m_robotShooter = new ShootTube(SolenoidArray);
|
private final ShootTube m_robotShooter = new ShootTube(SolenoidArray);
|
||||||
|
|
||||||
|
private final DPrinter m_debugLogger = m_robotMap.DPrinter
|
||||||
/* Controllers */
|
/* Controllers */
|
||||||
private final XboxController m_driverXbox = new XboxController(OIConstants.XBOX_DRIVER_ID);
|
private final XboxController m_driverXbox = new XboxController(OIConstants.XBOX_DRIVER_ID);
|
||||||
private final XboxController m_operatorXbox = new XboxController(OIConstants.XBOX_OPERATOR_ID);
|
private final XboxController m_operatorXbox = new XboxController(OIConstants.XBOX_OPERATOR_ID);
|
||||||
@@ -117,6 +117,10 @@ public class RobotContainer {
|
|||||||
.whenPressed(() -> m_robotShooter.ShootTubeALL(true))
|
.whenPressed(() -> m_robotShooter.ShootTubeALL(true))
|
||||||
.whenReleased(() -> m_robotShooter.ShootTubeALL(false));
|
.whenReleased(() -> m_robotShooter.ShootTubeALL(false));
|
||||||
|
|
||||||
|
/* Just A test of the DPrint object */
|
||||||
|
new JoystickButton(getOperatorJoystick(), XboxController.B_BUTTON)
|
||||||
|
.whenPressed(() -> m_debugLogger.println("This is a Debug Message"));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import frc4388.robot.Constants.DriveConstants;
|
|||||||
import frc4388.robot.Constants.HornConstants;
|
import frc4388.robot.Constants.HornConstants;
|
||||||
import frc4388.robot.Constants.LEDConstants;
|
import frc4388.robot.Constants.LEDConstants;
|
||||||
import frc4388.utility.RobotGyro;
|
import frc4388.utility.RobotGyro;
|
||||||
|
import frc4388.utility.DPrint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines and holds all I/O objects on the Roborio. This is useful for unit
|
* Defines and holds all I/O objects on the Roborio. This is useful for unit
|
||||||
@@ -82,4 +83,7 @@ public class RobotMap {
|
|||||||
public final Solenoid ShooterSolenoid5 = new Solenoid(ShooterConstants.SHOOTER_SOLENOID_5_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 ShooterSolenoid6 = new Solenoid(ShooterConstants.SHOOTER_SOLENOID_6_ID);
|
||||||
public final Solenoid ShooterSolenoid7 = new Solenoid(ShooterConstants.SHOOTER_SOLENOID_7_ID);
|
public final Solenoid ShooterSolenoid7 = new Solenoid(ShooterConstants.SHOOTER_SOLENOID_7_ID);
|
||||||
|
|
||||||
|
/* DPrint Utility */
|
||||||
|
public final DPrint DPrinter = new DPrint(DebugConstants.TYPE_INFO);
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
/* Dumb Command Version, Smart Subsytem Version */
|
|
||||||
// Copyright (c) FIRST and other WPILib contributors.
|
// Copyright (c) FIRST and other WPILib contributors.
|
||||||
// Open Source Software; you can modify and/or share it under the terms of
|
// 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.
|
// the WPILib BSD license file in the root directory of this project.
|
||||||
|
|
||||||
|
/* This Command has been gutted. Like a fish */
|
||||||
package frc4388.robot.commands;
|
package frc4388.robot.commands;
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
/* Dumb Command Version, Smart Subsytem Version */
|
|
||||||
// Copyright (c) FIRST and other WPILib contributors.
|
// Copyright (c) FIRST and other WPILib contributors.
|
||||||
// Open Source Software; you can modify and/or share it under the terms of
|
// 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.
|
// the WPILib BSD license file in the root directory of this project.
|
||||||
@@ -6,11 +5,12 @@
|
|||||||
package frc4388.robot.subsystems;
|
package frc4388.robot.subsystems;
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
|
import frc4388.utility.DPrint;
|
||||||
|
import frc4388.robot.Constants.DebugConstants;
|
||||||
import edu.wpi.first.wbilib.Solnoid;
|
import edu.wpi.first.wbilib.Solnoid;
|
||||||
|
|
||||||
|
DPrint DPrinter = new DPrint(DebugConstants.TYPE_INFO)
|
||||||
public class ShootTube extends SubsystemBase {
|
public class ShootTube extends SubsystemBase {
|
||||||
/** Creates a new ShootTube. */
|
|
||||||
Solenoid[] m_solenoids;
|
Solenoid[] m_solenoids;
|
||||||
int m_cycleCount = 0;
|
int m_cycleCount = 0;
|
||||||
int m_maxCount;
|
int m_maxCount;
|
||||||
@@ -19,39 +19,52 @@ public class ShootTube extends SubsystemBase {
|
|||||||
m_maxCount = m_solenoids.length;
|
m_maxCount = m_solenoids.length;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Functions designed for the DPAD left and right buttions to
|
Functions designed for the Left and Right Bumpers to
|
||||||
Cycle the tube to be shooting out of
|
Cycle the tube slected manualy.
|
||||||
*/
|
*/
|
||||||
public void CycleUp() {
|
public void CycleUp() {
|
||||||
m_cycleCount++;
|
m_cycleCount++;
|
||||||
if (m_cycleCount >= m_maxCount || m_cycleCount < 0) {
|
if (m_cycleCount >= m_maxCount || m_cycleCount < 0) {
|
||||||
m_cycleCount = 0;
|
m_cycleCount = 0;
|
||||||
}
|
}
|
||||||
|
DPrinter.println("Current CycleCount: "+m_cycleCount)
|
||||||
}
|
}
|
||||||
public void CycleDown() {
|
public void CycleDown() {
|
||||||
m_cycleCount--;
|
m_cycleCount--;
|
||||||
if (m_cycleCount >= m_maxCount || m_cycleCount < 0) {
|
if (m_cycleCount >= m_maxCount || m_cycleCount < 0) {
|
||||||
m_cycleCount = 0;
|
m_cycleCount = 0;
|
||||||
}
|
}
|
||||||
|
DPrinter.println("Current CycleCount: "+m_cycleCount)
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Normal Shoot Tube and Normal Shoot Tube Index Functions
|
Normal Shoot Tube and Normal Shoot Tube Index Functions
|
||||||
*/
|
*/
|
||||||
|
/* Function "ShootTubeSet" cycles up automaticly */
|
||||||
public void ShootTubeSet(Boolean arg) {
|
public void ShootTubeSet(Boolean arg) {
|
||||||
m_solenoids[CycleCount].set(arg);
|
m_solenoids[CycleCount].set(arg);
|
||||||
|
/* If closing valve:
|
||||||
|
Increse the CycleCount by one,
|
||||||
|
if the CycleCount >= the length of the array OR CycleCount < 0:
|
||||||
|
set CycleCount to 0 */
|
||||||
if (arg == false) {
|
if (arg == false) {
|
||||||
CycleCount++;
|
m_cycleCount++;
|
||||||
if (m_cycleCount >= m_maxCount || m_cycleCount < 0) {
|
if (m_cycleCount >= m_maxCount || m_cycleCount < 0) {
|
||||||
m_cycleCount = 0;
|
m_cycleCount = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DPrinter.println("Current CycleCount: "+m_cycleCount)
|
||||||
}
|
}
|
||||||
|
/* Function "ShootTubeIndex" won't cycle up automaticly */
|
||||||
|
/* Not used, yet Useful */
|
||||||
public void ShootTubeIndex(Boolean arg, int i) {
|
public void ShootTubeIndex(Boolean arg, int i) {
|
||||||
m_solenoids[i].set(arg);
|
m_solenoids[i].set(arg);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Just Normal Shoot Tube But it Shoots all of the tubes
|
Just Normal Shoot Tube But it Shoots all of the tubes
|
||||||
Designed for DPAD Down
|
in the array in enumeration
|
||||||
|
can't do m_solenoids[1].set(true), m_solenoids[2].set(true) due to
|
||||||
|
the fact that the object needs to be variable in the length of the array
|
||||||
|
Designed for the X buttion
|
||||||
*/
|
*/
|
||||||
public void ShootTubeALL(Boolean arg) {
|
public void ShootTubeALL(Boolean arg) {
|
||||||
for (Solenoid x : m_solenoids) {
|
for (Solenoid x : m_solenoids) {
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/* Simple Debug Log To Console Utility. */
|
||||||
|
package frc4388.utility;
|
||||||
|
|
||||||
|
import frc4388.robot.Constants.DebugConstants;
|
||||||
|
|
||||||
|
public class DPrint {
|
||||||
|
str m_debugMsgType = DebugConstants.TYPE_INFO;
|
||||||
|
public DPrint(str type) {
|
||||||
|
m_debugMsgType = type;
|
||||||
|
}
|
||||||
|
public println(str[] mesage) {
|
||||||
|
switch (m_debugMsgType) {
|
||||||
|
case DebugConstants.TYPE_INFO:
|
||||||
|
if (DebugConstants.SHOW_INFO) {
|
||||||
|
system.out.println("Debug_INFO: "+mesage);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
default:
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public print(str[] mesage) {
|
||||||
|
switch (m_debugMsgType) {
|
||||||
|
case DebugConstants.TYPE_INFO:
|
||||||
|
if (DebugConstants.SHOW_INFO) {
|
||||||
|
system.out.print("Debug_INFO: "+mesage);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
default:
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user