示例#1
0
    def robotInit(self):
        self.joystick = wpilib.Joystick(0)

        wheelATalon = ctre.WPI_TalonSRX(21)
        wheelBTalon = ctre.WPI_TalonSRX(22)

        for talon in [wheelATalon, wheelBTalon]:
            talon.configSelectedFeedbackSensor(ctre.FeedbackDevice.QuadEncoder,
                                               0, 0)

        wheelA = sea.AngledWheel(wheelATalon,
                                 1.0,
                                 0.0,
                                 math.pi / 2,
                                 encoderCountsPerFoot=31291.1352,
                                 maxVoltageVelocity=16)
        wheelB = sea.AngledWheel(wheelBTalon,
                                 -1.0,
                                 0.0,
                                 math.pi / 2,
                                 encoderCountsPerFoot=31291.1352,
                                 maxVoltageVelocity=16)

        self.superDrive = sea.SuperHolonomicDrive()
        self.superDrive.addWheel(wheelA)
        self.superDrive.addWheel(wheelB)

        for wheel in self.superDrive.wheels:
            wheel.driveMode = ctre.ControlMode.PercentOutput
示例#2
0
    def initDrivetrain(self):
        #talons
        leftTalon = ctre.WPI_TalonSRX(0)
        rightTalon = ctre.WPI_TalonSRX(1)

        #configure talons
        for talon in [leftTalon, rightTalon]:
            talon.configSelectedFeedbackSensor(ctre.FeedbackDevice.QuadEncoder,
                                               0, 0)

        #create wheels
        leftWheel = sea.AngledWheel(leftTalon, -1, 0, math.pi / 2, 31291.1352,
                                    16)
        rightWheel = sea.AngledWheel(rightTalon, 1, 0, math.pi / 2, 31291.1352,
                                     16)

        #add wheels to drivetrain
        self.drivetrain = sea.SuperHolonomicDrive()
        self.drivetrain.addWheel(leftWheel)
        self.drivetrain.addWheel(rightWheel)

        for wheel in self.drivetrain.wheels:
            wheel.driveMode = ctre.ControlMode.PercentOutput

        #sets up drivetrain to work in the simulator
        sea.setSimulatedDrivetrain(self.drivetrain)
示例#3
0
    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)
示例#4
0
def initDrivetrain():
    superDrive = sea.SuperHolonomicDrive()
    _makeSwerveWheel(superDrive, 1, 8, -WHEELBASE_WIDTH / 2,
                     -WHEELBASE_LENGTH / 2)  # A
    _makeSwerveWheel(superDrive, 3, 2, WHEELBASE_WIDTH / 2,
                     -WHEELBASE_LENGTH / 2)  # B
    _makeSwerveWheel(superDrive, 5, 4, -WHEELBASE_WIDTH / 2,
                     WHEELBASE_LENGTH / 2)  # C
    _makeSwerveWheel(superDrive, 7, 6, WHEELBASE_WIDTH / 2,
                     WHEELBASE_LENGTH / 2)  # D
    sea.setSimulatedDrivetrain(superDrive)
    return superDrive
示例#5
0
    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):
        leftSpark = rev.CANSparkMax(1, rev.MotorType.kBrushless)
        rightSpark = rev.CANSparkMax(2, rev.MotorType.kBrushless)

        for spark in [leftSpark, rightSpark]:
            spark.restoreFactoryDefaults()
            spark.setIdleMode(rev.IdleMode.kBrake)

        leftWheel = sea.AngledWheel(leftSpark, -1, 0, math.pi / 2, 1, 16)
        rightWheel = sea.AngledWheel(rightSpark, 1, 0, math.pi / 2, 1, 16)

        self.drivetrain = sea.SuperHolonomicDrive()
        self.drivetrain.addWheel(leftWheel)
        self.drivetrain.addWheel(rightWheel)

        for wheel in self.drivetrain.wheels:
            wheel.driveMode = rev.ControlType.kVelocity

        sea.setSimulatedDrivetrain(self.drivetrain)
示例#7
0
def initDrivetrain():
    superDrive = sea.SuperHolonomicDrive()

    superDrive.motors = []  # not a normal property of SuperHolonomicDrive

    _makeWheel(superDrive, DRIVETRAIN_LEFT[0], DRIVETRAIN_LEFT[1],
               DRIVETRAIN_LEFT[2], rev.MotorType.kBrushless, 1, 0)

    _makeWheel(superDrive,
               DRIVETRAIN_RIGHT[0],
               DRIVETRAIN_RIGHT[1],
               DRIVETRAIN_RIGHT[2],
               rev.MotorType.kBrushless,
               -1,
               0,
               reverse=True)

    sea.setSimulatedDrivetrain(superDrive)
    return superDrive