Skip to content

Commit

Permalink
More cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
1736student committed Mar 21, 2024
1 parent c3836fa commit db8e5a3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 25 deletions.
10 changes: 4 additions & 6 deletions Autonomous/commands/ampShootCommand.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
from AutoSequencerV2.command import Command
from singerMovement.carriageControl import CarriageControl, CarriageControlCmd
from pieceHandling.gamepieceHandling import GamePieceHandling

class EjectCommand(Command):
def __init__(self):
self.carriageControl = CarriageControl()
self.gamePieceHandling = GamePieceHandling()
pass

def execute(self):
#self.carriageControl.setPositionCmd(CarriageControlCmd.AMP)

self.gamePieceHandling.setInput(
GamePieceHandling().setInput(
True,
False,
False,
False
)

def isDone(self):
return False
#return if we're done. Which should be never? It should be controlled by other things
# return if we're done. Which should be never? It should be controlled by other things
return False
10 changes: 5 additions & 5 deletions Autonomous/commands/intakeCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@

class IntakeCommand(Command):
def __init__(self):
self.gamePieceHandling = GamePieceHandling()
pass

def initialize(self):
self.startTime = Timer.getFPGATimestamp()

def execute(self):
# Intake
self.gamePieceHandling.setInput(
GamePieceHandling().setInput(
False,
True,
False,
False
)

def isDone(self):
return Timer.getFPGATimestamp() - self.startTime >= 5 or self.gamePieceHandling.getNoteInPlace()
return Timer.getFPGATimestamp() - self.startTime >= 5 or GamePieceHandling().getNoteInPlace()

def end(self,interrupt):
self.gamePieceHandling.setInput(False,False,False,False)
self.gamePieceHandling.update()
GamePieceHandling().setInput(False,False,False,False)
GamePieceHandling().update()
5 changes: 2 additions & 3 deletions Autonomous/commands/retractCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@

class RetractCommand(Command):
def __init__(self):
self.gamePieceHandling = GamePieceHandling()
self.duration = 0.4

def initialize(self):
self.startTime = Timer.getFPGATimestamp()

def execute(self):
# Feedback a little to allow the shooter to work
self.gamePieceHandling.feedBackSlow(True)
GamePieceHandling().feedBackSlow(True)

def isDone(self):
return (Timer.getFPGATimestamp() - self.startTime) >= self.duration

def end(self,interrupt):
self.gamePieceHandling.setInput(False,False,False,False)
GamePieceHandling().setInput(False,False,False,False)
8 changes: 0 additions & 8 deletions dashboard.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import wpilib
import cscore as cs
from cscore import CameraServer
from AutoSequencerV2.autoSequencer import AutoSequencer
from dashboardWidgets.autoChooser import AutoChooser
from dashboardWidgets.swerveState import SwerveState
Expand All @@ -17,23 +16,19 @@

class Dashboard:
def __init__(self):

webServer = Webserver()

webServer.addDashboardWidget(Icon(45, 45, "/SmartDashboard/isRedIconState", "#FF0000", "allianceRed"))
webServer.addDashboardWidget(Icon(55, 45, "/SmartDashboard/isBlueIconState", "#0000FF", "allianceBlue"))
webServer.addDashboardWidget(Icon(45, 55, "/SmartDashboard/PE Vision Targets Seen", "#00FF00", "vision"))
webServer.addDashboardWidget(Icon(55, 55, "/SmartDashboard/faultIconState", "#FF2200", "warning"))
webServer.addDashboardWidget(Icon(45, 65, "/SmartDashboard/GamepieceIconState", "#00FF00", "newIntakeimg"))
webServer.addDashboardWidget(Icon(55, 65, "/SmartDashboard/AutoAlignIconState", "#0000FF", "autoAlign"))


leftCamera = cs.UsbCamera("LEFT_CAM", 0)
cs.CameraServer.startAutomaticCapture(0)
cs.CameraServer.getVideo(leftCamera)
leftCamera.setPath("http://roborio-1736-frc.local:1181")
webServer.addDashboardWidget(Camera(75, 60, "http://roborio-1736-frc.local:1181/stream.mjpg"))


webServer.addDashboardWidget(
CircularGauge(10, 55, "/SmartDashboard/ShooterGaugeSpeed", 0, 4700, 0, 4700))
Expand Down Expand Up @@ -65,9 +60,6 @@ def update(self):
Icon.kON if wpilib.DriverStation.getAlliance() == wpilib.DriverStation.Alliance.kBlue
else Icon.kOFF)
log("faultIconState", Icon.kBLINK_FAST if FaultWrangler().hasActiveFaults() else Icon.kOFF)

log("GamepieceIconState", Icon.kON if OperatorInterface().getSingerIntakeCmd() else Icon.kOFF)

log("AutoAlignIconState", Icon.kON if OperatorInterface().getSpeakerAutoAlignCmd() else Icon.kOFF)

log("ShooterGaugeSpeed", GamePieceHandling().getShooterMotorSpeed())
3 changes: 0 additions & 3 deletions robot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import sys
import wpilib
import cscore as cs
from dashboard import Dashboard
from drivetrain.controlStrategies.autoDrive import AutoDrive
from drivetrain.controlStrategies.trajectory import Trajectory
Expand All @@ -23,8 +22,6 @@
from AutoSequencerV2.autoSequencer import AutoSequencer
# from climbControl.climberControl import ClimberControl
from utils.powerMonitor import PowerMonitor
#from drivetrain.drivetrainPhysical import WHEEL_GEAR_RATIO


class MyRobot(wpilib.TimedRobot):
#########################################################
Expand Down

0 comments on commit db8e5a3

Please sign in to comment.