MOAR TRANSLATIONS

This commit is contained in:
2022-12-10 22:10:20 -05:00
parent d96e315705
commit 8c11917d96
12 changed files with 242 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
Create an autonomous that completes the following steps
- Forward for 2 Seconds
- Right for .5 Seconds
- Forward for 1 Second
- Left for .75 Seconds
- Backward for 2 Seconds

View File

@@ -0,0 +1,48 @@
import wpilib
import wpilib.drive
import ctre
class MyRobot(wpilib.TimedRobot):
def robotInit(self):
self.leftFront = ctre.WPI_VictorSPX(0)
self.leftRear = ctre.WPI_VictorSPX(1)
self.rightFront = ctre.WPI_VictorSPX(2)
self.rightRear = ctre.WPI_VictorSPX(3)
self.left = wpilib.MotorControllerGroup(self.leftFront, self.leftRear)
self.right = wpilib.MotorControllerGroup(self.rightFront, self.rightRear)
self.right.setInverted(True)
self.drivetrain = wpilib.drive.DifferentialDrive(self.left, self.right)
self.primary = wpilib.XboxController(0)
self.autoTimer = wpilib.Timer()
def autonomousInit(self):
self.autoTimer.reset()
self.autoTimer.start()
def autonomousPeriodic(self):
if self.autoTimer.get() < 2:
self.drivetrain.tankDrive(.5, .5)
elif self.autoTimer.get() >= 2 and self.autoTimer.get() < 2.5:
self.drivetrain.tankDrive(.5, -.5)
elif self.autoTimer.get() >= 2.5 and self.autoTimer.get() < 3.5:
self.drivetrain.tankDrive(.5, .5)
elif self.autoTimer.get() >= 3.5 and self.autoTimer.get() < 4.25:
self.drivetrain.tankDrive(-.5, .5)
elif self.autoTimer.get() >= 4.25 and self.autoTimer.get() < 6.25:
self.drivetrain.tankDrive(-.5, -.5)
else:
self.drivetrain.tankDrive(0, 0)
def teleopInit(self):
self.autoTimer.stop()
def teleopPeriodic(self):
self.drivetrain.arcadeDrive(self.primary.getLeftY(), self.primary.getLeftX())
if __name__ == "__main__":
wpilib.run(MyRobot)

View File

View File

@@ -0,0 +1,46 @@
import wpilib
import wpilib.drive
import ctre
class MyRobot(wpilib.TimedRobot):
def robotInit(self):
self.leftFront = ctre.WPI_VictorSPX(0)
self.leftRear = ctre.WPI_VictorSPX(1)
self.rightFront = ctre.WPI_VictorSPX(2)
self.rightRear = ctre.WPI_VictorSPX(3)
self.left = wpilib.MotorControllerGroup(self.leftFront, self.leftRear)
self.right = wpilib.MotorControllerGroup(self.rightFront, self.rightRear)
self.right.setInverted(True)
self.drivetrain = wpilib.drive.DifferentialDrive(self.left, self.right)
self.primary = wpilib.XboxController(0)
self.autoTimer = wpilib.Timer()
def autonomousInit(self):
self.autoTimer.reset()
self.autoTimer.start()
def autonomousPeriodic(self):
if self.autoTimer.get() < 2:
self.drivetrain.tankDrive(.5, .5)
elif self.autoTimer.get() >= 2 and self.autoTimer.get() < 3:
self.drivetrain.tankDrive(.5, -.5)
elif self.autoTimer.get() >= 3 and self.autoTimer.get() < 4:
self.drivetrain.tankDrive(-.5, .5)
elif self.autoTimer.get() >= 4 and self.autoTimer.get() < 6:
self.drivetrain.tankDrive(-.5, -.5)
else:
self.drivetrain.tankDrive(0, 0)
def teleopInit(self):
self.autoTimer.stop()
def teleopPeriodic(self):
self.drivetrain.arcadeDrive(self.primary.getLeftY(), self.primary.getLeftX())
if __name__ == "__main__":
wpilib.run(MyRobot)