Skip to content

Commit

Permalink
Receieve code
Browse files Browse the repository at this point in the history
  • Loading branch information
xorbotz committed Jan 22, 2024
1 parent 9d74e0c commit e2a7804
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public static final class Shooter {

public static final int speakerStrength = 15760;
public static final int ampStrength = 2560;
public static final int receive = -100;

}

Expand Down
8 changes: 8 additions & 0 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package frc.robot;

import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.RunCommand;
import edu.wpi.first.wpilibj2.command.button.JoystickButton;
import frc.robot.commands.TeleopSwerve;
import frc.robot.subsystems.*;
import frc.robot.util.*;
Expand All @@ -22,6 +24,7 @@ public class RobotContainer {
* The container for the robot. Contains subsystems, OI devices, and commands.
*/
public RobotContainer() {
configureButtonBindings();
SwerveSubsystem.setDefaultCommand(
new TeleopSwerve(
SwerveSubsystem,
Expand All @@ -44,6 +47,11 @@ public RobotContainer() {
() -> ShooterSubsystem.speakerShot(CONTROLLER.getXButton()),
ShooterSubsystem));
}
private void configureButtonBindings() {
new JoystickButton(CONTROLLER, 4)
.whileTrue(
new RunCommand(() -> ShooterSubsystem.receive(true), ShooterSubsystem));
}

public Command getAutonomousCommand() {
return AutonomousManager.getCommand();
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/frc/robot/subsystems/ShooterSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,23 @@ public void ampShot(boolean shoot) {
ControlType.kVelocity);
}
}
public void receive(boolean shoot) {
if (shoot) {
shooterPidController_1.setReference(
Constants.Shooter.receive,
ControlType.kVelocity);
shooterPidController_2.setReference(
Constants.Shooter.receive,
ControlType.kVelocity);
} else {
shooterPidController_1.setReference(
0,
ControlType.kVelocity);
shooterMotor_1.set(0);
shooterPidController_2.setReference(
0,
ControlType.kVelocity);
shooterMotor_2.set(0);
}
}
}

0 comments on commit e2a7804

Please sign in to comment.