changed pnumatics subsystem

made changes to pnumatics, and added hatch/ball intake, allso added wrist pnumatic
This commit is contained in:
lukesta182
2019-01-19 12:11:38 -07:00
parent 3615e5c257
commit 82b435e966
5 changed files with 171 additions and 5 deletions
@@ -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() {
}
}
@@ -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() {
}
}
@@ -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() {
}
}
@@ -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());
}
}
@@ -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);
}
}