Skip to content

Commit

Permalink
made mode commands not loop, added intake one ball to subsystem periodic
Browse files Browse the repository at this point in the history
  • Loading branch information
dltompki committed Feb 11, 2021
1 parent 7f6da24 commit a2f50a3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,15 @@ public SetIntakeMode(HopperSubsystem hopper, IntakeSubsystem intake, ShooterSubs
public void initialize() {
System.out.println("Setting Intake Mode");
m_hopper.resetBallCount();
}

// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
m_hopper.setIntakeMode();
m_hopper.intakeOneBall();
m_intake.intakeOn();
m_shooter.shooterOff();
}

// 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;
return true; // end after one execution
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,15 @@ public SetShootingMode(HopperSubsystem hopper, ShooterSubsystem shooter, IntakeS
@Override
public void initialize() {
System.out.println("Setting Shooter Mode");
}

// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {

m_hopper.setShootingMode();
m_shooter.shooterOn();
m_intake.intakeOff();
}

// 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;
return true; // end after one execution
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public HopperSubsystem(final double stopperForwardSpeed, final double stopperRev
// SmartDashboard.putData("Sucker Motor", m_suckerMotor);
SmartDashboard.putNumber("Ball Count", m_ballCount);
}

public void hopperOn() {
m_hopperMotor.set(Constants.kHopperForwardSpeed);
m_isHopperOn = true;
Expand Down Expand Up @@ -155,6 +156,10 @@ public void periodic() {
// m_ballSensor.IsBallPresent();
// m_ballOutputSensor.IsBallPresent();
SmartDashboard.putBoolean("Bumper Switch", m_bumperSwitch.get());

if (m_hopperMode == HopperMode.intakeMode) {
intakeOneBall();
}
}

public void setIntakeMode() {
Expand Down

1 comment on commit a2f50a3

@jefft138
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good and very straight forward like we thought. 😀

Please sign in to comment.