Skip to content

Commit

Permalink
just use beambrake to control the lower itensity rumble
Browse files Browse the repository at this point in the history
  • Loading branch information
aschokking committed Apr 4, 2024
1 parent a635fcd commit 7447b9e
Showing 1 changed file with 2 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import competition.operator_interface.OperatorInterface;
import competition.subsystems.collector.CollectorSubsystem;
import xbot.common.command.BaseCommand;
import xbot.common.command.BaseSetpointCommand;
import xbot.common.properties.DoubleProperty;
import xbot.common.properties.PropertyFactory;

Expand All @@ -15,7 +14,7 @@ public class IntakeCollectorCommand extends BaseCommand {
final OperatorInterface oi;
private final DoubleProperty higherIntensity;
private final DoubleProperty lowerIntensity;
private boolean isToggledOnce = false;

@Inject
public IntakeCollectorCommand(CollectorSubsystem collector, OperatorInterface oi, PropertyFactory pf) {
addRequirements(collector);
Expand All @@ -30,20 +29,16 @@ public IntakeCollectorCommand(CollectorSubsystem collector, OperatorInterface oi
public void initialize() {
collector.resetCollectionState();
log.info("Initializing");
isToggledOnce = false;
}

@Override
public void execute() {
collector.intake();
if(collector.getGamePieceInControl()) {
isToggledOnce = true;
}
if (collector.confidentlyHasControlOfNote()) {
oi.operatorGamepadAdvanced.getRumbleManager().rumbleGamepad(higherIntensity.get(), 0.7);
oi.operatorFundamentalsGamepad.getRumbleManager().rumbleGamepad(higherIntensity.get(), 0.7);
oi.driverGamepad.getRumbleManager().rumbleGamepad(higherIntensity.get(), 0.7);
} else if (isToggledOnce) {
} else if (collector.getBeamBreakSensorActivated()) {
oi.operatorGamepadAdvanced.getRumbleManager().rumbleGamepad(lowerIntensity.get(), 0.7);
oi.operatorFundamentalsGamepad.getRumbleManager().rumbleGamepad(lowerIntensity.get(), 0.7);
oi.driverGamepad.getRumbleManager().rumbleGamepad(lowerIntensity.get(), 0.7);
Expand All @@ -53,10 +48,6 @@ public void execute() {
@Override
public void end(boolean interrupted) {
super.end(interrupted);
oi.operatorGamepadAdvanced.getRumbleManager().rumbleGamepad(0, 0.7);
oi.operatorFundamentalsGamepad.getRumbleManager().rumbleGamepad(0, 0.7);
oi.driverGamepad.getRumbleManager().rumbleGamepad(0, 0.7);

collector.stop();

}
Expand Down

0 comments on commit 7447b9e

Please sign in to comment.