Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PnuematicNumbers, Created Elevator #28

Merged
merged 13 commits into from
Mar 12, 2024
7 changes: 4 additions & 3 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ public static final class HardwareConstants {
public static final class PneumaticsConstants {
public static final class DumpConstants {
// Uppy Downy solonoid
public static final int OUT = 1;
public static final int IN = 0;
public static final int OUT = 0;
public static final int IN = 15;
}

public static final class ElevatorConstants {
// upy downy chain lift thing

public static final int IN = 2;
public static final int OUT = 13;
}
}

Expand Down
50 changes: 50 additions & 0 deletions src/main/java/frc/robot/commands/ElevatorControl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

package frc.robot.commands;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.Constants.OperatorConstants;
import frc.robot.subsystems.Elevator;

public class ElevatorControl extends Command {

private static Elevator Elevatorsubsystem;

private static Joystick ElevatorJoystick = new Joystick(OperatorConstants.COPILOT_CONTROLLER);

/** Creates a new PneumaticsControl. */
public ElevatorControl(Elevator subsystem) {
ElevatorSubsystem = subsystem;
addRequirements(subsystem);
// Use addRequirements() here to declare subsystem dependencies.
}

// Called when the command is initially scheduled.
@Override
public void initialize() {}

// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
// TODO: Change this to the correct button
if (ElevatorJoystick.getRawButton(11)) {
ElevatorSubsystem.open();
// TODO: Change this to the correct button
} else if (ElevatorJoystick.getRawButton(12)) {
ElevatorSubsystem.close();
}
}

// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {}

// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/subsystems/Dump.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class Dump extends SubsystemBase {

/** Creates a new Pneumatics subsystem. */
public Dump() {
System.out.println("Pneumatics initialized");
System.out.println("Pneumatic Dump initialized");
SmartDashboard.putBoolean(getName(), false);
}

Expand Down
40 changes: 40 additions & 0 deletions src/main/java/frc/robot/subsystems/Elevator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

package frc.robot.subsystems;

import edu.wpi.first.math.proto.System;
import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.PneumaticsModuleType;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants.HardwareConstants;
import frc.robot.Constants.PneumaticsConstants.ElevatorConstants;
import frc.robot.util.Time;

public class Elevator {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also have extends SubsystemBase for the class, looking like:

public class Elevator extends SubsystemBase {


// double solenoid to control the pistons */
private DoubleSolenoid doubleSolenoid =
new DoubleSolenoid(
HardwareConstants.REV_PH_ID,
PneumaticsModuleType.REVPH,
ElevatorConstants.IN,
ElevatorConstants.OUT);

/** Create new pnuematic system */
public elevator() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename constructor from elevator() to Elevator(). Should fix the build issues.

System.out.println("Pneumatic Elevator initialized");
SmartDashboard.putBoolean(getName(), false);
}
/** Open pistons to go up */
public void open() {
doubleSolenoid.set(DoubleSolenoid.Value.kForward);
SmartDashboard.putBoolean(getName(), true);
}
/** Closes pistons to go down */
public void close() {
doubleSolenoid.set(DoubleSolenoid.Value.kReverse);
SmartDashboard.putBoolean(getName(), false);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a final } at the end of the file.

Didn't see this first time around.

Loading