diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..61f25ce --- /dev/null +++ b/.gitignore @@ -0,0 +1,160 @@ +# Created by https://www.gitignore.io/api/c++,java,linux,macos,gradle,windows,visualstudiocode + +### C++ ### +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +### Java ### +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### Gradle ### +.gradle +/build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Cache of project +.gradletasknamecache + +# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 +# gradle/wrapper/gradle-wrapper.properties + +# # VS Code Specific Java Settings +.classpath +.project +.settings/ +bin/ + + +# End of https://www.gitignore.io/api/c++,java,linux,macos,gradle,windows,visualstudiocode diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..c9c9713 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,21 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + + { + "type": "wpilib", + "name": "WPILib Desktop Debug", + "request": "launch", + "desktop": true, + }, + { + "type": "wpilib", + "name": "WPILib roboRIO Debug", + "request": "launch", + "desktop": false, + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..dc084a0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,13 @@ +{ + "java.configuration.updateBuildConfiguration": "automatic", + "files.exclude": { + "**/.git": true, + "**/.svn": true, + "**/.hg": true, + "**/CVS": true, + "**/.DS_Store": true, + "bin/": true, + ".classpath": true, + ".project": true + } +} diff --git a/.wpilib/wpilib_preferences.json b/.wpilib/wpilib_preferences.json new file mode 100644 index 0000000..f38eecb --- /dev/null +++ b/.wpilib/wpilib_preferences.json @@ -0,0 +1,6 @@ +{ + "enableCppIntellisense": false, + "currentLanguage": "java", + "projectYear": "2019", + "teamNumber": 2554 +} \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..ef15cb6 --- /dev/null +++ b/build.gradle @@ -0,0 +1,64 @@ +plugins { + id "java" + id "edu.wpi.first.GradleRIO" version "2019.4.1" +} + +sourceCompatibility = JavaVersion.VERSION_11 +targetCompatibility = JavaVersion.VERSION_11 + +def ROBOT_MAIN_CLASS = "frc.robot.Main" + +// Define my targets (RoboRIO) and artifacts (deployable files) +// This is added by GradleRIO's backing project EmbeddedTools. +deploy { + targets { + roboRIO("roborio") { + // Team number is loaded either from the .wpilib/wpilib_preferences.json + // or from command line. If not found an exception will be thrown. + // You can use getTeamOrDefault(team) instead of getTeamNumber if you + // want to store a team number in this file. + team = frc.getTeamNumber() + } + } + artifacts { + frcJavaArtifact('frcJava') { + targets << "roborio" + // Debug can be overridden by command line, for use with VSCode + debug = frc.getDebugOrDefault(false) + } + // Built in artifact to deploy arbitrary files to the roboRIO. + fileTreeArtifact('frcStaticFileDeploy') { + // The directory below is the local directory to deploy + files = fileTree(dir: 'src/main/deploy') + // Deploy to RoboRIO target, into /home/lvuser/deploy + targets << "roborio" + directory = '/home/lvuser/deploy' + } + } +} + +// Set this to true to enable desktop support. +def includeDesktopSupport = false + +// Maven central needed for JUnit +repositories { + mavenCentral() +} + +// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. +// Also defines JUnit 4. +dependencies { + compile wpi.deps.wpilib() + compile wpi.deps.vendor.java() + nativeZip wpi.deps.vendor.jni(wpi.platforms.roborio) + nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop) + testCompile 'junit:junit:4.12' +} + +// Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') +// in order to make them all available at runtime. Also adding the manifest so WPILib +// knows where to look for our Robot Class. +jar { + from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } + manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..457aad0 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..d08253c --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=permwrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=permwrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..af6708f --- /dev/null +++ b/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..6d57edc --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..b0f4d48 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,25 @@ +import org.gradle.internal.os.OperatingSystem + +pluginManagement { + repositories { + mavenLocal() + gradlePluginPortal() + String frcYear = '2019' + File frcHome + if (OperatingSystem.current().isWindows()) { + String publicFolder = System.getenv('PUBLIC') + if (publicFolder == null) { + publicFolder = "C:\\Users\\Public" + } + frcHome = new File(publicFolder, "frc${frcYear}") + } else { + def userFolder = System.getProperty("user.home") + frcHome = new File(userFolder, "frc${frcYear}") + } + def frcHomeMaven = new File(frcHome, 'maven') + maven { + name 'frcHome' + url frcHomeMaven + } + } +} diff --git a/src/main/deploy/example.txt b/src/main/deploy/example.txt new file mode 100644 index 0000000..bb82515 --- /dev/null +++ b/src/main/deploy/example.txt @@ -0,0 +1,3 @@ +Files placed in this directory will be deployed to the RoboRIO into the +'deploy' directory in the home folder. Use the 'Filesystem.getDeployDirectory' wpilib function +to get a proper path relative to the deploy directory. \ No newline at end of file diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java new file mode 100644 index 0000000..c29ac22 --- /dev/null +++ b/src/main/java/frc/robot/Constants.java @@ -0,0 +1,59 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) 2018 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 frc.robot; + +/** + * Add your docs here. + */ +public class Constants { + + // Winch Holding Power + final public static double WINCH_HOLDING_POWER = 0.05; + + final public static double ACTUATOR_SPEED = 0.5; + + // IR Sensor PID Constants + + final public static double IR_KP = 25; + final public static double IR_KI = 0; + final public static double IR_KD = 15; + + /** + * Which PID slot to pull gains from. Starting 2018, you can choose from 0,1,2 + * or 3. Only the first two (0,1) are visible in web-based configuration. + */ + public static final int kSlotIdx = 0; + + /** + * Talon SRX/ Victor SPX will supported multiple (cascaded) PID loops. For now + * we just want the primary one. + */ + public static final int kPIDLoopIdx = 0; + + /** + * Set to zero to skip waiting for confirmation, set to nonzero to wait and + * report to DS if action fails. + */ + public static final int kTimeoutMs = 30; + + /** + * PID Gains may have to be adjusted based on the responsiveness of control + * loop. kF: 1023 represents output value to Talon at 100%, 7200 represents + * Velocity units at 100% output + * + * kP kI kD kF Iz PeakOut + */ + public final static Gains kFrontLeft_Gains_Velocity = new Gains(.11333, 0.001, 20, .1097, 300, 1.00); + public final static Gains kFrontRight_Gains_Velocity = new Gains(0.11333, 0.001, 20, .1097, 300, 1.00); + public final static Gains kBackLeft_Gains_Velocity = new Gains(0.11333, 0.001, 20, .1097, 300, 1.00); + public final static Gains kBackRight_Gains_Velocity = new Gains(0.11333, 0.001, 20, .1097, 300, 1.00); + + public final static Gains[] velocityGains = { kFrontLeft_Gains_Velocity, kFrontRight_Gains_Velocity, + kBackLeft_Gains_Velocity, kBackRight_Gains_Velocity }; + +} diff --git a/src/main/java/frc/robot/Gains.java b/src/main/java/frc/robot/Gains.java new file mode 100644 index 0000000..328e6eb --- /dev/null +++ b/src/main/java/frc/robot/Gains.java @@ -0,0 +1,29 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) 2018 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 frc.robot; + +/** + * Add your docs here. + */ +public class Gains { + public final double kP; + public final double kI; + public final double kD; + public final double kF; + public final int kIzone; + public final double kPeakOutput; + + public Gains(double _kP, double _kI, double _kD, double _kF, int _kIzone, double _kPeakOutput) { + kP = _kP; + kI = _kI; + kD = _kD; + kF = _kF; + kIzone = _kIzone; + kPeakOutput = _kPeakOutput; + } +} diff --git a/src/main/java/frc/robot/Main.java b/src/main/java/frc/robot/Main.java new file mode 100644 index 0000000..5b3238a --- /dev/null +++ b/src/main/java/frc/robot/Main.java @@ -0,0 +1,29 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) 2018 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 frc.robot; + +import edu.wpi.first.wpilibj.RobotBase; + +/** + * Do NOT add any static variables to this class, or any initialization at all. + * Unless you know what you are doing, do not modify this file except to + * change the parameter class to the startRobot call. + */ +public final class Main { + private Main() { + } + + /** + * Main initialization function. Do not perform any initialization here. + * + *
If you change your main robot class, change the parameter type.
+ */
+ public static void main(String... args) {
+ RobotBase.startRobot(Robot::new);
+ }
+}
diff --git a/src/main/java/frc/robot/OI.java b/src/main/java/frc/robot/OI.java
new file mode 100644
index 0000000..77e4ec1
--- /dev/null
+++ b/src/main/java/frc/robot/OI.java
@@ -0,0 +1,177 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2017-2018 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 frc.robot;
+
+import edu.wpi.first.wpilibj.Joystick;
+import edu.wpi.first.wpilibj.buttons.JoystickButton;
+import frc.robot.commands.ToggleCommand;
+import frc.robot.commands.BackClimbActuator.BackClimbDown;
+import frc.robot.commands.BackClimbActuator.BackClimbUp;
+import frc.robot.commands.BackClimbActuator.ClimbBackward;
+import frc.robot.commands.BackClimbActuator.ClimbForward;
+import frc.robot.commands.Camera.EnableCameraOne;
+import frc.robot.commands.Camera.EnableCameraZero;
+import frc.robot.commands.DriveTrain.RotateToAngle;
+import frc.robot.commands.FrontClimbActuator.FrontClimbDown;
+import frc.robot.commands.FrontClimbActuator.FrontClimbUp;
+import frc.robot.commands.Hatch.HatchIn;
+import frc.robot.commands.Hatch.HatchOut;
+import frc.robot.commands.Shooter.CaptureBall;
+import frc.robot.commands.Shooter.ShootBall;
+import frc.robot.commands.Shooter.ShooterIn;
+import frc.robot.commands.Shooter.ShooterOut;
+import frc.robot.commands.Winch.MoveWinchDown;
+import frc.robot.commands.Winch.MoveWinchUp;
+
+/**
+ * This class is the glue that binds the controls on the physical operator
+ * interface to the commands and command groups that allow control of the robot.
+ */
+public class OI {
+ //// CREATING BUTTONS
+ // One type of button is a joystick button which is any button on a
+ //// joystick.
+ // You create one by telling it which joystick it's on and which button
+ // number it is.
+ // Joystick stick = new Joystick(port);
+ // Button button = new JoystickButton(stick, buttonNumber);
+
+ // There are a few additional built in buttons you can use. Additionally,
+ // by subclassing Button you can create custom triggers and bind those to
+ // commands the same as any other Button.
+
+ //// TRIGGERING COMMANDS WITH BUTTONS
+ // Once you have a button, it's trivial to bind it to a button in one of
+ // three ways:
+
+ // Start the command when the button is pressed and let it run the command
+ // until it is finished as determined by it's isFinished method.
+ // button.whenPressed(new ExampleCommand());
+
+ // Run the command while the button is being held down and interrupt it once
+ // the button is released.
+ // button.whileHeld(new ExampleCommand());
+
+ // Start the command when the button is released and let it run the command
+ // until it is finished as determined by it's isFinished method.
+ // button.whenReleased(new ExampleCommand());
+
+ // Joystick ID
+ final public static int DRIVE_JOYSTICK_ID = 0;
+ final public static int ACTION_JOYSTICK_ID = 1;
+
+ // Moving the Winch Buttons
+ final public static int MOVE_WINCH_UP_BUTTON_ID = 5;
+ final public static int MOVE_WINCH_DOWN_BUTTON_ID = 3;
+
+ // Winch comands for actionstick
+ final public static int MOVE_WINCH_UP_BUTTON_ID_ACTIONSTICK = 11;
+ final public static int MOVE_WINCH_DOWN_BUTTON_ID_ACTIONSTICK = 12;
+
+ // Controlling the Shooter Buttons
+ final public static int CAPTURE_BALL_BUTTON_ID = 1;
+ final public static int SHOOT_BALL_BUTTON_ID = 1;
+
+ // Enabling full drivetrain speed
+ final public static int BOOST_MODE_BUTTON_ID = 2;
+
+ // Controlling the Hatch Button
+ final public static int TOGGLE_HATCH_ID = 2;
+
+ // Controlling the Ball Shooter Actuator
+ // final public static int TOGGLE_SHOOTER_ID = 2;
+
+ // Controlling the Front Climb Actuator
+ final public static int FRONT_CLIMB_UP_ID = 10;
+ final public static int FRONT_CLIMB_DOWN_ID = 6;
+
+ // Controlling the Back Climb Actuator
+ final public static int BACK_CLIMB_UP_ID = 9;
+ final public static int BACK_CLIMB_DOWN_ID = 5; // Actuator goes down
+
+ // Controlling both Climb Actuators
+ final public static int CLIMB_UP_ID = 7;
+ final public static int CLIMB_DOWN_ID = 8;
+
+ // Controlling the Wheel on the Back Climb Actuator
+ final public static int CLIMB_MOTOR_FORWARD_ID = 4;
+ final public static int CLIMB_MOTOR_BACKWARD_ID = 3;
+
+ final public static int TOGGLE_CAMERA_0_ID = 7;
+ final public static int TOGGLE_CAMERA_1_ID = 8;
+
+ final public static int YEET_FORWARD_ID = 0; /// Temporary
+
+ // Controlling Drive Train to turn on JoyStick
+ final public static int TURN_DRIVETRAIN = 1;
+
+ public static Joystick driveJoystick = new Joystick(DRIVE_JOYSTICK_ID);
+ public static Joystick actionJoystick = new Joystick(ACTION_JOYSTICK_ID);
+
+ JoystickButton turn90 = new JoystickButton(driveJoystick, TURN_DRIVETRAIN);
+
+ JoystickButton moveWinchUp = new JoystickButton(driveJoystick, MOVE_WINCH_DOWN_BUTTON_ID);// final
+ JoystickButton moveWinchDown = new JoystickButton(driveJoystick, MOVE_WINCH_UP_BUTTON_ID);// final
+
+ JoystickButton captureBall = new JoystickButton(driveJoystick, CAPTURE_BALL_BUTTON_ID);// final
+ JoystickButton shootBall = new JoystickButton(actionJoystick, SHOOT_BALL_BUTTON_ID);// final
+
+ public static JoystickButton boostMode = new JoystickButton(driveJoystick, BOOST_MODE_BUTTON_ID);
+
+ JoystickButton toggleHatch = new JoystickButton(actionJoystick, TOGGLE_HATCH_ID);
+
+ // JoystickButton toggleShooter = new JoystickButton(actionJoystick,
+ // TOGGLE_SHOOTER_ID);
+
+ JoystickButton frontRetract = new JoystickButton(actionJoystick, FRONT_CLIMB_UP_ID);
+ JoystickButton frontExtend = new JoystickButton(actionJoystick, FRONT_CLIMB_DOWN_ID);
+
+ JoystickButton winch_up = new JoystickButton(actionJoystick, MOVE_WINCH_UP_BUTTON_ID_ACTIONSTICK);
+ JoystickButton winch_down = new JoystickButton(actionJoystick, MOVE_WINCH_DOWN_BUTTON_ID_ACTIONSTICK);
+
+ JoystickButton backRetract = new JoystickButton(actionJoystick, BACK_CLIMB_UP_ID);
+ JoystickButton backExtend = new JoystickButton(actionJoystick, BACK_CLIMB_DOWN_ID);
+
+ JoystickButton climbMotorForward = new JoystickButton(actionJoystick, CLIMB_MOTOR_FORWARD_ID);
+ JoystickButton climbMotorBackward = new JoystickButton(actionJoystick, CLIMB_MOTOR_BACKWARD_ID);
+
+ JoystickButton retractBoth = new JoystickButton(actionJoystick, CLIMB_UP_ID);
+ JoystickButton extendBoth = new JoystickButton(actionJoystick, CLIMB_DOWN_ID);
+
+ JoystickButton toggleCamera0 = new JoystickButton(driveJoystick, TOGGLE_CAMERA_0_ID);
+ JoystickButton toggleCamera1 = new JoystickButton(driveJoystick, TOGGLE_CAMERA_1_ID);
+
+ public OI() {
+
+ captureBall.whileHeld(new CaptureBall());
+ shootBall.whileHeld(new ShootBall());
+
+ toggleHatch.whenPressed(new ToggleCommand(new HatchIn(), new HatchOut()));
+
+ frontRetract.whileHeld(new FrontClimbUp());
+ frontExtend.whileHeld(new FrontClimbDown());
+
+ backRetract.whileHeld(new BackClimbUp()); // acutator goes up
+ backExtend.whileHeld(new BackClimbDown()); // actuator goes down
+
+ climbMotorForward.whileHeld(new ClimbForward());
+ climbMotorBackward.whileHeld(new ClimbBackward());
+
+ retractBoth.whileHeld(new FrontClimbUp());
+ retractBoth.whileHeld(new BackClimbUp());
+
+ extendBoth.whileHeld(new FrontClimbDown());
+ extendBoth.whileHeld(new BackClimbDown());
+
+ // turn90.whileHeld(new RotateToAngle(70));
+ winch_down.whileHeld(new MoveWinchDown());
+ winch_up.whileHeld(new MoveWinchUp());
+
+ }
+
+}
diff --git a/src/main/java/frc/robot/Robot.java b/src/main/java/frc/robot/Robot.java
new file mode 100644
index 0000000..c5c74b2
--- /dev/null
+++ b/src/main/java/frc/robot/Robot.java
@@ -0,0 +1,208 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2017-2018 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 frc.robot;
+
+import org.opencv.core.Mat;
+
+import edu.wpi.cscore.CvSink;
+import edu.wpi.cscore.CvSource;
+import edu.wpi.cscore.UsbCamera;
+import edu.wpi.cscore.VideoSink;
+import edu.wpi.first.cameraserver.CameraServer;
+import edu.wpi.first.networktables.NetworkTable;
+import edu.wpi.first.networktables.NetworkTableInstance;
+import edu.wpi.first.wpilibj.TimedRobot;
+import edu.wpi.first.wpilibj.command.Command;
+import edu.wpi.first.wpilibj.command.Scheduler;
+import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
+import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
+import frc.robot.subsystems.*;
+
+/**
+ * The VM is configured to automatically run this class, and to call the
+ * functions corresponding to each mode, as described in the TimedRobot
+ * documentation. If you change the name of this class or the package after
+ * creating this project, you must also update the build.gradle file in the
+ * project.
+ */
+public class Robot extends TimedRobot {
+
+ public static Hatch hatch = new Hatch();
+ public static BallShooter ballShooter = new BallShooter();
+ public static Winch winch = new Winch();
+ public static DriveTrain driveTrain = new DriveTrain();
+ public static BackClimbActuator backClimbActuator = new BackClimbActuator();
+ public static FrontClimbActuator frontClimbActuator = new FrontClimbActuator();
+
+ public static OI m_oi = new OI();
+
+ public static UsbCamera camera0;
+ public static UsbCamera camera1;
+ public static VideoSink server;
+
+ Command m_autonomousCommand;
+ SendableChooser
+ * This runs after the mode specific periodic functions, but before LiveWindow
+ * and SmartDashboard integrated updating.
+ */
+ @Override
+ public void robotPeriodic() {
+ }
+
+ /**
+ * This function is called once each time the robot enters Disabled mode. You
+ * can use it to reset any subsystem information you want to clear when the
+ * robot is disabled.
+ */
+ @Override
+ public void disabledInit() {
+ }
+
+ @Override
+ public void disabledPeriodic() {
+ Scheduler.getInstance().run();
+ }
+
+ /**
+ * This autonomous (along with the chooser code above) shows how to select
+ * between different autonomous modes using the dashboard. The sendable chooser
+ * code works with the Java SmartDashboard. If you prefer the LabVIEW Dashboard,
+ * remove all of the chooser code and uncomment the getString code to get the
+ * auto name from the text box below the Gyro
+ *
+ *
+ * You can add additional auto modes by adding additional commands to the
+ * chooser code above (like the commented example) or additional comparisons to
+ * the switch structure below with additional strings & commands.
+ */
+ @Override
+ public void autonomousInit() {
+ m_autonomousCommand = m_chooser.getSelected();
+
+ /*
+ * String autoSelected = SmartDashboard.getString("Auto Selector", "Default");
+ * switch(autoSelected) { case "My Auto": autonomousCommand = new
+ * MyAutoCommand(); break; case "Default Auto": default: autonomousCommand = new
+ * ExampleCommand(); break; }
+ */
+
+ // schedule the autonomous command (example)
+ if (m_autonomousCommand != null) {
+ m_autonomousCommand.start();
+ }
+
+ }
+
+ /**
+ * This function is called periodically during autonomous.
+ */
+ @Override
+ public void autonomousPeriodic() {
+ Scheduler.getInstance().run();
+ log();
+
+ }
+
+ @Override
+ public void teleopInit() {
+ // This makes sure that the autonomous stops running when
+ // teleop starts running. If you want the autonomous to
+ // continue until interrupted by another command, remove
+ // this line or comment it out.
+ if (m_autonomousCommand != null) {
+ m_autonomousCommand.cancel();
+ }
+
+ Robot.driveTrain.gyro.setYaw(0);
+
+ }
+
+ /**
+ * This function is called periodically during operator control.
+ */
+ @Override
+ public void teleopPeriodic() {
+ Scheduler.getInstance().run();
+ log();
+
+ }
+
+ /**
+ * This function is called periodically during test mode.
+ */
+ @Override
+ public void testPeriodic() {
+ }
+
+ public void log() {
+ driveTrain.log();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/frc/robot/RobotMap.java b/src/main/java/frc/robot/RobotMap.java
new file mode 100644
index 0000000..7edda8e
--- /dev/null
+++ b/src/main/java/frc/robot/RobotMap.java
@@ -0,0 +1,59 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2017-2018 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 frc.robot;
+
+import edu.wpi.first.wpilibj.drive.MecanumDrive;
+
+/**
+ * The RobotMap is a mapping from the ports sensors and actuators are wired into
+ * to a variable name. This provides flexibility changing wiring, makes checking
+ * the wiring easier and significantly reducS
+ */
+public class RobotMap {
+ // For example to map the left and right motors, you could define the
+ // following variables to use with your drivetrain subsystem.
+ // public static int leftMotor = 1;
+ // public static int rightMotor = 2;
+
+ // If you are using multiple modules, make sure to define both the port
+ // number and the module. For example you with a rangefinder:
+ // public static int rangefinderPort = 1;
+ // public static int rangefinderModule = 1;
+
+ // Talon SRX Motor IDs
+ final public static int FRONT_RIGHT_ID = 1;
+ final public static int FRONT_LEFT_ID = 2;
+ final public static int BACK_RIGHT_ID = 3;
+ final public static int BACK_LEFT_ID = 4;
+
+ // Pigeon IMU ID
+ final public static int PIGEON_IMU_ID = 5;
+
+ // Ball Shooter Motors IDs
+ // Two Motors (1 for each side)
+ public final static int[] BALL_SHOOTER_MOTOR_IDS = { 5, 7 };
+
+ // Shooter Actuator ID
+ // This Actuator pushes out the ball
+ public final static int BALL_SHOOTER_ACTUATOR_ID = 3;
+
+ // Winch Actuator ID
+ // This actuator controls the angle of the shooting mechanismw
+ public final static int WINCH_MOTOR_ID = 9;
+
+ // Hatch Actuator ID
+ // This allows for the dropping of the hatches
+ public final static int HATCH_ACTUATOR_ID = 2;
+
+ // Climb Actuator IDS
+ // Two Actuators are needed to climb with the robot
+ public final static int[] CLIMB_ACTUATORS_IDS = { 8, 4 };
+
+ public final static int SEAT_MOTOR_ID = 6;
+
+}
diff --git a/src/main/java/frc/robot/commands/BackClimbActuator/BackClimbDown.java b/src/main/java/frc/robot/commands/BackClimbActuator/BackClimbDown.java
new file mode 100644
index 0000000..3749da2
--- /dev/null
+++ b/src/main/java/frc/robot/commands/BackClimbActuator/BackClimbDown.java
@@ -0,0 +1,51 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands.BackClimbActuator;
+
+import edu.wpi.first.wpilibj.command.Command;
+import frc.robot.Robot;
+
+public class BackClimbDown extends Command {
+ public BackClimbDown() {
+ // Use requires() here to declare subsystem dependencies
+ // eg. requires(chassis);
+ requires(Robot.backClimbActuator);
+ }
+
+ // Called just before this Command runs the first time
+ @Override
+ protected void initialize() {
+ }
+
+ // Called repeatedly when this Command is scheduled to run
+ @Override
+ protected void execute() {
+ Robot.backClimbActuator.ExtendBackActuator();
+ }
+
+ // Make this return true when this Command no longer needs to run execute()
+ @Override
+ protected boolean isFinished() {
+ return false;
+ }
+
+ // Called once after isFinished returns true
+ @Override
+ protected void end() {
+ Robot.backClimbActuator.StopBackActuator();
+
+ }
+
+ // Called when another command which requires one or more of the same
+ // subsystems is scheduled to run
+ @Override
+ protected void interrupted() {
+ Robot.backClimbActuator.StopBackActuator();
+
+ }
+}
diff --git a/src/main/java/frc/robot/commands/BackClimbActuator/BackClimbUp.java b/src/main/java/frc/robot/commands/BackClimbActuator/BackClimbUp.java
new file mode 100644
index 0000000..431d3e4
--- /dev/null
+++ b/src/main/java/frc/robot/commands/BackClimbActuator/BackClimbUp.java
@@ -0,0 +1,58 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands.BackClimbActuator;
+
+import edu.wpi.first.wpilibj.Timer;
+import edu.wpi.first.wpilibj.command.Command;
+import frc.robot.Robot;
+
+public class BackClimbUp extends Command {
+
+ public BackClimbUp() {
+ // Use requires() here to declare subsystem dependencies
+ // eg. requires(chassis);
+
+ requires(Robot.backClimbActuator);
+ }
+
+ // Called just before this Command runs the first time
+ @Override
+ protected void initialize() {
+ }
+
+ // Called repeatedly when this Command is scheduled to run
+ @Override
+ protected void execute() {
+ if (Robot.backClimbActuator.limitSwitchBack.get())
+ Robot.backClimbActuator.SetBackClimbActuator(0);
+
+ else
+ Robot.backClimbActuator.RetractBackActuator();
+
+ }
+
+ // Make this return true when this Command no longer needs to run execute()
+ @Override
+ protected boolean isFinished() {
+ return false;
+ }
+
+ // Called once after isFinished returns true
+ @Override
+ protected void end() {
+ Robot.backClimbActuator.StopBackActuator();
+ }
+
+ // Called when another command which requires one or more of the same
+ // subsystems is scheduled to run
+ @Override
+ protected void interrupted() {
+ Robot.backClimbActuator.StopBackActuator();
+
+ }
+}
diff --git a/src/main/java/frc/robot/commands/BackClimbActuator/ClimbBackward.java b/src/main/java/frc/robot/commands/BackClimbActuator/ClimbBackward.java
new file mode 100644
index 0000000..1cdfe35
--- /dev/null
+++ b/src/main/java/frc/robot/commands/BackClimbActuator/ClimbBackward.java
@@ -0,0 +1,50 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands.BackClimbActuator;
+
+import edu.wpi.first.wpilibj.command.Command;
+import frc.robot.Robot;
+
+public class ClimbBackward extends Command {
+ public ClimbBackward() {
+ // Use requires() here to declare subsystem dependencies
+ // eg. requires(chassis);
+ requires(Robot.backClimbActuator);
+ }
+
+ // Called just before this Command runs the first time
+ @Override
+ protected void initialize() {
+ }
+
+ // Called repeatedly when this Command is scheduled to run
+ @Override
+ protected void execute() {
+ Robot.backClimbActuator.SeatMotorBackward();
+ }
+
+ // Make this return true when this Command no longer needs to run execute()
+ @Override
+ protected boolean isFinished() {
+ return false;
+ }
+
+ // Called once after isFinished returns true
+ @Override
+ protected void end() {
+ Robot.backClimbActuator.StopSeatMotor();
+
+ }
+
+ // Called when another command which requires one or more of the same
+ // subsystems is scheduled to run
+ @Override
+ protected void interrupted() {
+ Robot.backClimbActuator.StopSeatMotor();
+ }
+}
diff --git a/src/main/java/frc/robot/commands/BackClimbActuator/ClimbForward.java b/src/main/java/frc/robot/commands/BackClimbActuator/ClimbForward.java
new file mode 100644
index 0000000..4765dab
--- /dev/null
+++ b/src/main/java/frc/robot/commands/BackClimbActuator/ClimbForward.java
@@ -0,0 +1,50 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands.BackClimbActuator;
+
+import edu.wpi.first.wpilibj.command.Command;
+import frc.robot.Robot;
+
+public class ClimbForward extends Command {
+ public ClimbForward() {
+ // Use requires() here to declare subsystem dependencies
+ // eg. requires(chassis);
+ requires(Robot.backClimbActuator);
+ }
+
+ // Called just before this Command runs the first time
+ @Override
+ protected void initialize() {
+ }
+
+ // Called repeatedly when this Command is scheduled to run
+ @Override
+ protected void execute() {
+ Robot.backClimbActuator.SeatMotorForward();
+ }
+
+ // Make this return true when this Command no longer needs to run execute()
+ @Override
+ protected boolean isFinished() {
+ return false;
+ }
+
+ // Called once after isFinished returns true
+ @Override
+ protected void end() {
+ Robot.backClimbActuator.StopSeatMotor();
+ }
+
+ // Called when another command which requires one or more of the same
+ // subsystems is scheduled to run
+ @Override
+ protected void interrupted() {
+ Robot.backClimbActuator.StopSeatMotor();
+
+ }
+}
diff --git a/src/main/java/frc/robot/commands/Camera/EnableCameraOne.java b/src/main/java/frc/robot/commands/Camera/EnableCameraOne.java
new file mode 100644
index 0000000..bb77234
--- /dev/null
+++ b/src/main/java/frc/robot/commands/Camera/EnableCameraOne.java
@@ -0,0 +1,51 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands.Camera;
+
+import edu.wpi.first.wpilibj.command.Command;
+import frc.robot.Robot;
+
+public class EnableCameraOne extends Command {
+ public EnableCameraOne() {
+ // Use requires() here to declare subsystem dependencies
+ // eg. requires(chassis);
+
+ }
+
+ // Called just before this Command runs the first time
+ @Override
+ protected void initialize() {
+ }
+
+ // Called repeatedly when this Command is scheduled to run
+ @Override
+ protected void execute() {
+ Robot.server.setSource(Robot.camera1);
+ }
+
+ // Make this return true when this Command no longer needs to run execute()
+ @Override
+ protected boolean isFinished() {
+ return false;
+ }
+
+ // Called once after isFinished returns true
+ @Override
+ protected void end() {
+ Robot.server.setSource(Robot.camera1);
+
+ }
+
+ // Called when another command which requires one or more of the same
+ // subsystems is scheduled to run
+ @Override
+ protected void interrupted() {
+ Robot.server.setSource(Robot.camera1);
+
+ }
+}
diff --git a/src/main/java/frc/robot/commands/Camera/EnableCameraZero.java b/src/main/java/frc/robot/commands/Camera/EnableCameraZero.java
new file mode 100644
index 0000000..59b658d
--- /dev/null
+++ b/src/main/java/frc/robot/commands/Camera/EnableCameraZero.java
@@ -0,0 +1,52 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands.Camera;
+
+import edu.wpi.first.wpilibj.command.Command;
+import frc.robot.Robot;
+
+public class EnableCameraZero extends Command {
+ public EnableCameraZero() {
+ // Use requires() here to declare subsystem dependencies
+ // eg. requires(chassis);
+ }
+
+ // Called just before this Command runs the first time
+ @Override
+
+ protected void initialize() {
+ }
+
+ // Called repeatedly when this Command is scheduled to run
+ @Override
+ protected void execute() {
+ Robot.server.setSource(Robot.camera0);
+
+ }
+
+ // Make this return true when this Command no longer needs to run execute()
+ @Override
+ protected boolean isFinished() {
+ return false;
+ }
+
+ // Called once after isFinished returns true
+ @Override
+ protected void end() {
+ Robot.server.setSource(Robot.camera0);
+
+ }
+
+ // Called when another command which requires one or more of the same
+ // subsystems is scheduled to run
+ @Override
+ protected void interrupted() {
+ Robot.server.setSource(Robot.camera0);
+
+ }
+}
diff --git a/src/main/java/frc/robot/commands/DriveTrain/RotateToAngle.java b/src/main/java/frc/robot/commands/DriveTrain/RotateToAngle.java
new file mode 100644
index 0000000..0fda6c0
--- /dev/null
+++ b/src/main/java/frc/robot/commands/DriveTrain/RotateToAngle.java
@@ -0,0 +1,71 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands.DriveTrain;
+
+import edu.wpi.first.wpilibj.command.Command;
+import edu.wpi.first.wpilibj.Timer;
+import edu.wpi.first.wpilibj.command.PIDCommand;
+import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
+import frc.robot.Robot;
+import frc.robot.subsystems.DriveTrain;
+
+public class RotateToAngle extends PIDCommand {
+ int counter = 0;
+ int angle;
+
+ public RotateToAngle(int angle1) {
+
+ super(0.1, 0.01, 0);
+ angle = angle1;
+ getPIDController().setInputRange(-180, 180);
+ getPIDController().setOutputRange(-0.75, 0.75);
+ getPIDController().setAbsoluteTolerance(2.5);
+ getPIDController().setSetpoint(angle);
+ getPIDController().setContinuous(true);
+ requires(Robot.driveTrain);
+ }
+
+ protected void initialize() {
+ Robot.driveTrain.gyro.setYaw(0);
+ }
+
+ @Override
+ protected void execute() {
+
+ if (Math.abs(Robot.m_oi.driveJoystick.getX()) > 0.5 || Math.abs(Robot.m_oi.driveJoystick.getY()) > 0.5)
+ getPIDController().setSetpoint(-Robot.m_oi.driveJoystick.getDirectionDegrees());
+
+ else
+ getPIDController().setSetpoint(0);
+ }
+
+ @Override
+ protected double returnPIDInput() {
+ // System.out.println("Gyro Angle: " + Robot.driveTrain.getGyroAngle());
+ return Robot.driveTrain.getGyroAngle();
+
+ }
+
+ @Override
+ protected void usePIDOutput(double speed) {
+ System.out.println("PID Error:" + getPIDController().getError());
+ // System.out.println("Speed:" + speed);
+ Robot.driveTrain.holomonicDrive(0, 0, -1 * speed, 0);
+ }
+
+ @Override
+ protected boolean isFinished() {
+ return false;
+
+ }
+
+ protected void end() {
+ getPIDController().disable();
+ Robot.driveTrain.holomonicDrive(0, 0, 0, 0);
+ }
+}
diff --git a/src/main/java/frc/robot/commands/DriveTrain/TeleopCommand.java b/src/main/java/frc/robot/commands/DriveTrain/TeleopCommand.java
new file mode 100644
index 0000000..dc57183
--- /dev/null
+++ b/src/main/java/frc/robot/commands/DriveTrain/TeleopCommand.java
@@ -0,0 +1,55 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands.DriveTrain;
+
+import edu.wpi.first.wpilibj.command.Command;
+import frc.robot.OI;
+import frc.robot.Robot;
+import frc.robot.subsystems.DriveTrain;
+
+public class TeleopCommand extends Command {
+ public TeleopCommand() {
+ // Use requires() here to declare subsystem dependencies
+ // eg. requires(chassis);
+ requires(Robot.driveTrain);
+ }
+
+ // Called just before this Command runs the first time
+ @Override
+ protected void initialize() {
+ }
+
+ // Called repeatedly when this Command is scheduled to run
+ @Override
+ protected void execute() {
+ System.out.println("Driving");
+ double multiplier = 1;
+ if (OI.boostMode.get())
+ multiplier = 0.1;
+ Robot.driveTrain.holomonicDrive(-OI.driveJoystick.getX() * multiplier, -OI.driveJoystick.getY(),
+ OI.driveJoystick.getZ() * multiplier, 0);
+ }
+
+ // Make this return true when this Command no longer needs to run execute()
+ @Override
+ protected boolean isFinished() {
+ return false;
+ }
+
+ // Called once after isFinished returns true
+ @Override
+ protected void end() {
+ }
+
+ // Called when another command which requires one or more of the same
+ // subsystems is scheduled to run
+ @Override
+ protected void interrupted() {
+
+ }
+}
diff --git a/src/main/java/frc/robot/commands/DriveTrain/VisionAlign.java b/src/main/java/frc/robot/commands/DriveTrain/VisionAlign.java
new file mode 100644
index 0000000..17c8b17
--- /dev/null
+++ b/src/main/java/frc/robot/commands/DriveTrain/VisionAlign.java
@@ -0,0 +1,44 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands.DriveTrain;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+public class VisionAlign extends Command {
+ public VisionAlign() {
+ // Use requires() here to declare subsystem dependencies
+ // eg. requires(chassis);
+ }
+
+ // Called just before this Command runs the first time
+ @Override
+ protected void initialize() {
+ }
+
+ // Called repeatedly when this Command is scheduled to run
+ @Override
+ protected void execute() {
+ }
+
+ // Make this return true when this Command no longer needs to run execute()
+ @Override
+ protected boolean isFinished() {
+ return false;
+ }
+
+ // Called once after isFinished returns true
+ @Override
+ protected void end() {
+ }
+
+ // Called when another command which requires one or more of the same
+ // subsystems is scheduled to run
+ @Override
+ protected void interrupted() {
+ }
+}
diff --git a/src/main/java/frc/robot/commands/DriveTrain/YEETFORWARD.java b/src/main/java/frc/robot/commands/DriveTrain/YEETFORWARD.java
new file mode 100644
index 0000000..5c12eca
--- /dev/null
+++ b/src/main/java/frc/robot/commands/DriveTrain/YEETFORWARD.java
@@ -0,0 +1,50 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands.DriveTrain;
+
+import edu.wpi.first.wpilibj.command.Command;
+import frc.robot.Robot;
+
+public class YEETFORWARD extends Command {
+ public YEETFORWARD() {
+ // Use requires() here to declare subsystem dependencies
+ // eg. requires(chassis);
+ requires(Robot.driveTrain);
+ }
+
+ // Called just before this Command runs the first time
+ @Override
+ protected void initialize() {
+ }
+
+ // Called repeatedly when this Command is scheduled to run
+ @Override
+ protected void execute() {
+ Robot.driveTrain.holomonicDrive(0, 1, 0, 0);
+ }
+
+ // Make this return true when this Command no longer needs to run execute()
+ @Override
+ protected boolean isFinished() {
+ Robot.driveTrain.holomonicDrive(0, 0, 0, 0);
+ return false;
+ }
+
+ // Called once after isFinished returns true
+ @Override
+ protected void end() {
+ Robot.driveTrain.holomonicDrive(0, 0, 0, 0);
+
+ }
+
+ // Called when another command which requires one or more of the same
+ // subsystems is scheduled to run
+ @Override
+ protected void interrupted() {
+ }
+}
diff --git a/src/main/java/frc/robot/commands/FrontClimbActuator/FrontClimbDown.java b/src/main/java/frc/robot/commands/FrontClimbActuator/FrontClimbDown.java
new file mode 100644
index 0000000..db861ec
--- /dev/null
+++ b/src/main/java/frc/robot/commands/FrontClimbActuator/FrontClimbDown.java
@@ -0,0 +1,50 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands.FrontClimbActuator;
+
+import edu.wpi.first.wpilibj.command.Command;
+import frc.robot.Robot;
+
+public class FrontClimbDown extends Command {
+ public FrontClimbDown() {
+ // Use requires() here to declare subsystem dependencies
+ // eg. requires(chassis);
+
+ requires(Robot.frontClimbActuator);
+ }
+
+ // Called just before this Command runs the first time
+ @Override
+ protected void initialize() {
+ }
+
+ // Called repeatedly when this Command is scheduled to run
+ @Override
+ protected void execute() {
+ Robot.frontClimbActuator.ExtendFrontActuator();
+ }
+
+ // Make this return true when this Command no longer needs to run execute()
+ @Override
+ protected boolean isFinished() {
+ return false;
+ }
+
+ // Called once after isFinished returns true
+ @Override
+ protected void end() {
+ Robot.frontClimbActuator.StopFrontActuator();
+ }
+
+ // Called when another command which requires one or more of the same
+ // subsystems is scheduled to run
+ @Override
+ protected void interrupted() {
+ Robot.frontClimbActuator.StopFrontActuator();
+ }
+}
diff --git a/src/main/java/frc/robot/commands/FrontClimbActuator/FrontClimbUp.java b/src/main/java/frc/robot/commands/FrontClimbActuator/FrontClimbUp.java
new file mode 100644
index 0000000..532af08
--- /dev/null
+++ b/src/main/java/frc/robot/commands/FrontClimbActuator/FrontClimbUp.java
@@ -0,0 +1,61 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands.FrontClimbActuator;
+
+import edu.wpi.first.wpilibj.Timer;
+import edu.wpi.first.wpilibj.command.Command;
+import frc.robot.Robot;
+
+public class FrontClimbUp extends Command {
+
+ Timer limitTimer;
+ boolean startTimer = false;
+
+ public FrontClimbUp() {
+ // Use requires() here to declare subsystem dependencies
+ // eg. requires(chassis);
+ requires(Robot.frontClimbActuator);
+ }
+
+ // Called just before this Command runs the first time
+ @Override
+ protected void initialize() {
+
+ limitTimer = new Timer();
+
+ }
+
+ // Called repeatedly when this Command is scheduled to run
+ @Override
+ protected void execute() {
+
+ if (Robot.frontClimbActuator.limitSwitchFront.get())
+ Robot.frontClimbActuator.SetFrontActuatorSpeed(0);
+
+ else
+ Robot.frontClimbActuator.RetractFrontActuator();
+
+ // Robot.frontClimbActuator.RetractFrontActuator();
+
+ }
+
+ @Override
+ protected boolean isFinished() {
+ return false;
+ }
+
+ @Override
+ protected void end() {
+ Robot.frontClimbActuator.StopFrontActuator();
+ }
+
+ @Override
+ protected void interrupted() {
+ Robot.frontClimbActuator.StopFrontActuator();
+ }
+}
diff --git a/src/main/java/frc/robot/commands/Hatch/HatchIn.java b/src/main/java/frc/robot/commands/Hatch/HatchIn.java
new file mode 100644
index 0000000..9d14fda
--- /dev/null
+++ b/src/main/java/frc/robot/commands/Hatch/HatchIn.java
@@ -0,0 +1,56 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands.Hatch;
+
+import edu.wpi.first.wpilibj.Timer;
+import edu.wpi.first.wpilibj.command.Command;
+import frc.robot.Robot;
+
+public class HatchIn extends Command {
+
+ Timer timeout;
+
+ public HatchIn() {
+ // Use requires() here to declare subsystem dependencies
+ // eg. requires(chassis);
+ requires(Robot.hatch);
+ }
+
+ // Called just before this Command runs the first time
+ @Override
+ protected void initialize() {
+ timeout = new Timer();
+ timeout.start();
+ }
+
+ // Called repeatedly when this Command is scheduled to run
+ @Override
+ protected void execute() {
+ Robot.hatch.hatchIn();
+ }
+
+ // Make this return true when this Command no longer needs to run execute()
+ @Override
+ protected boolean isFinished() {
+
+ return (timeout.get() > 1);
+ }
+
+ // Called once after isFinished returns true
+ @Override
+ protected void end() {
+ Robot.hatch.StopHatch();
+ }
+
+ // Called when another command which requires one or more of the same
+ // subsystems is scheduled to run
+ @Override
+ protected void interrupted() {
+ Robot.hatch.StopHatch();
+ }
+}
diff --git a/src/main/java/frc/robot/commands/Hatch/HatchOut.java b/src/main/java/frc/robot/commands/Hatch/HatchOut.java
new file mode 100644
index 0000000..b03f0af
--- /dev/null
+++ b/src/main/java/frc/robot/commands/Hatch/HatchOut.java
@@ -0,0 +1,57 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands.Hatch;
+
+import edu.wpi.first.wpilibj.Timer;
+import edu.wpi.first.wpilibj.command.Command;
+import frc.robot.Robot;
+import frc.robot.subsystems.Hatch;
+
+public class HatchOut extends Command {
+ Timer timeout;
+
+ public HatchOut() {
+ // Use requires() here to declare subsystem dependencies
+ // eg. requires(chassis);
+ requires(Robot.hatch);
+ }
+
+ // Called just before this Command runs the first time
+ @Override
+ protected void initialize() {
+ timeout = new Timer();
+ timeout.start();
+
+ }
+
+ // Called repeatedly when this Command is scheduled to run
+ @Override
+ protected void execute() {
+ Robot.hatch.hatchOut();
+ }
+
+ // Make this return true when this Command no longer needs to run execute()
+ @Override
+ protected boolean isFinished() {
+ return (timeout.get() > 1);
+ }
+
+ // Called once after isFinished returns true
+ @Override
+ protected void end() {
+ Robot.hatch.StopHatch();
+ }
+
+ // Called when another command which requires one or more of the same
+ // subsystems is scheduled to run
+ @Override
+ protected void interrupted() {
+ Robot.hatch.StopHatch();
+
+ }
+}
diff --git a/src/main/java/frc/robot/commands/Shooter/CaptureBall.java b/src/main/java/frc/robot/commands/Shooter/CaptureBall.java
new file mode 100644
index 0000000..edf9418
--- /dev/null
+++ b/src/main/java/frc/robot/commands/Shooter/CaptureBall.java
@@ -0,0 +1,56 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands.Shooter;
+
+import edu.wpi.first.wpilibj.Timer;
+import edu.wpi.first.wpilibj.command.Command;
+import frc.robot.Robot;
+
+public class CaptureBall extends Command {
+ public CaptureBall() {
+ // Use requires() here to declare subsystem dependencies
+ // eg. requires(chassis);
+ requires(Robot.ballShooter);
+ }
+
+ // Called just before this Command runs the first time
+ @Override
+ protected void initialize() {
+
+ }
+
+ // Called repeatedly when this Command is scheduled to run
+ @Override
+ protected void execute() {
+ Robot.ballShooter.captureBall();
+
+ }
+
+ // Make this return true when this Command no longer needs to run execute()
+ @Override
+ protected boolean isFinished() {
+ return false;
+ }
+
+ // Called once after isFinished returns true
+ @Override
+ protected void end() {
+ Robot.ballShooter.stopShooter();
+ Robot.ballShooter.stopballActuator();
+
+ }
+
+ // Called when another command which requires one or more of the same
+ // subsystems is scheduled to run
+ @Override
+ protected void interrupted() {
+ Robot.ballShooter.stopShooter();
+ Robot.ballShooter.stopballActuator();
+
+ }
+}
diff --git a/src/main/java/frc/robot/commands/Shooter/ShootBall.java b/src/main/java/frc/robot/commands/Shooter/ShootBall.java
new file mode 100644
index 0000000..0f04c46
--- /dev/null
+++ b/src/main/java/frc/robot/commands/Shooter/ShootBall.java
@@ -0,0 +1,57 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands.Shooter;
+
+import edu.wpi.first.wpilibj.Timer;
+import edu.wpi.first.wpilibj.command.Command;
+import frc.robot.Robot;
+
+public class ShootBall extends Command {
+ Timer timeout;
+
+ public ShootBall() {
+ // Use requires() here to declare subsystem dependencies
+ // eg. requires(chassis);
+ requires(Robot.ballShooter);
+ }
+
+ // Called just before this Command runs the first time
+ @Override
+ protected void initialize() {
+
+ }
+
+ // Called repeatedly when this Command is scheduled to run
+ @Override
+ protected void execute() {
+ System.out.println("Command Running");
+ Robot.ballShooter.shootBall();
+
+ }
+
+ // Make this return true when this Command no longer needs to run execute()
+ @Override
+ protected boolean isFinished() {
+ return false;
+ }
+
+ // Called once after isFinished returns true
+ @Override
+ protected void end() {
+ Robot.ballShooter.stopShooter();
+
+ }
+
+ // Called when another command which requires one or more of the same
+ // subsystems is scheduled to run
+ @Override
+ protected void interrupted() {
+ Robot.ballShooter.stopShooter();
+
+ }
+}
diff --git a/src/main/java/frc/robot/commands/Shooter/ShooterIn.java b/src/main/java/frc/robot/commands/Shooter/ShooterIn.java
new file mode 100644
index 0000000..1f671f9
--- /dev/null
+++ b/src/main/java/frc/robot/commands/Shooter/ShooterIn.java
@@ -0,0 +1,54 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands.Shooter;
+
+import edu.wpi.first.wpilibj.Timer;
+import edu.wpi.first.wpilibj.command.Command;
+import frc.robot.Robot;
+
+public class ShooterIn extends Command {
+ Timer timeout;
+
+ public ShooterIn() {
+ requires(Robot.ballShooter);
+ }
+
+ // Called just before this Command runs the first time
+ @Override
+ protected void initialize() {
+ timeout = new Timer();
+ timeout.start();
+ }
+
+ // Called repeatedly when this Command is scheduled to run
+ @Override
+ protected void execute() {
+ Robot.ballShooter.ballActuatorIn();
+ }
+
+ // Make this return true when this Command no longer needs to run execute()
+ @Override
+ protected boolean isFinished() {
+ return (timeout.get() > 1.5);
+ }
+
+ // Called once after isFinished returns true
+ @Override
+ protected void end() {
+ Robot.ballShooter.stopballActuator();
+
+ }
+
+ // Called when another command which requires one or more of the same
+ // subsystems is scheduled to run
+ @Override
+ protected void interrupted() {
+ Robot.ballShooter.stopballActuator();
+
+ }
+}
diff --git a/src/main/java/frc/robot/commands/Shooter/ShooterOut.java b/src/main/java/frc/robot/commands/Shooter/ShooterOut.java
new file mode 100644
index 0000000..68891dc
--- /dev/null
+++ b/src/main/java/frc/robot/commands/Shooter/ShooterOut.java
@@ -0,0 +1,55 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands.Shooter;
+
+import edu.wpi.first.wpilibj.Timer;
+import edu.wpi.first.wpilibj.command.Command;
+import frc.robot.Robot;
+
+public class ShooterOut extends Command {
+ Timer timeout;
+
+ public ShooterOut() {
+ // Use requires() here to declare subsystem dependencies
+ // eg. requires(chassis);
+ requires(Robot.ballShooter);
+ }
+
+ // Called just before this Command runs the first time
+ @Override
+ protected void initialize() {
+ timeout = new Timer();
+ timeout.start();
+ }
+
+ // Called repeatedly when this Command is scheduled to run
+ @Override
+ protected void execute() {
+ Robot.ballShooter.ballActuatorOut();
+ }
+
+ // Make this return true when this Command no longer needs to run execute()
+ @Override
+ protected boolean isFinished() {
+ return (timeout.get() > 1);
+ }
+
+ // Called once after isFinished returns true
+ @Override
+ protected void end() {
+ Robot.ballShooter.stopballActuator();
+
+ }
+
+ // Called when another command which requires one or more of the same
+ // subsystems is scheduled to run
+ @Override
+ protected void interrupted() {
+ Robot.ballShooter.stopballActuator();
+ }
+}
diff --git a/src/main/java/frc/robot/commands/Shooter/StopShooter.java b/src/main/java/frc/robot/commands/Shooter/StopShooter.java
new file mode 100644
index 0000000..5c48790
--- /dev/null
+++ b/src/main/java/frc/robot/commands/Shooter/StopShooter.java
@@ -0,0 +1,48 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands.Shooter;
+
+import edu.wpi.first.wpilibj.command.Command;
+import frc.robot.Robot;
+
+public class StopShooter extends Command {
+ public StopShooter() {
+ // Use requires() here to declare subsystem dependencies
+ // eg. requires(chassis);
+
+ requires(Robot.ballShooter);
+ }
+
+ // Called just before this Command runs the first time
+ @Override
+ protected void initialize() {
+ }
+
+ // Called repeatedly when this Command is scheduled to run
+ @Override
+ protected void execute() {
+ Robot.ballShooter.stopShooter();
+ }
+
+ // Make this return true when this Command no longer needs to run execute()
+ @Override
+ protected boolean isFinished() {
+ return false;
+ }
+
+ // Called once after isFinished returns true
+ @Override
+ protected void end() {
+ }
+
+ // Called when another command which requires one or more of the same
+ // subsystems is scheduled to run
+ @Override
+ protected void interrupted() {
+ }
+}
diff --git a/src/main/java/frc/robot/commands/ToggleCommand.java b/src/main/java/frc/robot/commands/ToggleCommand.java
new file mode 100644
index 0000000..84357c7
--- /dev/null
+++ b/src/main/java/frc/robot/commands/ToggleCommand.java
@@ -0,0 +1,38 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+public class ToggleCommand extends Command {
+
+ Command cmdA;
+ Command cmdB;
+ boolean a = true;
+
+ public ToggleCommand(Command a, Command b) {
+ cmdA = a;
+ cmdB = b;
+ }
+
+ @Override
+ protected void initialize() {
+ if (a) {
+ cmdA.start();
+ } else {
+ cmdB.start();
+ }
+
+ a = !a;
+ }
+
+ @Override
+ protected boolean isFinished() {
+ return true;
+ }
+}
diff --git a/src/main/java/frc/robot/commands/Winch/MoveWinchDown.java b/src/main/java/frc/robot/commands/Winch/MoveWinchDown.java
new file mode 100644
index 0000000..524c815
--- /dev/null
+++ b/src/main/java/frc/robot/commands/Winch/MoveWinchDown.java
@@ -0,0 +1,37 @@
+
+package frc.robot.commands.Winch;
+
+import edu.wpi.first.wpilibj.command.Command;
+import frc.robot.Robot;
+
+public class MoveWinchDown extends Command {
+ public MoveWinchDown() {
+ requires(Robot.winch);
+ }
+
+ @Override
+ protected void initialize() {
+ }
+
+ @Override
+ protected void execute() {
+ Robot.winch.winchDown();
+
+ }
+
+ @Override
+ protected boolean isFinished() {
+ return false;
+ }
+
+ @Override
+ protected void end() {
+ Robot.winch.winchHoldingPower();
+ }
+
+ @Override
+ protected void interrupted() {
+ Robot.winch.winchHoldingPower();
+
+ }
+}
diff --git a/src/main/java/frc/robot/commands/Winch/MoveWinchUp.java b/src/main/java/frc/robot/commands/Winch/MoveWinchUp.java
new file mode 100644
index 0000000..84d3d23
--- /dev/null
+++ b/src/main/java/frc/robot/commands/Winch/MoveWinchUp.java
@@ -0,0 +1,53 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands.Winch;
+
+import edu.wpi.first.wpilibj.command.Command;
+import frc.robot.Robot;
+import frc.robot.subsystems.Winch;
+
+public class MoveWinchUp extends Command {
+ public MoveWinchUp() {
+ requires(Robot.winch);
+ // Use requires() here to declare subsystem dependencies
+
+ }
+
+ // Called just before this Command runs the first time
+ @Override
+ protected void initialize() {
+ }
+
+ // Called repeatedly when this Command is scheduled to run
+ @Override
+ protected void execute() {
+ Robot.winch.winchUp();
+
+ }
+
+ // Make this return true when this Command no longer needs to run execute()
+ @Override
+ protected boolean isFinished() {
+ return false;
+ }
+
+ // Called once after isFinished returns true
+ @Override
+ protected void end() {
+ Robot.winch.winchHoldingPower();
+
+ }
+
+ // Called when another command which requires one or more of the same
+ // subsystems is scheduled to run
+ @Override
+ protected void interrupted() {
+ Robot.winch.winchHoldingPower();
+
+ }
+}
diff --git a/src/main/java/frc/robot/commands/Winch/WinchHoldingPower.java b/src/main/java/frc/robot/commands/Winch/WinchHoldingPower.java
new file mode 100644
index 0000000..7d45d84
--- /dev/null
+++ b/src/main/java/frc/robot/commands/Winch/WinchHoldingPower.java
@@ -0,0 +1,49 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.commands.Winch;
+
+import edu.wpi.first.wpilibj.command.Command;
+import frc.robot.Robot;
+import frc.robot.subsystems.Winch;
+
+public class WinchHoldingPower extends Command {
+ public WinchHoldingPower() {
+ requires(Robot.winch);
+ // Use requires() here to declare subsystem dependencies
+ // eg. requires(chassis);
+ }
+
+ // Called just before this Command runs the first time
+ @Override
+ protected void initialize() {
+ }
+
+ // Called repeatedly when this Command is scheduled to run
+ @Override
+ protected void execute() {
+ Robot.winch.winchHoldingPower();
+ }
+
+ // Make this return true when this Command no longer needs to run execute()
+ @Override
+ protected boolean isFinished() {
+ return false;
+ }
+
+ // Called once after isFinished returns true
+ @Override
+ protected void end() {
+ Robot.winch.winchHoldingPower();
+ }
+
+ // Called when another command which requires one or more of the same
+ // subsystems is scheduled to run
+ @Override
+ protected void interrupted() {
+ }
+}
diff --git a/src/main/java/frc/robot/subsystems/BackClimbActuator.java b/src/main/java/frc/robot/subsystems/BackClimbActuator.java
new file mode 100644
index 0000000..ff92234
--- /dev/null
+++ b/src/main/java/frc/robot/subsystems/BackClimbActuator.java
@@ -0,0 +1,60 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.subsystems;
+
+import edu.wpi.first.wpilibj.DigitalInput;
+import edu.wpi.first.wpilibj.Victor;
+import edu.wpi.first.wpilibj.command.Subsystem;
+import frc.robot.RobotMap;
+
+/**
+ * Add your docs here.
+ */
+public class BackClimbActuator extends Subsystem {
+ // Put methods for controlling this subsystem
+ // here. Call these from Commands.
+
+ Victor backClimbActuator = new Victor(RobotMap.CLIMB_ACTUATORS_IDS[1]);
+ Victor seatMotor = new Victor(RobotMap.SEAT_MOTOR_ID);
+ public static DigitalInput limitSwitchBack = new DigitalInput(1);
+
+ @Override
+ public void initDefaultCommand() {
+ // Set the default command for a subsystem here.
+ // setDefaultCommand(new MySpecialCommand());
+ }
+
+ public void RetractBackActuator() {
+ backClimbActuator.set(1);
+ }
+
+ public void ExtendBackActuator() {
+ backClimbActuator.set(-1);
+ }
+
+ public void SeatMotorForward() {
+ seatMotor.set(1);
+ }
+
+ public void SeatMotorBackward() {
+ seatMotor.set(-1);
+ }
+
+ public void StopBackActuator() {
+ backClimbActuator.set(0);
+ }
+
+ public void StopSeatMotor() {
+ seatMotor.set(0);
+ }
+
+ public void SetBackClimbActuator(double speed) {
+ backClimbActuator.set(speed);
+ }
+
+}
diff --git a/src/main/java/frc/robot/subsystems/BallShooter.java b/src/main/java/frc/robot/subsystems/BallShooter.java
new file mode 100644
index 0000000..00ea42c
--- /dev/null
+++ b/src/main/java/frc/robot/subsystems/BallShooter.java
@@ -0,0 +1,68 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.subsystems;
+
+import edu.wpi.first.wpilibj.command.Subsystem;
+import edu.wpi.first.wpilibj.command.WaitCommand;
+import edu.wpi.first.wpilibj.Victor;
+import frc.robot.Constants;
+import frc.robot.RobotMap;
+
+/**
+ * Add your docs here.
+ */
+public class BallShooter extends Subsystem {
+ // Put methods for controlling this subsystem
+ // here. Call these from Commands.
+
+ Victor leftMotorShooter = new Victor(RobotMap.BALL_SHOOTER_MOTOR_IDS[0]);
+ Victor rightMotorShooter = new Victor(RobotMap.BALL_SHOOTER_MOTOR_IDS[1]);
+
+ public Victor ballAcutator = new Victor(RobotMap.BALL_SHOOTER_ACTUATOR_ID);
+
+ WaitCommand wait = new WaitCommand(1.5);
+
+ @Override
+ public void initDefaultCommand() {
+ // Set the default command for a subsystem here.
+ // setDefaultCommand(new MySpecialCommand());
+ }
+
+ public void captureBall() {
+ leftMotorShooter.set(0.2);
+ rightMotorShooter.set(0.2);
+ }
+
+ public void shootBall() {
+ leftMotorShooter.set(-0.2);
+ rightMotorShooter.set(-0.2);
+
+ }
+
+ public void ShootBallWithoutActuator() {
+ leftMotorShooter.set(-.05);
+ rightMotorShooter.set(.05);
+ }
+
+ public void ballActuatorIn() {
+ ballAcutator.set(0.3);
+ }
+
+ public void ballActuatorOut() {
+ ballAcutator.set(-0.5);
+ }
+
+ public void stopballActuator() {
+ ballAcutator.set(0);
+ }
+
+ public void stopShooter() {
+ leftMotorShooter.set(0);
+ rightMotorShooter.set(0);
+ }
+}
diff --git a/src/main/java/frc/robot/subsystems/DriveTrain.java b/src/main/java/frc/robot/subsystems/DriveTrain.java
new file mode 100644
index 0000000..a6336f7
--- /dev/null
+++ b/src/main/java/frc/robot/subsystems/DriveTrain.java
@@ -0,0 +1,153 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.subsystems;
+
+import com.ctre.phoenix.motorcontrol.ControlMode;
+import com.ctre.phoenix.motorcontrol.NeutralMode;
+import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
+import com.ctre.phoenix.sensors.PigeonIMU;
+
+import edu.wpi.first.wpilibj.command.Subsystem;
+import edu.wpi.first.wpilibj.drive.DifferentialDrive;
+import edu.wpi.first.wpilibj.drive.Vector2d;
+import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
+import frc.robot.RobotMap;
+import frc.robot.commands.DriveTrain.TeleopCommand;
+
+/**
+ * Add your docs here.
+ */
+public class DriveTrain extends Subsystem {
+ // Put methods for controlling this subsystem
+ // here. Call these from Commands.
+
+ WPI_TalonSRX frontLeft = new WPI_TalonSRX(RobotMap.FRONT_LEFT_ID);
+ WPI_TalonSRX frontRight = new WPI_TalonSRX(RobotMap.FRONT_RIGHT_ID);
+ WPI_TalonSRX backLeft = new WPI_TalonSRX(RobotMap.BACK_LEFT_ID);
+ WPI_TalonSRX backRight = new WPI_TalonSRX(RobotMap.BACK_RIGHT_ID);
+
+ public static PigeonIMU gyro = new PigeonIMU(RobotMap.PIGEON_IMU_ID);
+
+ WPI_TalonSRX driveMotors[] = { frontLeft, backLeft, frontRight, backRight };
+
+ public DriveTrain() {
+ for (int i = 0; i < driveMotors.length; i++) {
+ driveMotors[i].set(ControlMode.PercentOutput, 0);
+
+ driveMotors[i].configFactoryDefault();
+
+ driveMotors[i].setNeutralMode(NeutralMode.Brake);
+ }
+
+ frontRight.setInverted(true);
+ backRight.setInverted(true);
+
+ }
+
+ private double m_deadband = 0.05;
+ private double m_deadbandz = .1;
+
+ @Override
+ public void initDefaultCommand() {
+ setDefaultCommand(new TeleopCommand());
+ }
+
+ public void holomonicDrive(double xSpeed, double ySpeed, double rotation, double gyroAngle) {
+ xSpeed = limit(xSpeed);
+ xSpeed = applyDeadband(xSpeed, m_deadband);
+
+ ySpeed = limit(ySpeed);
+ ySpeed = applyDeadband(ySpeed, m_deadband);
+
+ rotation = limit(rotation);
+ rotation = applyDeadband(rotation, m_deadbandz);
+
+ xSpeed = Math.copySign(xSpeed * xSpeed, xSpeed);
+ ySpeed = Math.copySign(ySpeed * ySpeed, ySpeed);
+ rotation = Math.copySign(rotation * rotation, rotation);
+
+ Vector2d input = new Vector2d(xSpeed, ySpeed);
+
+ input.rotate(-gyroAngle);
+
+ double[] wheelSpeeds = new double[4];
+
+ wheelSpeeds[0] = input.x + input.y + rotation; // FrontLeft
+ wheelSpeeds[1] = -input.x + input.y - rotation; // FrontRight
+ wheelSpeeds[2] = -input.x + input.y + rotation; // BackLeft
+ wheelSpeeds[3] = input.x + input.y - rotation; // BackRight
+
+ normalize(wheelSpeeds);
+
+ frontLeft.set(ControlMode.PercentOutput, wheelSpeeds[0]);
+ frontRight.set(ControlMode.PercentOutput, wheelSpeeds[1]);
+ backLeft.set(ControlMode.PercentOutput, wheelSpeeds[2]);
+ backRight.set(ControlMode.PercentOutput, wheelSpeeds[3]);
+
+ }
+
+ private double limit(double value) {
+ if (value > 1.0) {
+ return 1.0;
+ }
+
+ if (value < -1.0) {
+ return -1.0;
+ }
+
+ return value;
+ }
+
+ private void normalize(double[] wheelSpeeds) {
+ double maxMagnitude = Math.abs(wheelSpeeds[0]);
+ for (int i = 1; i < wheelSpeeds.length; i++) {
+ double temp = Math.abs(wheelSpeeds[i]);
+ if (maxMagnitude < temp) {
+ maxMagnitude = temp;
+ }
+ }
+ if (maxMagnitude > 1.0) {
+ for (int i = 0; i < wheelSpeeds.length; i++) {
+ wheelSpeeds[i] = wheelSpeeds[i] / maxMagnitude;
+ }
+ }
+ }
+
+ private double applyDeadband(double value, double deadband) {
+ if (Math.abs(value) > deadband) {
+ if (value > 0.0) {
+ return (value - deadband) / (1.0 - deadband);
+ } else {
+ return (value + deadband) / (1.0 - deadband);
+ }
+ }
+ return 0.0;
+ }
+
+ public double getGyroAngle() {
+ double[] gyroData = new double[3];
+
+ gyro.getYawPitchRoll(gyroData);
+
+ return gyroData[0];
+ }
+
+ public double getPitch() {
+ double[] gyroData = new double[3];
+
+ gyro.getYawPitchRoll(gyroData);
+
+ return gyroData[1];
+ }
+
+ public void log() {
+
+ SmartDashboard.putNumber("Yaw", getGyroAngle());
+ SmartDashboard.putNumber("Pitch", getPitch());
+ }
+}
diff --git a/src/main/java/frc/robot/subsystems/FrontClimbActuator.java b/src/main/java/frc/robot/subsystems/FrontClimbActuator.java
new file mode 100644
index 0000000..7be05c8
--- /dev/null
+++ b/src/main/java/frc/robot/subsystems/FrontClimbActuator.java
@@ -0,0 +1,52 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.subsystems;
+
+import edu.wpi.first.wpilibj.DigitalInput;
+import edu.wpi.first.wpilibj.Victor;
+import edu.wpi.first.wpilibj.command.Subsystem;
+import frc.robot.RobotMap;
+
+/**
+ * Add your docs here.
+ */
+public class FrontClimbActuator extends Subsystem {
+ // Put methods for controlling this subsystem
+ // here. Call these from Commands.
+
+ public Victor frontClimbActuator = new Victor(RobotMap.CLIMB_ACTUATORS_IDS[0]);
+ public static DigitalInput limitSwitchFront = new DigitalInput(2);
+
+ @Override
+ public void initDefaultCommand() {
+ // Set the default command for a subsystem here.
+ // setDefaultCommand(new MySpecialCommand());
+ }
+
+ public void RetractFrontActuator() {
+ frontClimbActuator.set(1);
+ }
+
+ public void ExtendFrontActuator() {
+ frontClimbActuator.set(-1);
+ }
+
+ public void StopFrontActuator() {
+ frontClimbActuator.set(0);
+ }
+
+ public void SetFrontActuatorSpeed(double speed) {
+ frontClimbActuator.set(speed);
+
+ }
+
+ public double actuatorSpeed() {
+ return frontClimbActuator.get();
+ }
+
+}
diff --git a/src/main/java/frc/robot/subsystems/Hatch.java b/src/main/java/frc/robot/subsystems/Hatch.java
new file mode 100644
index 0000000..9decc79
--- /dev/null
+++ b/src/main/java/frc/robot/subsystems/Hatch.java
@@ -0,0 +1,43 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.subsystems;
+
+import edu.wpi.first.wpilibj.command.Subsystem;
+import frc.robot.Constants;
+import frc.robot.RobotMap;
+import edu.wpi.first.wpilibj.Victor;
+
+/**
+ * Add your docs here.
+ */
+public class Hatch extends Subsystem {
+ public Victor hatchActuator = new Victor(RobotMap.HATCH_ACTUATOR_ID);
+ // Put methods for controlling this subsystem
+ // here. Call these from Commands.
+
+ public void hatchIn() {
+ hatchActuator.set(Constants.ACTUATOR_SPEED);
+
+ }
+
+ public void hatchOut() {
+ hatchActuator.set(-Constants.ACTUATOR_SPEED);
+
+ }
+
+ public void StopHatch() {
+ hatchActuator.set(0);
+ }
+
+ @Override
+ public void initDefaultCommand() {
+ // Set the default command for a subsystem here.
+ // setDefaultCommand(new MySpecialCommand());
+
+ }
+}
diff --git a/src/main/java/frc/robot/subsystems/Vision.java b/src/main/java/frc/robot/subsystems/Vision.java
new file mode 100644
index 0000000..e0dca13
--- /dev/null
+++ b/src/main/java/frc/robot/subsystems/Vision.java
@@ -0,0 +1,138 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.subsystems;
+
+import edu.wpi.first.wpilibj.PIDController;
+import edu.wpi.first.wpilibj.PIDOutput;
+import edu.wpi.first.wpilibj.PIDSource;
+import edu.wpi.first.wpilibj.PIDSourceType;
+import edu.wpi.first.wpilibj.command.Subsystem;
+import frc.robot.Robot;
+import frc.robot.RobotMap;
+import edu.wpi.first.networktables.*;
+
+import java.time.*;
+
+import com.ctre.phoenix.sensors.PigeonIMU;
+
+class GenericPIDOutput implements PIDOutput {
+ private double pidOutput = 0;
+
+ @Override
+ public void pidWrite(double output) {
+ pidOutput = output;
+ }
+
+ public double getPIDValue() {
+ return pidOutput;
+ }
+}
+
+class GenericPIDSource implements PIDSource {
+ NetworkTableEntry value;
+
+ public GenericPIDSource(NetworkTableEntry value) {
+ this.value = value;
+ }
+
+ @Override
+ public void setPIDSourceType(PIDSourceType pidSource) {
+ // suck it
+ }
+
+ @Override
+ public PIDSourceType getPIDSourceType() {
+ return PIDSourceType.kDisplacement;
+ }
+
+ @Override
+ public double pidGet() {
+ return value.getDouble(0.0);
+ }
+}
+
+/**
+ * Add your docs here.
+ */
+public class Vision extends Subsystem {
+ private NetworkTable visionTable = Robot.shuffleboard.getSubTable("Vision");
+
+ private NetworkTableEntry connected = visionTable.getEntry("connected");
+ private NetworkTableEntry exists = visionTable.getEntry("target_exists");
+ private NetworkTableEntry angle = visionTable.getEntry("yaw_angle");
+ private NetworkTableEntry pixelDiff = visionTable.getEntry("pixel_diff");
+
+ private GenericPIDSource angleIn = new GenericPIDSource(angle);
+ private GenericPIDOutput angleOut = new GenericPIDOutput();
+ private PIDController anglePID = new PIDController(1.0, 0.0, 0.0, angleIn, angleOut);
+
+ private GenericPIDSource pixelIn = new GenericPIDSource(pixelDiff);
+ private GenericPIDOutput pixelOut = new GenericPIDOutput();
+ private PIDController pixelPID = new PIDController(1.0, 0.0, 0.0, pixelIn, pixelOut);
+
+ public static PigeonIMU imu = new PigeonIMU(RobotMap.PIGEON_IMU_ID);
+
+ private boolean doneAlign = false;
+ private boolean doneEverything = false;
+
+ private short[] imuVals = new short[3];
+
+ private LocalDateTime startTime;
+
+ public Vision() {
+ anglePID.setSetpoint(0.0);
+ pixelPID.setSetpoint(0.0);
+
+ anglePID.setInputRange(-1, 1);
+ pixelPID.setInputRange(-1, 1);
+ }
+
+ public void init() {
+ anglePID.reset();
+ pixelPID.reset();
+
+ startTime = LocalDateTime.now();
+ }
+
+ public void excecute() {
+ while (!(boolean) exists.getBoolean(false)) {
+ LocalDateTime currTime = LocalDateTime.now();
+ long diff = Duration.between(startTime, currTime).getSeconds();
+ if (diff > 3) {
+ doneEverything = true;
+ return;
+ }
+ }
+ if (!doneAlign) {
+ Robot.driveTrain.holomonicDrive(pixelOut.getPIDValue(), 0, angleOut.getPIDValue(), 0.0);
+ if (Math.abs(angle.getDouble(-999.9)) < 2 && Math.abs(pixelDiff.getDouble(-999.9)) < 20) {
+ anglePID.reset();
+ doneAlign = true;
+ }
+ } else {
+ Robot.driveTrain.holomonicDrive(0, 0.5, angleOut.getPIDValue(), 0.0);
+ imu.getBiasedAccelerometer(imuVals);
+ double x = (((double) imuVals[0]) / 16384.0) * 9.81; // Converting to G's and then m/s^2
+ double y = (((double) imuVals[1]) / 16384.0) * 9.81;
+
+ double netAccel = Math.sqrt((x * x) + (y * y)); // Pythogorean theorem
+ if (netAccel < 1.0)
+ doneEverything = true;
+ }
+ }
+
+ public boolean isDone() {
+ return doneEverything;
+ }
+
+ @Override
+ public void initDefaultCommand() {
+ // Set the default command for a subsystem here.
+ // setDefaultCommand(new MySpecialCommand());
+ }
+}
diff --git a/src/main/java/frc/robot/subsystems/Winch.java b/src/main/java/frc/robot/subsystems/Winch.java
new file mode 100644
index 0000000..9c0ace7
--- /dev/null
+++ b/src/main/java/frc/robot/subsystems/Winch.java
@@ -0,0 +1,41 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) 2018 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 frc.robot.subsystems;
+
+import edu.wpi.first.wpilibj.Victor;
+import edu.wpi.first.wpilibj.command.Subsystem;
+import frc.robot.Constants;
+import frc.robot.RobotMap;
+
+/**
+ * Add your docs here.
+ */
+public class Winch extends Subsystem {
+ public Victor winch = new Victor(RobotMap.WINCH_MOTOR_ID);
+
+ // Put methods for controlling this subsystem
+ // here. Call these from Commands.
+ public void winchUp() {
+ winch.set(-1);
+ }
+
+ public void winchDown() {
+ winch.set(1);
+ }
+
+ // if losing, dont
+ public void winchHoldingPower() {
+ winch.set(Constants.WINCH_HOLDING_POWER);
+ }
+
+ public void initDefaultCommand() {
+ // Set the default command for a subsystem here.
+ // setDefaultCommand(new MySpecialCommand());
+
+ }
+}
diff --git a/vendordeps/Phoenix.json b/vendordeps/Phoenix.json
new file mode 100644
index 0000000..c12b5aa
--- /dev/null
+++ b/vendordeps/Phoenix.json
@@ -0,0 +1,135 @@
+{
+ "fileName": "Phoenix.json",
+ "name": "CTRE-Phoenix",
+ "version": "5.14.0",
+ "uuid": "ab676553-b602-441f-a38d-f1296eff6537",
+ "mavenUrls": [
+ "http://devsite.ctr-electronics.com/maven/release/"
+ ],
+ "jsonUrl": "http://devsite.ctr-electronics.com/maven/release/com/ctre/phoenix/Phoenix-latest.json",
+ "javaDependencies": [
+ {
+ "groupId": "com.ctre.phoenix",
+ "artifactId": "api-java",
+ "version": "5.14.0"
+ },
+ {
+ "groupId": "com.ctre.phoenix",
+ "artifactId": "wpiapi-java",
+ "version": "5.14.0"
+ }
+ ],
+ "jniDependencies": [
+ {
+ "groupId": "com.ctre.phoenix",
+ "artifactId": "cci",
+ "version": "5.14.0",
+ "isJar": false,
+ "skipInvalidPlatforms": true,
+ "validPlatforms": [
+ "linuxathena",
+ "windowsx86-64",
+ "linuxx86-64"
+ ]
+ },
+ {
+ "groupId": "com.ctre.phoenix",
+ "artifactId": "canutils",
+ "version": "5.14.0",
+ "isJar": false,
+ "skipInvalidPlatforms": true,
+ "validPlatforms": [
+ "windowsx86-64",
+ "linuxx86-64"
+ ]
+ },
+ {
+ "groupId": "com.ctre.phoenix",
+ "artifactId": "platform-stub",
+ "version": "5.14.0",
+ "isJar": false,
+ "skipInvalidPlatforms": true,
+ "validPlatforms": [
+ "windowsx86-64",
+ "linuxx86-64"
+ ]
+ }
+ ],
+ "cppDependencies": [
+ {
+ "groupId": "com.ctre.phoenix",
+ "artifactId": "wpiapi-cpp",
+ "version": "5.14.0",
+ "libName": "CTRE_Phoenix_WPI",
+ "headerClassifier": "headers",
+ "sharedLibrary": false,
+ "skipInvalidPlatforms": true,
+ "binaryPlatforms": [
+ "linuxathena",
+ "windowsx86-64",
+ "linuxx86-64"
+ ]
+ },
+ {
+ "groupId": "com.ctre.phoenix",
+ "artifactId": "api-cpp",
+ "version": "5.14.0",
+ "libName": "CTRE_Phoenix",
+ "headerClassifier": "headers",
+ "sharedLibrary": false,
+ "skipInvalidPlatforms": true,
+ "binaryPlatforms": [
+ "linuxathena",
+ "windowsx86-64",
+ "linuxx86-64"
+ ]
+ },
+ {
+ "groupId": "com.ctre.phoenix",
+ "artifactId": "cci",
+ "version": "5.14.0",
+ "libName": "CTRE_PhoenixCCI",
+ "headerClassifier": "headers",
+ "sharedLibrary": false,
+ "skipInvalidPlatforms": true,
+ "binaryPlatforms": [
+ "linuxathena",
+ "windowsx86-64",
+ "linuxx86-64"
+ ]
+ },
+ {
+ "groupId": "com.ctre.phoenix",
+ "artifactId": "canutils",
+ "version": "5.14.0",
+ "libName": "CTRE_PhoenixCanutils",
+ "headerClassifier": "headers",
+ "sharedLibrary": false,
+ "skipInvalidPlatforms": true,
+ "binaryPlatforms": [
+ "windowsx86-64",
+ "linuxx86-64"
+ ]
+ },
+ {
+ "groupId": "com.ctre.phoenix",
+ "artifactId": "platform-stub",
+ "version": "5.14.0",
+ "libName": "CTRE_PhoenixPlatform",
+ "headerClassifier": "headers",
+ "sharedLibrary": false,
+ "skipInvalidPlatforms": true,
+ "binaryPlatforms": [
+ "windowsx86-64",
+ "linuxx86-64"
+ ]
+ },
+ {
+ "groupId": "com.ctre.phoenix",
+ "artifactId": "core",
+ "version": "5.14.0",
+ "libName": "CTRE_PhoenixCore",
+ "headerClassifier": "headers"
+ }
+ ]
+}
\ No newline at end of file