-
Notifications
You must be signed in to change notification settings - Fork 0
/
robot.py
53 lines (33 loc) · 943 Bytes
/
robot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import wpilib
import wpilib.drive
import wpilib.interfaces
class Robot(wpilib.TimedRobot):
"""
Main robot class
"""
def robotInit(self):
self.dt_motor_left = wpilib.VictorSP(0)
self.dt_motor_right = wpilib.VictorSP(1)
self.dt_motor_right.setInverted(True)
self.drive = wpilib.drive.DifferentialDrive(self.dt_motor_left, self.dt_motor_right)
self.xbox_controller = wpilib.XboxController(0)
def robotPeriodic(self):
pass
def disabledInit(self):
pass
def disabledPeriodic(self):
pass
def autonomousInit(self):
pass
def autonomousPeriodic(self):
pass
def teleopInit(self):
pass
def teleopPeriodic(self):
pass
forward_val = self.xbox_controller.getY(wpilib.interfaces.GenericHID.Hand.kRightHand)
rotate_val = self.xbox_controller.getX(wpilib.interfaces.GenericHID.Hand.kLeftHand)
self.drive.arcadeDrive(forward_val, rotate_val)
### MAIN ###
if __name__ == "__main__":
wpilib.run(Robot)