def main(): """ Main function for running robot code, should never exit. Currently this ONLY works with an xbox 360 controller. """ controller = XboxController() while True: arcade_drive(controller, debug=True) shooter(controller, debug=True) dart(controller)
def robotInit(self): self.drive = driveTrain(self) self.interpret = interpret() self.controllerOne = XboxController(0) self.controllerTwo = XboxController(1) self.speedLimiter = 1 #1 = standard speed, greater than 1 to slow down, less than 1 to speed up self.dashTimer = wpilib.Timer() # Timer for SmartDashboard updating self.dashTimer.start() self.dash = SmartDashboard() self.positionChooser = wpilib.SendableChooser() self.positionChooser.addDefault('Position Chooser', '1') self.positionChooser.addObject('left', 'left') self.positionChooser.addObject('right', 'right') self.positionChooser.addObject('center', 'center') self.switchLscaleL = wpilib.SendableChooser() self.switchLscaleL.addDefault('Switch and Scale LEFT', '1') self.switchLscaleL.addObject('Scale', 'scale') self.switchLscaleL.addObject('Switch', 'switch') #switchLscaleL.addObject('PrepScaleScore', '4') self.switchLscaleL.addDefault( 'Drive', 'drive') ##Default for all sendable Choosers self.switchLscaleL.addObject('Two Cube Scale', 'Two Cube Scale') self.switchRscaleR = wpilib.SendableChooser() self.switchRscaleR.addDefault('Switch and Scale RIGHT', '1') self.switchRscaleR.addObject('Scale', 'scale') self.switchRscaleR.addObject('Switch', 'switch') #switchRscaleR.addObject('PrepScaleScore', '4') self.switchRscaleR.addDefault('Drive', 'drive') self.switchRscaleR.addObject('Two Cube Scale', 'Two Cube Scale') self.switchRscaleL = wpilib.SendableChooser() self.switchRscaleL.addDefault('Switch RIGHT, Scale LEFT', '1') self.switchRscaleL.addObject('Scale', 'scale') self.switchRscaleL.addObject('Switch', 'switch') #switchRscaleL.addObject('PrepScaleScore', '4') self.switchRscaleL.addDefault('Drive', 'drive') self.switchRscaleL.addObject('Two Cube Scale', 'Two Cube Scale') self.switchLscaleR = wpilib.SendableChooser() self.switchLscaleR.addDefault('Switch LEFT, Scale RIGHT', '1') self.switchLscaleR.addObject('Scale', 'scale') self.switchLscaleR.addObject('Switch', 'switch') #switchLscaleR.addObject('PrepScaleScore', '4') self.switchLscaleR.addDefault('Drive', 'drive') self.switchLscaleR.addObject('Two Cube Scale', 'Two Cube Scale') #print('Dashboard Test') wpilib.SmartDashboard.putData('Starting Position', self.positionChooser) wpilib.SmartDashboard.putData('Switch and Scale Left', self.switchLscaleL) wpilib.SmartDashboard.putData('Switch Right, Scale Left', self.switchRscaleL) wpilib.SmartDashboard.putData('Switch and Scale Right', self.switchRscaleR) wpilib.SmartDashboard.putData('Switch Left, Scale Right', self.switchLscaleR) #self.dash.putData('Switch Left, Scale Right', switchLscaleR) self.dash.putString('SanityCheck', '1') self.dashTimer = wpilib.Timer() # Timer for SmartDashboard updating self.dashTimer.start()