generated from OakvilleDynamics/frc-robot-template
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Changes from 2 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
8e3703c
Fix PnuematicNumbers, Created Elevator
DLipovac93 9637fe5
added semicolen, and others
DLipovac93 c30254f
added elevator stuff to Robot Container
DLipovac93 9dc2ba2
Fixed Red Lines
EuphoniumPlayer 8f176ec
[Spotless] Apply formatting
EuphoniumPlayer badab7c
Fixed Additional Redlines
EuphoniumPlayer be40ec7
Merge branch 'Elevator/PnuematicsFix' of https://github.com/OakvilleD…
EuphoniumPlayer acb27d4
FIxing constants and adding things,
DLipovac93 4e1e667
[Spotless] Apply formatting
DLipovac93 c93b010
Squashed commit of the following:
EuphoniumPlayer 89a1899
Added elevator controls
EuphoniumPlayer a3f9d38
Sensible names
EuphoniumPlayer 20c3412
Updated Elevator Control #'s
OakvilleDynamicsProgrammer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
|
||
// 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() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename constructor from |
||
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); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need a final Didn't see this first time around. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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: