-
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.
Co-Authored-By: Nahuelpoet <[email protected]>
- Loading branch information
1 parent
06ed6b8
commit b3f5b14
Showing
6 changed files
with
109 additions
and
7 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
27 changes: 27 additions & 0 deletions
27
src/main/java/frc/robot/commands/ShooterActivateCommand.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,27 @@ | ||
// 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.Shooter; | ||
|
||
// 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 | ||
ShooterActivateCommand extends InstantCommand { | ||
private Shooter shooter; | ||
public ShooterActivateCommand(Shooter shooter) { | ||
// Use addRequirements() here to declare subsystem dependencies. | ||
this.shooter = shooter; | ||
addRequirements(shooter); | ||
} | ||
|
||
// Called when the command is initially scheduled. | ||
@Override | ||
public void initialize() { | ||
shooter.shoot(1); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/frc/robot/commands/ShooterDisactivateCommand.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,26 @@ | ||
// 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.Shooter; | ||
|
||
// 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 ShooterDisactivateCommand extends InstantCommand { | ||
private Shooter shooter; | ||
public ShooterDisactivateCommand(Shooter shooter) { | ||
// Use addRequirements() here to declare subsystem dependencies. | ||
this.shooter = shooter; | ||
addRequirements(shooter); | ||
} | ||
|
||
// Called when the command is initially scheduled. | ||
@Override | ||
public void initialize() { | ||
shooter.shoot(0); | ||
} | ||
} |
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,36 @@ | ||
// 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.ctre.phoenix.motorcontrol.can.TalonSRX; | ||
import com.ctre.phoenix.motorcontrol.TalonSRXControlMode; | ||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
import frc.robot.Constants.OperatorConstants; | ||
public class Shooter extends SubsystemBase { | ||
/** Creates a new Shooter. */ | ||
private TalonSRX shooterGauche; | ||
private TalonSRX shooterDroit; | ||
public Shooter() { | ||
OperatorConstants deviceNumber = new OperatorConstants(); | ||
shooterGauche = new TalonSRX(deviceNumber.DeviceNumberShooterGauche); | ||
shooterDroit = new TalonSRX(deviceNumber.DeviceNumberShooterDroit); | ||
|
||
shooterGauche.setInverted(false); | ||
shooterDroit.setInverted(false); | ||
|
||
} | ||
public void shoot(double activated){ | ||
shooterGauche.set(TalonSRXControlMode.PercentOutput, activated); | ||
shooterDroit.set(TalonSRXControlMode.PercentOutput, activated); | ||
|
||
|
||
} | ||
|
||
@Override | ||
public void periodic() { | ||
|
||
// This method will be called once per scheduler run | ||
} | ||
} |