-
-
Save virtuald/bbbd30720e8f51e76ccb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#! /usr/bin/env python3 | |
import wpilib | |
from robotpy_ext.control import xbox_controller | |
import magicbot | |
class MyRobot(magicbot.MagicRobot): | |
def createObjects(self): | |
self.driveStick = xbox_controller.XboxController(0) | |
if MyRobot.isSimulation(): | |
MotorType = wpilib.CANTalon | |
else: | |
MotorType = wpilib.CANJaguar | |
self.lf_motor = MotorType(1) | |
self.lr_motor = MotorType(2) | |
self.rf_motor = MotorType(3) | |
self.rr_motor = MotorType(4) | |
self.drive = wpilib.RobotDrive(self.lf_motor, self.lr_motor, self.rf_motor, self.rr_motor) | |
def disabledPeriodic(self): | |
wpilib.Timer.delay(.01) | |
def teleopInit(self): | |
pass | |
def teleopPeriodic(self): | |
self.drive.tankDrive(self.driveStick.getLeftY(), self.driveStick.getRightY(), False) | |
if __name__ == '__main__': | |
wpilib.run(MyRobot) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment