I can't say i don't agree. I did port this year's code to jython:
Code:
from edu.wpi.first.wpilibj import SimpleRobot, Timer
from com.shadowh511.mayor.inputs import Xbox, Switch, DomBoard, GreenAsia
from com.shadowh511.mayor.outputs import Driver, FiringThread
class RobotMain(SimpleRobot):
"""
This is the main robot class, hopefully the robot is smart enough to load
it :S
"""
def __init__ (self):
"""
Makes the robot class variables
"""
self.driver = Xbox(1)
self.gunner = GreenAsia(2)
self.motors = Driver(1,2,3,4,True)
self.firing = FiringThread()
self.switch = Switch(4,4)
self.DomBoard = DomBoard()
self.watchDog = SimpleRobot.getWatchdog()
def robotInit(self):
self.watchDog.setEnabled(False)
self.watchDog.kill()
def autonomous(self):
robotInit()
print "Autonomous Starting"
balls = 2
while SimpleRobot.isEnabled() and balls > 0:
if switch.ternaryGet():
self.motors.stop()
self.firing.autoFire()
Timer.delay(3)
balls -=1
else:
self.motors.drive(0.5)
self.motors.stop()
def operatorControl(self):
robotInit()
print "Starting Teleop"
while SimpleRobot.isEnabled():
self.motors.mecanumDrive(driver)
if self.gunner.getCross():
self.firing.autoFire()
elif self.gunner.getSquare():
self.firing.autoTap()