From 82b435e966ed1aa085c4f7eedfaf1482a4f9ca9c Mon Sep 17 00:00:00 2001 From: lukesta182 <33330639+lukesta182@users.noreply.github.com> Date: Sat, 19 Jan 2019 12:11:38 -0700 Subject: [PATCH] changed pnumatics subsystem made changes to pnumatics, and added hatch/ball intake, allso added wrist pnumatic --- .../robot/commands/DeployBallIntake.java | 40 +++++++++++++++++++ .../frc4388/robot/commands/HatchFlip.java | 40 +++++++++++++++++++ .../robot/commands/WristPlacement.java | 40 +++++++++++++++++++ .../frc4388/robot/subsystems/BallIntake.java | 24 +++++++++++ .../frc4388/robot/subsystems/Pnumatics.java | 32 ++++++++++++--- 5 files changed, 171 insertions(+), 5 deletions(-) create mode 100644 2019robot/src/main/java/org/usfirst/frc4388/robot/commands/DeployBallIntake.java create mode 100644 2019robot/src/main/java/org/usfirst/frc4388/robot/commands/HatchFlip.java create mode 100644 2019robot/src/main/java/org/usfirst/frc4388/robot/commands/WristPlacement.java create mode 100644 2019robot/src/main/java/org/usfirst/frc4388/robot/subsystems/BallIntake.java diff --git a/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/DeployBallIntake.java b/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/DeployBallIntake.java new file mode 100644 index 0000000..363fe8f --- /dev/null +++ b/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/DeployBallIntake.java @@ -0,0 +1,40 @@ +package org.usfirst.frc4388.robot.commands; + +import org.usfirst.frc4388.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +public class DeployBallIntake extends Command +{ + public boolean IsUp; + + public DeployBallIntake(boolean IsUp) { + this.IsUp=IsUp; + requires(Robot.pnumatics); + } + + @Override + protected void initialize() { + Robot.pnumatics.setBallIntake(IsUp); + } + + @Override + protected void execute() { + + } + + @Override + protected boolean isFinished() { + return true; + } + + @Override + protected void end() { + + } + + @Override + protected void interrupted() { + + } +} \ No newline at end of file diff --git a/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/HatchFlip.java b/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/HatchFlip.java new file mode 100644 index 0000000..4dfe82e --- /dev/null +++ b/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/HatchFlip.java @@ -0,0 +1,40 @@ +package org.usfirst.frc4388.robot.commands; + +import org.usfirst.frc4388.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +public class HatchFlip extends Command +{ + public boolean PickingUp; + + public HatchFlip(boolean PickingUP) { + this.PickingUp=PickingUP; + requires(Robot.pnumatics); + } + + @Override + protected void initialize() { + Robot.pnumatics.setHatchIntakeState(PickingUp); + } + + @Override + protected void execute() { + + } + + @Override + protected boolean isFinished() { + return true; + } + + @Override + protected void end() { + + } + + @Override + protected void interrupted() { + + } +} \ No newline at end of file diff --git a/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/WristPlacement.java b/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/WristPlacement.java new file mode 100644 index 0000000..3930031 --- /dev/null +++ b/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/WristPlacement.java @@ -0,0 +1,40 @@ +package org.usfirst.frc4388.robot.commands; + +import org.usfirst.frc4388.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +public class WristPlacement extends Command +{ + public boolean Forward; + + public WristPlacement(boolean Forward) { + this.Forward=Forward; + requires(Robot.pnumatics); + } + + @Override + protected void initialize() { + Robot.pnumatics.setWrist(Forward); + } + + @Override + protected void execute() { + + } + + @Override + protected boolean isFinished() { + return true; + } + + @Override + protected void end() { + + } + + @Override + protected void interrupted() { + + } +} \ No newline at end of file diff --git a/2019robot/src/main/java/org/usfirst/frc4388/robot/subsystems/BallIntake.java b/2019robot/src/main/java/org/usfirst/frc4388/robot/subsystems/BallIntake.java new file mode 100644 index 0000000..7f60eae --- /dev/null +++ b/2019robot/src/main/java/org/usfirst/frc4388/robot/subsystems/BallIntake.java @@ -0,0 +1,24 @@ +/*----------------------------------------------------------------------------*/ +/* 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 org.usfirst.frc4388.robot.subsystems; + +import edu.wpi.first.wpilibj.command.Subsystem; + +/** + * Add your docs here. + */ +public class BallIntake extends Subsystem { + // Put methods for controlling this subsystem + // here. Call these from Commands. + + @Override + public void initDefaultCommand() { + // Set the default command for a subsystem here. + // setDefaultCommand(new MySpecialCommand()); + } +} diff --git a/2019robot/src/main/java/org/usfirst/frc4388/robot/subsystems/Pnumatics.java b/2019robot/src/main/java/org/usfirst/frc4388/robot/subsystems/Pnumatics.java index 129b561..fa59a24 100644 --- a/2019robot/src/main/java/org/usfirst/frc4388/robot/subsystems/Pnumatics.java +++ b/2019robot/src/main/java/org/usfirst/frc4388/robot/subsystems/Pnumatics.java @@ -1,5 +1,7 @@ package org.usfirst.frc4388.robot.subsystems; + + import org.usfirst.frc4388.robot.Robot; import org.usfirst.frc4388.robot.RobotMap; @@ -10,13 +12,17 @@ public class Pnumatics extends Subsystem { private DoubleSolenoid speedShift; - private DoubleSolenoid Intake; + private DoubleSolenoid hatchIntake; + private DoubleSolenoid ballIntake; + private DoubleSolenoid wrist; public Pnumatics() { try { speedShift = new DoubleSolenoid(1,0,1); - Intake = new DoubleSolenoid(1,4,5 ); + hatchIntake = new DoubleSolenoid(1,2,3 ); + ballIntake = new DoubleSolenoid(1,4,5 ); + wrist = new DoubleSolenoid(1,6,7 ); } catch (Exception e) { System.err.println("An error occurred in the Pnumatics constructor"); @@ -31,12 +37,28 @@ public class Pnumatics extends Subsystem { speedShift.set(DoubleSolenoid.Value.kReverse); } } - public void setIntake(boolean state) { + public void setHatchIntakeState(boolean state) { if (state==true) { - Intake.set(DoubleSolenoid.Value.kForward); + hatchIntake.set(DoubleSolenoid.Value.kForward); } if (state==false) { - Intake.set(DoubleSolenoid.Value.kReverse); + hatchIntake.set(DoubleSolenoid.Value.kReverse); + } + } + public void setBallIntake(boolean state) { + if (state==true) { + ballIntake.set(DoubleSolenoid.Value.kForward); + } + if (state==false) { + ballIntake.set(DoubleSolenoid.Value.kReverse); + } + } + public void setWrist(boolean state) { + if (state==true) { + wrist.set(DoubleSolenoid.Value.kForward); + } + if (state==false) { + wrist.set(DoubleSolenoid.Value.kReverse); } }