def robotInit(self): self.talons = { } # dictionary, maps talon number to WPI_TalonSRX object self.joy = wpilib.Joystick(0) self.app = None sea.startDashboard(self, motortest_app.MotorTester)
def robotInit(self): #set up drivetrain self.drivetrain = self.initDrivetrain() sea.setSimulatedDrivetrain(self.drivetrain) #set up dashboard self.app = None sea.startDashboard(self, dashboard.PracticeDashboard)
def robotInit(self): self.joystick = wpilib.Joystick(0) wheelADriveTalon = ctre.WPI_TalonSRX(1) wheelARotateTalon = ctre.WPI_TalonSRX(0) wheelBDriveTalon = ctre.WPI_TalonSRX(3) wheelBRotateTalon = ctre.WPI_TalonSRX(2) wheelCDriveTalon = ctre.WPI_TalonSRX(5) wheelCRotateTalon = ctre.WPI_TalonSRX(4) for talon in [ wheelADriveTalon, wheelARotateTalon, wheelBDriveTalon, wheelBRotateTalon, wheelCDriveTalon, wheelCRotateTalon ]: talon.configSelectedFeedbackSensor(ctre.FeedbackDevice.QuadEncoder, 0, 0) wheelADrive = sea.AngledWheel(wheelADriveTalon, .75, .75, 0, encoderCountsPerFoot=31291.1352, maxVoltageVelocity=16) wheelBDrive = sea.AngledWheel(wheelBDriveTalon, -.75, .75, 0, encoderCountsPerFoot=31291.1352, maxVoltageVelocity=16) wheelCDrive = sea.AngledWheel(wheelCDriveTalon, 0, -.75, 0, encoderCountsPerFoot=31291.1352, maxVoltageVelocity=16) wheelARotate = sea.SwerveWheel(wheelADrive, wheelARotateTalon, 1612.8, True) wheelBRotate = sea.SwerveWheel(wheelBDrive, wheelBRotateTalon, 1612.8, True) wheelCRotate = sea.SwerveWheel(wheelCDrive, wheelCRotateTalon, 1680, True) # 1670, 1686, 1680 self.superDrive = sea.SuperHolonomicDrive() sea.setSimulatedDrivetrain(self.superDrive) for wheelrotate in [wheelARotate, wheelBRotate, wheelCRotate]: self.superDrive.addWheel(wheelrotate) for wheel in self.superDrive.wheels: wheel.driveMode = ctre.ControlMode.PercentOutput self.robotOrigin = None self.app = None sea.startDashboard(self, swervebot_app.SwerveBotDashboard)
def robotInit(self): self.joystick = wpilib.Joystick(0) self.superDrive = sea.SuperHolonomicDrive() sea.setSimulatedDrivetrain(self.superDrive) self.makeSwerveWheel(1, 0, .75, .75, 1612.8, True) self.makeSwerveWheel(3, 2, -.75, .75, 1612.8, True) self.makeSwerveWheel(5, 4, 0, -.75, 1680, True) # 1670, 1686, 1680 self.setDriveMode(ctre.ControlMode.PercentOutput) self.robotOrigin = None self.app = None sea.startDashboard(self, swervebot_app.SwerveBotDashboard) self.ahrs = navx.AHRS.create_spi()
def robotInit(self): # DEVICES self.joystick = wpilib.Joystick(0) self.buttonBoard = wpilib.Joystick(1) self.opticalSensors = [ wpilib.AnalogInput(0), wpilib.AnalogInput(1), wpilib.AnalogInput(2), wpilib.AnalogInput(3)] ahrs = navx.AHRS.create_spi() self.pdp = wpilib.PowerDistributionPanel(50) self.vision = NetworkTables.getTable('limelight') self.vision.putNumber('pipeline', 1) # SUBSYSTEMS self.superDrive = drivetrain.initDrivetrain() self.superDrive.gear = None self.multiDrive = sea.MultiDrive(self.superDrive) self.grabberArm = grabber.GrabberArm() self.climber = climber.Climber() # HELPER OBJECTS self.pathFollower = sea.PathFollower(self.superDrive, ahrs) startPosition = coordinates.startCenter.inQuadrant(1) self.pathFollower.setPosition(startPosition.x, startPosition.y, startPosition.orientation) self.autoScheduler = auto_scheduler.AutoScheduler() self.autoScheduler.updateCallback = self.updateScheduler self.autoScheduler.idleFunction = self.autoIdle self.autoScheduler.actionList.append(auto_actions.createEndAction(self, 7)) self.timingMonitor = sea.TimingMonitor() # MANUAL DRIVE STATE self.driveVoltage = False self.manualGear = None self.fieldOriented = True self.holdGear = False self.manualAuxModeMachine = sea.StateMachine() self.auxDisabledState = sea.State(self.auxDisabledMode) self.defenseState = sea.State(self.manualDefenseMode) self.hatchState = sea.State(self.manualHatchMode) self.cargoState = sea.State(self.manualCargoMode) self.climbState = sea.State(self.manualClimbMode) self.controlModeMachine = sea.StateMachine() self.autoState = sea.State(self.autoScheduler.runSchedule) self.manualState = sea.State(self.manualDriving, self.manualAuxModeMachine) # DASHBOARD self.genericAutoActions = auto_actions.createGenericAutoActions( self, self.pathFollower, self.grabberArm) self.app = None # dashboard sea.startDashboard(self, dashboard.CompetitionBotDashboard) wpilib.CameraServer.launch('camera.py:main')
def robotInit(self): self.talons = [None] * 99 self.joy = wpilib.Joystick(0) self.app = None sea.startDashboard(self, motortest_app.MotorTester)
def robotInit(self): # devices self.controller = wpilib.XboxController(0) self.buttonBoard = wpilib.Joystick(1) ahrs = navx.AHRS.create_spi() self.pdp = wpilib.PowerDistributionPanel(50) self.ledStrip = wpilib.PWM(0) self.ledInput = -0.99 self.superDrive = drivetrain.initDrivetrain() self.pathFollower = sea.PathFollower(self.superDrive, ahrs) # for autonomous mode self.autoScheduler = autoScheduler.AutoScheduler() self.autoScheduler.idleFunction = self.autoIdle self.autoScheduler.updateCallback = self.updateScheduler # controls the state of the robot self.controlModeMachine = sea.StateMachine() self.manualState = sea.State(self.driving) self.autoState = sea.State(self.autoScheduler.runSchedule) self.testState = sea.State(self.testing) # for shifting gear box self.compressor = wpilib.Compressor(0) self.piston1 = wpilib.DoubleSolenoid(0, 1) self.piston2 = wpilib.DoubleSolenoid(2, 3) # drive gears self.superDrive.gear = None self.driveGear = drivetrain.mediumVoltageGear self.driveMode = "velocity" self.driveSpeed = "medium" self.driveGears = \ {"voltage" : \ {"slow" : drivetrain.slowVoltageGear, "medium" : drivetrain.mediumVoltageGear, "fast" : drivetrain.fastVoltageGear}, "velocity" : \ {"slow" : drivetrain.slowVelocityGear, "medium" : drivetrain.mediumVelocityGear, "fast" : drivetrain.fastVelocityGear}, "position" : \ {"slow" : drivetrain.slowPositionGear, "medium" : drivetrain.mediumPositionGear, "fast" : drivetrain.fastPositionGear} } # testing self.testSettings = { \ "wheelNum" : 0, "motorNum" : 0, "speed" : 0 } # for dashboard motor data self.motorData = [dict() for _ in range(len(self.superDrive.motors))] # sets initial values so the dashboard doesn't break when it tries to get # them before the values are updated in self.updateMotorData for motor in range(len(self.superDrive.motors)): initAmps = round(self.superDrive.motors[motor].getOutputCurrent(), 2) initTemp = round(self.superDrive.motors[motor].getMotorTemperature(), 2) self.motorData[motor]["amps"] = initAmps self.motorData[motor]["temp"] = initTemp self.motorData[motor]["maxAmp"] = initAmps self.motorData[motor]["maxTemp"] = initTemp self.app = None sea.startDashboard(self, dashboard.CompetitionDashboard)