This repository has been archived by the owner on Jan 10, 2025. It is now read-only.
-
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.
* adding a auto to just shoot and showing all on dashboard * everything bropkrhbhgar * gfhyuj * WORKING * feild relative works * works * savestate 0 * savestate 1 * addRequirements commands, correctly invert controller controls, use optimizedDesiredState * disable this rateLimit if statement, fixes j hook problem * get reset yaw angle from nt value * move auto mode selector to Auto/Mode, add Auto/Angle value --------- Co-authored-by: kredcool <[email protected]> Co-authored-by: dubluayaychtee <[email protected]>
- Loading branch information
1 parent
0dd7ea6
commit 3eab8f8
Showing
17 changed files
with
221 additions
and
80 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[[source]] | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[packages] | ||
|
||
[dev-packages] | ||
|
||
[requires] | ||
python_version = "3.11" |
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 @@ | ||
import commands2 | ||
import wpilib | ||
|
||
from subsystems.drivesubsystem import DriveSubsystem | ||
|
||
|
||
class FlyWithWires(commands2.CommandBase): | ||
def __init__( | ||
self, driveSubsystem: DriveSubsystem, xSpeed=0, ySpeed=0, rot=0, time=-1 | ||
) -> None: | ||
super().__init__() | ||
|
||
self.driveSubsystem = driveSubsystem | ||
self.addRequirements((self.driveSubsystem)) | ||
|
||
# time and derection vars | ||
self.time = time | ||
self.xSpeed = xSpeed | ||
self.ySpeed = ySpeed | ||
self.rot = rot | ||
|
||
# Timer | ||
self.backgroundTimer = wpilib.Timer() | ||
self.backgroundTimer.start() | ||
|
||
print("initalized") | ||
|
||
def initialize(self) -> None: | ||
self.backgroundTimer.reset() | ||
|
||
def execute(self) -> None: | ||
self.driveSubsystem.drive( | ||
self.xSpeed, | ||
self.ySpeed, | ||
self.rot, | ||
False, | ||
True, | ||
) | ||
print("running") | ||
|
||
def end(self, interrupted: bool) -> None: | ||
self.driveSubsystem.drive(0, 0, 0, False, True) | ||
print("ended") | ||
|
||
def isFinished(self) -> bool: | ||
if self.time != -1 and self.backgroundTimer.hasElapsed(self.time): | ||
return True | ||
print("finished") |
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,39 @@ | ||
import commands2 | ||
|
||
from subsystems.drivesubsystem import DriveSubsystem | ||
from subsystems.intake import IntakeSubsystem | ||
from subsystems.shooter import Shooter | ||
|
||
from commands.FlyWheelSpeed import FlyWheelSpeed | ||
from commands.setIntakeSpeed import SetIntakeSpeed | ||
|
||
from autonomous.flywithwires import FlyWithWires | ||
|
||
|
||
class ForwardDrive(commands2.SequentialCommandGroup): | ||
def __init__( | ||
self, | ||
driveSubsystem: DriveSubsystem, | ||
shooterSubsytem: Shooter, | ||
intakeSubsystem: IntakeSubsystem, | ||
) -> None: | ||
""" | ||
This shoots a note and drives backwards | ||
this wants the note to start in the intake (folded up) | ||
with the limit switch pressed | ||
""" | ||
|
||
super().__init__( | ||
FlyWheelSpeed(1, shooterSubsytem, False), # Power up the flywheels | ||
SetIntakeSpeed(-0.6, intakeSubsystem), # Load magazine | ||
commands2.WaitCommand( | ||
3 | ||
), # this needs to be here because it won't hold speed otherwise | ||
FlyWheelSpeed(0.0, shooterSubsytem), # Stop flywheel | ||
SetIntakeSpeed(0, intakeSubsystem).withTimeout(3), # Stop intake | ||
FlyWithWires(driveSubsystem, 1, 0, 0, 2), # driving | ||
) | ||
|
||
|
||
NAME = "Forward Drive" | ||
load = lambda bot: ForwardDrive(bot.robotDrive, bot.shooter, bot.intake) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import commands2 | ||
|
||
from subsystems.drivesubsystem import DriveSubsystem | ||
from subsystems.intake import IntakeSubsystem | ||
from subsystems.shooter import Shooter | ||
|
||
from commands.rotateIntake import RotateIntake | ||
from commands.FlyWheelSpeed import FlyWheelSpeed | ||
from commands.setIntakeSpeed import SetIntakeSpeed | ||
from commands.ResetYaw import ResetYaw | ||
from commands.zeroPose import zeroPose | ||
|
||
from constants import IntakeConstants | ||
|
||
|
||
class Shoot(commands2.SequentialCommandGroup): | ||
def __init__( | ||
self, | ||
_drive: DriveSubsystem, | ||
_intake: IntakeSubsystem, | ||
_shooter: Shooter, | ||
): | ||
""" | ||
This just shoots the note, | ||
useful for being with teams | ||
with super autos | ||
""" | ||
super().__init__( | ||
# Resets Yaw relative to the robot's starting position | ||
ResetYaw(_drive), | ||
zeroPose(_drive), | ||
# ============ # | ||
# SPEAKER SHOT # | ||
# ============ # | ||
RotateIntake( | ||
IntakeConstants.BlowPos, _intake | ||
), # Put intake fully inside (if it wasn't already) | ||
print("intake rotatered"), | ||
FlyWheelSpeed(1.0, _shooter, False), # Power up the flywheels (?) | ||
print("wheels r fly"), | ||
SetIntakeSpeed(-0.6, _intake), # Load magazine? (but without ending) | ||
commands2.WaitCommand(1), | ||
FlyWheelSpeed(0.0, _shooter), # Stop flywheel | ||
SetIntakeSpeed(0, _intake), # Stop intake) | ||
) | ||
|
||
|
||
NAME = "Shoot" | ||
load = lambda bot: Shoot(bot.robotDrive, bot.intake, bot.shooter) |
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
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
Oops, something went wrong.