-
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.
- Loading branch information
Showing
6 changed files
with
185 additions
and
8 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
45 changes: 45 additions & 0 deletions
45
src/main/java/frc/robot/commands/control/auto/AutoAimLockWrist.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,45 @@ | ||
// 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.control.auto; | ||
|
||
import edu.wpi.first.math.proto.Wpimath; | ||
import edu.wpi.first.wpilibj.DriverStation; | ||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.Wrist; | ||
import frc.robot.util.Util; | ||
|
||
public class AutoAimLockWrist extends Command { | ||
private final Wrist wrist; | ||
|
||
/** Creates a new AimLockWrist. */ | ||
public AutoAimLockWrist(Wrist wrist) { | ||
this.wrist = wrist; | ||
addRequirements(wrist); | ||
// Use addRequirements() here to declare subsystem dependencies. | ||
} | ||
|
||
// 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() { | ||
double degrees = Util.getInterpolatedWristAngle(); | ||
// TODO find actual values, prevent wrist collision when the elevator is all the way down. | ||
if (degrees > 10.0 && degrees < 35.0) { | ||
return; | ||
} | ||
wrist.setDegrees(degrees); | ||
} | ||
|
||
@Override | ||
public void end(boolean interrupted) {} | ||
|
||
@Override | ||
public boolean isFinished() { | ||
return false; | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
src/main/java/frc/robot/commands/control/auto/AutoIdleShooter.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,55 @@ | ||
// 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.control.auto; | ||
|
||
import edu.wpi.first.math.filter.Debouncer; | ||
import edu.wpi.first.math.filter.Debouncer.DebounceType; | ||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.RobotContainer; | ||
import frc.robot.constants.Constants; | ||
import frc.robot.subsystems.Shooter; | ||
import frc.robot.util.Util; | ||
|
||
public class AutoIdleShooter extends Command { | ||
|
||
private static final double VALID_SHOT_DEBOUNCE_TIME = 0.2; | ||
|
||
/** Creates a new IdleShooter. */ | ||
private final Shooter shooter; | ||
|
||
// private final Debouncer validShotDebouncer; | ||
|
||
public AutoIdleShooter(Shooter shooter) { | ||
addRequirements(shooter); | ||
this.shooter = shooter; | ||
// this.validShotDebouncer = new Debouncer(VALID_SHOT_DEBOUNCE_TIME, DebounceType.kFalling); | ||
// Use addRequirements() here to declare subsystem dependencies. | ||
} | ||
|
||
// 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() { | ||
// if (shooter.isCenterBroken() && validShotDebouncer.calculate(Util.isValidShot(SPEAKER_LIMELIGHT))) { | ||
shooter.setRPMShoot(Constants.Shooter.SHOOTER_IDLE_RPM_CLOSE); | ||
// } else { | ||
// shooter.stopShooter(); | ||
// } | ||
} | ||
|
||
// 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; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/frc/robot/commands/control/auto/InstantShoot.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,48 @@ | ||
// 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.control.auto; | ||
|
||
import edu.wpi.first.math.filter.Debouncer; | ||
import edu.wpi.first.math.filter.Debouncer.DebounceType; | ||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.Shooter; | ||
|
||
public class InstantShoot extends Command { | ||
|
||
static private final double SHOT_DEBOUNCE_TIME = 0.06; | ||
|
||
private final Shooter m_shooter; | ||
private Debouncer m_shotDebouncer; | ||
|
||
/** Creates a new InstantShoot. */ | ||
public InstantShoot(final Shooter shooter) { | ||
// Use addRequirements() here to declare subsystem dependencies. | ||
m_shooter = shooter; | ||
} | ||
|
||
// Called when the command is initially scheduled. | ||
@Override | ||
public void initialize() { | ||
m_shotDebouncer = new Debouncer(SHOT_DEBOUNCE_TIME, DebounceType.kFalling); | ||
} | ||
|
||
// Called every time the scheduler runs while the command is scheduled. | ||
@Override | ||
public void execute() { | ||
m_shooter.setFeederVoltage(8.0); | ||
} | ||
|
||
// Called once the command ends or is interrupted. | ||
@Override | ||
public void end(boolean interrupted) { | ||
m_shooter.stopFeeder(); | ||
} | ||
|
||
// Returns true when the command should end. | ||
@Override | ||
public boolean isFinished() { | ||
return !m_shotDebouncer.calculate(m_shooter.isCenterBroken()); | ||
} | ||
} |
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