From 29593564c2bd14a63f2b88bf5db178d29403eb72 Mon Sep 17 00:00:00 2001 From: RishabhCowlagi <59751356+RishabhCowlagi@users.noreply.github.com> Date: Tue, 28 Jan 2020 17:07:49 -0800 Subject: [PATCH] Add Basic Storage Code --- src/main/java/frc4388/robot/Constants.java | 10 ++- .../frc4388/robot/subsystems/Storage.java | 48 +++++++++++++ vendordeps/REVRobotics.json | 70 +++++++++++++++++++ 3 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 src/main/java/frc4388/robot/subsystems/Storage.java create mode 100644 vendordeps/REVRobotics.json diff --git a/src/main/java/frc4388/robot/Constants.java b/src/main/java/frc4388/robot/Constants.java index 793ce5c..eb408fa 100644 --- a/src/main/java/frc4388/robot/Constants.java +++ b/src/main/java/frc4388/robot/Constants.java @@ -29,7 +29,15 @@ public final class Constants { public static final class IntakeConstants { public static final int INTAKE_SPARK_ID = 1; } - + public static final class StorageConstants { + public static final int STORAGE_TALON_ID = 9; + public static final int BEAM_SENSOR_DIO_0 = 0; + public static final int BEAM_SENSOR_DIO_1 = 1; + public static final int BEAM_SENSOR_DIO_2 = 2; + public static final int BEAM_SENSOR_DIO_3 = 3; + public static final int BEAM_SENSOR_DIO_4 = 0; + public static final int BEAM_SENSOR_DIO_5 = 0; + } public static final class LEDConstants { public static final int LED_SPARK_ID = 0; diff --git a/src/main/java/frc4388/robot/subsystems/Storage.java b/src/main/java/frc4388/robot/subsystems/Storage.java new file mode 100644 index 0000000..7b85a0d --- /dev/null +++ b/src/main/java/frc4388/robot/subsystems/Storage.java @@ -0,0 +1,48 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) 2019 FIRST. All Rights Reserved. */ +/* Open Source Software - may be modified and shared by FRC teams. The code */ +/* must be accompanied by the FIRST BSD license file in the root directory of */ +/* the project. */ +/*----------------------------------------------------------------------------*/ + +package frc4388.robot.subsystems; + +import com.ctre.phoenix.motorcontrol.can.TalonSRX; +import com.revrobotics.CANSparkMax; +import com.revrobotics.SparkMax; +import com.revrobotics.CANSparkMaxLowLevel.MotorType; + +import edu.wpi.first.wpilibj.DigitalInput; +import edu.wpi.first.wpilibj2.command.SubsystemBase; + +import frc4388.robot.Constants.StorageConstants; + +public class Storage extends SubsystemBase { + private CANSparkMax m_storageMotor = new CANSparkMax(StorageConstants.STORAGE_TALON_ID, MotorType.kBrushless); + private DigitalInput[] m_beamSensors = new DigitalInput[6]; + /** + * Creates a new Storage. + */ + public Storage() { + m_beamSensors[0] = new DigitalInput(StorageConstants.BEAM_SENSOR_DIO_0); + m_beamSensors[0] = new DigitalInput(StorageConstants.BEAM_SENSOR_DIO_1); + m_beamSensors[0] = new DigitalInput(StorageConstants.BEAM_SENSOR_DIO_2); + m_beamSensors[0] = new DigitalInput(StorageConstants.BEAM_SENSOR_DIO_3); + m_beamSensors[0] = new DigitalInput(StorageConstants.BEAM_SENSOR_DIO_4); + m_beamSensors[0] = new DigitalInput(StorageConstants.BEAM_SENSOR_DIO_5); + } + + @Override + public void periodic() { + // NO + } + + /** + * Runs storage motor + * @param input the voltage to run motor at + */ + public void runStorage(double input) { + m_storageMotor.set(input); + boolean beam_on = m_beamSensors[0].get(); + } +} diff --git a/vendordeps/REVRobotics.json b/vendordeps/REVRobotics.json new file mode 100644 index 0000000..63380b6 --- /dev/null +++ b/vendordeps/REVRobotics.json @@ -0,0 +1,70 @@ +{ + "fileName": "REVRobotics.json", + "name": "REVRobotics", + "version": "1.5.1", + "uuid": "3f48eb8c-50fe-43a6-9cb7-44c86353c4cb", + "mavenUrls": [ + "http://www.revrobotics.com/content/sw/max/sdk/maven/" + ], + "jsonUrl": "http://www.revrobotics.com/content/sw/max/sdk/REVRobotics.json", + "javaDependencies": [ + { + "groupId": "com.revrobotics.frc", + "artifactId": "SparkMax-java", + "version": "1.5.1" + } + ], + "jniDependencies": [ + { + "groupId": "com.revrobotics.frc", + "artifactId": "SparkMax-driver", + "version": "1.5.1", + "skipInvalidPlatforms": true, + "isJar": false, + "validPlatforms": [ + "windowsx86-64", + "windowsx86", + "linuxaarch64bionic", + "linuxx86-64", + "linuxathena", + "linuxraspbian" + ] + } + ], + "cppDependencies": [ + { + "groupId": "com.revrobotics.frc", + "artifactId": "SparkMax-cpp", + "version": "1.5.1", + "libName": "SparkMax", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "windowsx86", + "linuxaarch64bionic", + "linuxx86-64", + "linuxathena", + "linuxraspbian" + ] + }, + { + "groupId": "com.revrobotics.frc", + "artifactId": "SparkMax-driver", + "version": "1.5.1", + "libName": "SparkMaxDriver", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "windowsx86", + "linuxaarch64bionic", + "linuxx86-64", + "linuxathena", + "linuxraspbian" + ] + } + ] +} \ No newline at end of file