This repository has been archived by the owner on Nov 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
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
df4c85c
commit c04ba7f
Showing
8 changed files
with
163 additions
and
47 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 was deleted.
Oops, something went wrong.
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.commands.common; | ||
|
||
import edu.wpi.first.wpilibj2.command.InstantCommand; | ||
import edu.wpi.first.wpilibj2.command.RunCommand; | ||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; | ||
import frc.robot.commands.Intake.PidIntakeCommand; | ||
import frc.robot.commands.feeder.FeederRunTillSwitch; | ||
import frc.robot.subsystems.FeederSubsystem; | ||
import frc.robot.subsystems.IntakeSubsystem; | ||
|
||
// 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 fedleme extends SequentialCommandGroup { | ||
/** Creates a new fedleme. */ | ||
public fedleme(IntakeSubsystem m_intake, FeederSubsystem m_feeder) { | ||
// Add your commands in the addCommands() call, e.g. | ||
// addCommands(new FooCommand(), new BarCommand()); | ||
addCommands( | ||
new PidIntakeCommand(m_intake, 1.8) | ||
|
||
.andThen(new RunCommand(()-> m_intake.getNote()) | ||
.andThen(new FeederRunTillSwitch(m_feeder, false) | ||
)) | ||
.withTimeout(2) | ||
|
||
|
||
|
||
|
||
); | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
src/main/java/frc/robot/commands/feeder/FeederRunTillSwitch.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,65 @@ | ||
// 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.feeder; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.FeederSubsystem; | ||
|
||
public class FeederRunTillSwitch extends Command { | ||
FeederSubsystem m_feeder; | ||
boolean dursunmu; | ||
boolean varmi = false; | ||
|
||
|
||
public FeederRunTillSwitch(FeederSubsystem m_feeder, boolean dursunmu) { | ||
|
||
this.m_feeder = m_feeder; | ||
|
||
} | ||
|
||
// 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() { | ||
|
||
|
||
boolean ilkswitch; | ||
|
||
ilkswitch = m_feeder.detector(); | ||
|
||
|
||
if(!dursunmu){ | ||
|
||
if(ilkswitch){ | ||
|
||
m_feeder.backward2(); | ||
|
||
}else{ | ||
|
||
m_feeder.stop(); | ||
varmi = true; | ||
} | ||
} | ||
|
||
|
||
|
||
} | ||
|
||
// 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 dursunmu; | ||
} | ||
|
||
} |
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