-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a12ac82
commit c7fe767
Showing
14 changed files
with
217 additions
and
34 deletions.
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
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
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
29 changes: 29 additions & 0 deletions
29
src/main/java/frc/robot/commands/SetAmpShooterArmPositionCommand.java
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,29 @@ | ||
// 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.wpilibj2.command.InstantCommand; | ||
import frc.robot.subsystems.AmpShooter; | ||
|
||
// NOTE: Consider using this command inline, rather than writing a subclass. For more | ||
// information, see: | ||
// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html | ||
public class SetAmpShooterArmPositionCommand extends InstantCommand { | ||
private AmpShooter ampShooter; | ||
private boolean position; | ||
|
||
public SetAmpShooterArmPositionCommand(AmpShooter ampShooter, boolean position) { | ||
this.ampShooter = ampShooter; | ||
this.position = position; | ||
addRequirements(ampShooter); | ||
// Use addRequirements() here to declare subsystem dependencies. | ||
} | ||
|
||
// Called when the command is initially scheduled. | ||
@Override | ||
public void initialize() { | ||
ampShooter.setPosition(position); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/frc/robot/commands/SetAmpShooterSpeedCommand.java
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,42 @@ | ||
// 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.XboxController; | ||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.AmpShooter; | ||
|
||
public class SetAmpShooterSpeedCommand extends Command { | ||
private XboxController xboxController; | ||
private AmpShooter ampShooter; | ||
|
||
/** Creates a new SetAmpShooterSpeedCommand. */ | ||
public SetAmpShooterSpeedCommand(XboxController xboxController, AmpShooter ampShooter) { | ||
this.xboxController = xboxController; | ||
this.ampShooter = ampShooter; | ||
// Use addRequirements() here to declare subsystem dependencies. | ||
addRequirements(ampShooter); | ||
} | ||
|
||
// 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() { | ||
ampShooter.setWheelPower(xboxController.getLeftY()); | ||
} | ||
|
||
// 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
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,51 @@ | ||
// 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 com.revrobotics.CANSparkLowLevel.MotorType; | ||
import com.revrobotics.CANSparkMax; | ||
import edu.wpi.first.wpilibj.DoubleSolenoid; | ||
import edu.wpi.first.wpilibj.PneumaticsModuleType; | ||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
import frc.robot.Constants.OperatorConstants; | ||
import frc.robot.Constants.PCM; | ||
|
||
public class AmpShooter extends SubsystemBase { | ||
OperatorConstants deviceNumber = new OperatorConstants(); | ||
PCM pcm = new PCM(); | ||
|
||
private CANSparkMax ampShooterMotor; | ||
private DoubleSolenoid piston; | ||
|
||
/** Creates a new AmpShooter. */ | ||
public AmpShooter() { | ||
piston = | ||
new DoubleSolenoid( | ||
1, | ||
PneumaticsModuleType.CTREPCM, | ||
pcm.PISTON_AMP_SHOOTER_FORWARD, | ||
pcm.PISTON_AMP_SHOOTER_REVERSE); | ||
|
||
ampShooterMotor = new CANSparkMax(deviceNumber.DeviceNumberAmpShooter, MotorType.kBrushless); | ||
ampShooterMotor.setInverted(false); | ||
} | ||
|
||
public void setPosition(boolean out) { | ||
if (out) { | ||
piston.set(DoubleSolenoid.Value.kForward); | ||
} else { | ||
piston.set(DoubleSolenoid.Value.kReverse); | ||
} | ||
} | ||
|
||
public void setWheelPower(double power) { | ||
ampShooterMotor.set(power); | ||
} | ||
|
||
@Override | ||
public void periodic() { | ||
// This method will be called once per scheduler run | ||
} | ||
} |
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
Oops, something went wrong.