diff --git a/src/main/java/frc/robot/OI.java b/src/main/java/frc/robot/OI.java index ce871d1..50eb18d 100644 --- a/src/main/java/frc/robot/OI.java +++ b/src/main/java/frc/robot/OI.java @@ -15,6 +15,7 @@ */ public class OI { public Joystick driverController = new Joystick(RobotMap.OI_DRIVER_CONTROLLER); + public Button hatchExtendButton = new Button(driverController, 5); //// CREATING BUTTONS // One type of button is a joystick button which is any button on a //// joystick. @@ -42,4 +43,8 @@ public class OI { // 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()); + + public OI() { + hatchExtendButton.whenPressed(new RetractHatch()); + } } diff --git a/src/main/java/frc/robot/Robot.java b/src/main/java/frc/robot/Robot.java index e4c6164..d16ca30 100644 --- a/src/main/java/frc/robot/Robot.java +++ b/src/main/java/frc/robot/Robot.java @@ -15,6 +15,7 @@ import frc.robot.commands.ExampleCommand; import frc.robot.subsystems.Drivetrain; import frc.robot.subsystems.ExampleSubsystem; +import frc.robot.subsystems.HatchSubsystem; /** * The VM is configured to automatically run this class, and to call the @@ -27,6 +28,7 @@ public class Robot extends TimedRobot { public static ExampleSubsystem m_subsystem = new ExampleSubsystem(); public static OI m_oi; public static Drivetrain m_drivetrain = new Drivetrain(); + public static HatchSubsystem m_hHatchSubsystem = new HatchSubsystem(); Command m_autonomousCommand; SendableChooser m_chooser = new SendableChooser<>(); diff --git a/src/main/java/frc/robot/RobotMap.java b/src/main/java/frc/robot/RobotMap.java index 87cee1c..89a3cc2 100644 --- a/src/main/java/frc/robot/RobotMap.java +++ b/src/main/java/frc/robot/RobotMap.java @@ -26,6 +26,10 @@ public class RobotMap { public static final int LEFT_TALON_PORT = 0; public static final int RIGHT_TALON_PORT = 1; + public static final int OI_DRIVER_CONTROLLER = 0; + + public static final int HATCH_SOLENOID_PORT1 = 0; + public static final int HATCH_SOLENOID_PORT2 = 1; } diff --git a/src/main/java/frc/robot/commands/DriveArcade.java b/src/main/java/frc/robot/commands/DriveArcade.java index 527c381..2b878ab 100644 --- a/src/main/java/frc/robot/commands/DriveArcade.java +++ b/src/main/java/frc/robot/commands/DriveArcade.java @@ -19,7 +19,7 @@ public DriveArcade() { @Override protected void initialize() { - } + } // Called repeatedly when this Command is scheduled to run @Override diff --git a/src/main/java/frc/robot/commands/ExtendHatch.java b/src/main/java/frc/robot/commands/ExtendHatch.java new file mode 100644 index 0000000..9991927 --- /dev/null +++ b/src/main/java/frc/robot/commands/ExtendHatch.java @@ -0,0 +1,45 @@ +/*----------------------------------------------------------------------------*/ +/* 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 ExtendHatch extends Command { + public ExtendHatch() { + // 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() { + end(); + } +} diff --git a/src/main/java/frc/robot/commands/RetractHatch.java b/src/main/java/frc/robot/commands/RetractHatch.java new file mode 100644 index 0000000..1b8791e --- /dev/null +++ b/src/main/java/frc/robot/commands/RetractHatch.java @@ -0,0 +1,30 @@ +/*----------------------------------------------------------------------------*/ +/* 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.InstantCommand; + +/** + * Add your docs here. + */ +public class RetractHatch extends InstantCommand { + /** + * Add your docs here. + */ + public RetractHatch() { + super(); + // Use requires() here to declare subsystem dependencies + // eg. requires(chassis); + } + + // Called once when the command executes + @Override + protected void initialize() { + } + +} diff --git a/src/main/java/frc/robot/subsystems/Drivetrain.java b/src/main/java/frc/robot/subsystems/Drivetrain.java index 7422629..3d53487 100644 --- a/src/main/java/frc/robot/subsystems/Drivetrain.java +++ b/src/main/java/frc/robot/subsystems/Drivetrain.java @@ -11,6 +11,7 @@ import edu.wpi.first.wpilibj.command.Subsystem; import edu.wpi.first.wpilibj.drive.DifferentialDrive; import frc.robot.RobotMap; +import frc.robot.commands.DriveArcade; /** * Add your docs here. @@ -25,7 +26,7 @@ public class Drivetrain extends Subsystem { @Override public void initDefaultCommand() { // Set the default command for a subsystem here. - // setDefaultCommand(new MySpecialCommand()); + setDefaultCommand(new DriveArcade()); } public Drivetrain() { @@ -37,5 +38,7 @@ public Drivetrain() { public void drive(double moveSpeed, double rotateSpeed) { diffDrive.arcadeDrive(moveSpeed, rotateSpeed); + //diffDrive.tankDrive(leftSpeed, rightSpeed); + //diffDrive.curvatureDrive(moveSpeed, rotateSpeed, quickTurn); } } diff --git a/src/main/java/frc/robot/subsystems/HatchSubsystem.java b/src/main/java/frc/robot/subsystems/HatchSubsystem.java index 6dadead..0934675 100644 --- a/src/main/java/frc/robot/subsystems/HatchSubsystem.java +++ b/src/main/java/frc/robot/subsystems/HatchSubsystem.java @@ -1,7 +1,40 @@ -public class HatchSubsystem { - public HatchSubsystem() { - // - // - // - } -} \ No newline at end of file +/*----------------------------------------------------------------------------*/ +/* 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.DoubleSolenoid; +import edu.wpi.first.wpilibj.command.Subsystem; +import frc.robot.RobotMap; + +/** + * Add your docs here. + */ +public class HatchSubsystem extends Subsystem { + // Put methods for controlling this subsystem + // here. Call these from Commands. + + DoubleSolenoid hatchSolenoid = new DoubleSolenoid(RobotMap.HATCH_SOLENOID_PORT1, RobotMap.HATCH_SOLENOID_PORT2); + + @Override + public void initDefaultCommand() { + // Set the default command for a subsystem here. + // setDefaultCommand(new MySpecialCommand()); + } + + public void extendHatch() { + hatchSolenoid.set(DoubleSolenoid.Value.kForward); + } + + public void retractHatch() { + hatchSolenoid.set(DoubleSolenoid.Value.kReverse); + } + + public void turnOffHatch() { + hatchSolenoid.set(DoubleSolenoid.Value.kOff); + } +} diff --git a/vendordeps/Phoenix.json b/vendordeps/Phoenix.json new file mode 100644 index 0000000..f52fc06 --- /dev/null +++ b/vendordeps/Phoenix.json @@ -0,0 +1,135 @@ +{ + "fileName": "Phoenix.json", + "name": "CTRE-Phoenix", + "version": "5.14.1", + "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.1" + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "wpiapi-java", + "version": "5.14.1" + } + ], + "jniDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "cci", + "version": "5.14.1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "linuxathena", + "windowsx86-64", + "linuxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "canutils", + "version": "5.14.1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "platform-stub", + "version": "5.14.1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64" + ] + } + ], + "cppDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "wpiapi-cpp", + "version": "5.14.1", + "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.1", + "libName": "CTRE_Phoenix", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "windowsx86-64", + "linuxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "cci", + "version": "5.14.1", + "libName": "CTRE_PhoenixCCI", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "windowsx86-64", + "linuxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "canutils", + "version": "5.14.1", + "libName": "CTRE_PhoenixCanutils", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "platform-stub", + "version": "5.14.1", + "libName": "CTRE_PhoenixPlatform", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "core", + "version": "5.14.1", + "libName": "CTRE_PhoenixCore", + "headerClassifier": "headers" + } + ] +} \ No newline at end of file diff --git a/vendordeps/REVRobotics.json b/vendordeps/REVRobotics.json new file mode 100644 index 0000000..a70dc13 --- /dev/null +++ b/vendordeps/REVRobotics.json @@ -0,0 +1,55 @@ +{ + "fileName": "REVRobotics.json", + "name": "REVRobotics", + "version": "1.1.9", + "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.1.9" + } + ], + "jniDependencies": [ + { + "groupId": "com.revrobotics.frc", + "artifactId": "SparkMax-driver", + "version": "1.1.9", + "skipInvalidPlatforms": true, + "isJar": false, + "validPlatforms": [ + "linuxathena" + ] + } + ], + "cppDependencies": [ + { + "groupId": "com.revrobotics.frc", + "artifactId": "SparkMax-cpp", + "version": "1.1.9", + "libName": "libSparkMax", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena" + ] + }, + { + "groupId": "com.revrobotics.frc", + "artifactId": "SparkMax-driver", + "version": "1.1.9", + "libName": "libSparkMaxDriver", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena" + ] + } + ] +} \ No newline at end of file