-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrobot.py
21 lines (17 loc) · 899 Bytes
/
robot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import wpilib
import wpilib.drive
from magicbot import MagicRobot
import rev
class Robot(MagicRobot):
def createObjects(self):
self.controller = wpilib.XboxController(0)
self.left1 = rev.SparkMax(21, rev.SparkLowLevel.MotorType.kBrushless)
self.left2 = rev.SparkMax(24, rev.SparkLowLevel.MotorType.kBrushless)
self.right1 = rev.SparkMax(22, rev.SparkLowLevel.MotorType.kBrushless)
self.right2 = rev.SparkMax(23, rev.SparkLowLevel.MotorType.kBrushless)
self.left = wpilib.MotorControllerGroup(self.left1, self.left2)
self.left.setInverted(True)
self.right = wpilib.MotorControllerGroup(self.right1, self.right2)
self.drive = wpilib.drive.DifferentialDrive(self.left, self.right)
def teleopPeriodic(self):
self.drive.arcadeDrive(self.controller.getRawAxis(1) * .5, self.controller.getRawAxis(2) * .5)