"""
Main logic code
"""
import wpilib
from networktables import NetworkTables

from inits import Component
import helpers

from components.chassis import Chassis
from components.gear import GearSol
from components.collector import BallCollector
from components.climber import Climber
from components.shooter import Shooter
from components.bumpPop import BumpPop
from components.ledStrip import LedStrip
from guide import Guiding

class Randy(wpilib.SampleRobot):
    def robotInit(self):
        self.C = Component() # Components inits all connected motors, sensors, and joysticks. See inits.py.

        # Setup subsystems
        self.drive     = Chassis(self.C.driveTrain, self.C.encoders, self.C.gyroS)
        self.collector = BallCollector(self.C.collectorM)
        self.shooter   = Shooter(self.C.shooterM, self.C.ballServos)
        self.climb     = Climber(self.C.climbM)
        self.bumpPop   = BumpPop(self.C.bumpPopR)
        self.ledStrip  = LedStrip(self.C.ledStrip)
        self.gearSol   = GearSol(self.C.gearSol)

    def operatorControl(self):
        # runs when robot is enabled
        while self.isOperatorControl() and self.isEnabled():
            # Drive
            self.drive.run(self.C.leftJ.getX(),
                           self.C.leftJ.getY(),
                           self.C.middleJ.getX(),
                           self.C.middleJ.getY(),
                           self.C.leftJ.getRawButton(4),
                           self.C.leftJ.getRawButton(3),
                           self.C.leftJ.getRawButton(5),
                           self.C.leftJ.getRawButton(2),
                           self.C.middleJ.getRawButton(2),
                           'bobcat')

            # Components
            self.gearSol.run(self.C.middleJ.getRawButton(1))
            self.collector.run(self.C.rightJ.getRawButton(4), self.C.rightJ.getRawButton(5))
            self.shooter.run(self.C.rightJ.getRawButton(2), self.C.rightJ.getRawButton(3))
            self.bumpPop.run(self.C.leftJ.getRawButton(1))
            self.climb.run(self.C.rightJ.getRawButton(1))

            self.ledStrip.run(self.C.allienceS.get(), self.C.middleJ.getRawButton(1), wpilib.Timer.getMatchTime())

            wpilib.Timer.delay(0.002) # wait for a motor update time

    def test(self):
        """This function is called periodically during test mode."""

if __name__ == "__main__":
    wpilib.run(Randy)

@@ -31,16 +31,28 @@
  wpilib%0A
+import time%0A
 from net
@@ -81,17 +81,16 @@
 orkTable
-s
 %0A%0Afrom i
@@ -1037,16 +1037,58 @@
 arSol)%0A%0A
+        self.lastTime = 0 # used in Auto%0A%0A
     def 
@@ -1208,16 +1208,58 @@
 bled():%0A
+            print(self.C.gyroS.getRate())%0A
         
@@ -1785,14 +1785,14 @@
    '
-bobcat
+arcade
 ')%0A%0A
@@ -1832,30 +1832,17 @@
     
+if (
 self.
-gearSol.run(self.
 C.mi
@@ -1854,32 +1854,181 @@
 .getRawButton(1)
+ == True and self.C.middleJ.getRawButton(2) == True):%0A                self.gearSol.run(True)%0A            else:%0A                self.gearSol.run(False
 )%0A            se
@@ -2591,16 +2591,558 @@
 de.%22%22%22%0A%0A
+    def autonomous(self):%0A        %22%22%22Runs once during autonomous.%22%22%22%0A        self.C.gyroS.reset()%0A        self.bumpPop.run(True) # deploy Randy%0A        self.lastTime = time.clock()%0A        while (time.clock() - self.lastTime %3C 1.4):%0A            self.drive.polar(0.5, 180, 3 * helpers.remap(self.C.gyroS.getRate(), -360, 360, -1, 1)) # drive forward%0A%0A        self.drive.polar(0, 0, 0)%0A        wpilib.Timer.delay(1.5)%0A        self.gearSol.run(True)%0A        wpilib.Timer.delay(1)%0A        self.gearSol.run(False)%0A        self.bumpPop.run(False)%0A%0A
 if __nam

Add auto period