So my D team is having an issue with their autonomous, the first line of autonomous runs, but nothing runs after that. Driver control works fine, its just their auto doesnt.
They did an update to the brains and to VS Code, but both programmers (Different computers) are having this issue:
# ---------------------------------------------------------------------------- #
# #
# Module: main.py #
# Author: student #
# Created: 11/27/2023, 3:45:27 PM #
# Description: V5 project #
# #
# ---------------------------------------------------------------------------- #
# Library imports
from vex import *
# Brain should be defined by default
brain=Brain()
brain.screen.print("Hello V5")
# Robot Configuration Code
LeF = Motor(Ports.PORT6)
LeB = Motor(Ports.PORT8)
MiDL = Motor(Ports.PORT7,True)
RiF = Motor(Ports.PORT5,True)
RiB = Motor(Ports.PORT10)
MidR = Motor(Ports.PORT9,True)
IntaK = Motor(Ports.PORT11,True)
PunchEr = Motor(Ports.PORT1,GearSetting.RATIO_36_1)
PiS1 = DigitalOut(brain.three_wire_port.h)
PiS2 = DigitalOut(brain.three_wire_port.g)
Inert = Inertial(Ports.PORT18)
#Motor groups
LefG = MotorGroup(LeF,LeB,MiDL)
RiG = MotorGroup(RiF,RiB,MidR)
#drivetrain and Controller
DrT = SmartDrive(LefG, RiG, Inert, 300, 320, 320, MM, 1)
Cont = Controller(PRIMARY)
#drivetrain and Controller
DrT = SmartDrive(LefG, RiG, Inert, 300, 320, 320, MM)
Cont = Controller(PRIMARY)
#Functions
def DrivE(distance,speed,direction):
DrT.set_drive_velocity(speed,PERCENT)
DrT.drive_for(direction, distance, INCHES)
def TurN(direction,angle,speed):
DrT.set_turn_velocity(speed, PERCENT)
DrT.turn_for(direction,angle,DEGREES)
def IntakE(direction,angle,speed):
IntaK.set_velocity(speed,PERCENT)
IntaK.spin_for(direction,angle,DEGREES)
def puNch(direction, time, speed):
PunchEr.set_velocity(speed, PERCENT)
PunchEr.spin(direction)
wait(time, MSEC)
PunchEr.stop()
def WiNg(time,dare,bob):
PiS1.set(dare)
PiS2.set(dare)
wait(time,MSEC)
PiS1.set(bob)
PiS2.set(bob)
def DriveW(time,dare,distance,speed,direction,bob):
PiS1.set(dare)
PiS2.set(dare)
DrT.set_turn_velocity(speed,PERCENT)
DrT.drive_for(direction,distance,INCHES)
wait(time,MSEC)
PiS1.set(bob)
PiS2.set(bob)
def DriveI(distance,speed,direction,angle):
IntaK.set_velocity(speed,PERCENT)
IntaK.spin_for(direction,angle,DEGREES)
DrT.set_drive_velocity(speed,PERCENT)
DrT.drive_for(direction,distance,INCHES)
#Competition Code
def pre_autonomous():
count = 0
brain.screen.clear_screen()
while True:
brain.screen.print_at("Pre_Auton.... %6d"%(count), x=10, y=40)
count = count + 1
DrT.set_stopping(COAST)
Inert.calibrate()
DrT.set_turn_constant(1.7)
DrT.set_turn_threshold(1.77)
def autonomous():
while True:
DrivE(44,70,FORWARD)
TurN(RIGHT,90,70)
IntakE(REVERSE,1450,100)
DrivE(20,70,REVERSE)
TurN(LEFT,48,70)
DrivE(9,70,FORWARD)
IntakE(FORWARD,600,100)
TurN(RIGHT,52,70)
IntakE(REVERSE,1200,80)
TurN(LEFT,173,70)
DrivE(20,90,REVERSE)
DrivE(10,90,FORWARD)
wait(500000,MSEC)
def usercontrol():
while True:
# controller with joy sticks
RiG.set_velocity((Cont.axis2.position() + Cont.axis1.position()),PERCENT)
LefG.set_velocity((Cont.axis2.position() - Cont.axis1.position()),PERCENT)
LefG.spin(FORWARD)
RiG.spin(FORWARD)
#Buttons
if Cont.buttonR1.pressing():
PunchEr.set_velocity(100,PERCENT)
PunchEr.spin(REVERSE)
elif Cont.buttonR2.pressing():
PunchEr.set_velocity(100,PERCENT)
PunchEr.spin(FORWARD)
else:
PunchEr.stop()
if Cont.buttonL1.pressing():
IntaK.set_velocity(100,PERCENT)
IntaK.spin(REVERSE)
elif Cont.buttonL2.pressing():
IntaK.set_velocity(100,PERCENT)
IntaK.spin(FORWARD)
else:
IntaK.stop()
if Cont.buttonDown.pressing():
PiS1.set(True)
elif Cont.buttonUp.pressing():
PiS1.set(False)
if Cont.buttonLeft.pressing():
PiS2.set(True)
elif Cont.buttonRight.pressing():
PiS2.set(False)
comp = Competition(usercontrol, autonomous) #do not touch this
2nd Student:
# ---------------------------------------------------------------------------- #
# #
# Module: main.py #
# Author: student #
# Created: 1/4/2024, 12:27:34 PM #
# Description: V5 project #
# #
# ---------------------------------------------------------------------------- #
# Library imports
from vex import *
# Brain should be defined by default
brain=Brain()
# Robot Configuration Code
LeF = Motor(Ports.PORT6)
LeB = Motor(Ports.PORT8)
MiDL = Motor(Ports.PORT7,True)
RiF = Motor(Ports.PORT5,True)
RiB = Motor(Ports.PORT10)
MidR = Motor(Ports.PORT9,True)
inke = Motor(Ports.PORT11)
PunchEr = Motor(Ports.PORT1,GearSetting.RATIO_36_1)
PiS1 = DigitalOut(brain.three_wire_port.h)
PiS2 = DigitalOut(brain.three_wire_port.g)
PiS3 = DigitalOut(brain.three_wire_port.f)
Inert = Inertial(Ports.PORT18)
#Motor groups
LefG = MotorGroup(LeF,LeB,MiDL)
RiG = MotorGroup(RiF,RiB,MidR)
#drivetrain and Controller
DrT = SmartDrive(LefG, RiG, Inert, 300, 320, 320, MM, 1)
Cont = Controller(PRIMARY)
#Functions
def DrivE(distance,speed,direction):
DrT.set_drive_velocity(speed,PERCENT)
DrT.drive_for(direction, distance, INCHES)
def TurN(angle, speed):
DrT.turn_to_heading(angle, DEGREES)
DrT.set_turn_velocity(speed, PERCENT)
def IntaK(speed,time,direction):
inke.spin_for(direction,time)
inke.set_velocity(speed, PERCENT)
def puNch(speed,direction,time):
PunchEr.set_position(direction,time)
PunchEr.set_velocity(speed, PERCENT)
def WiNg(time,dare,bob):
PiS1.set(dare)
PiS2.set(dare)
wait(time,MSEC)
PiS1.set(bob)
PiS2.set(bob)
#Competition Code
def pre_autonomous():
count = 0
brain.screen.clear_screen()
while True:
brain.screen.print_at("Pre_Auton.... %6d"%(count), x=10, y=40)
count = count + 1
#DrT.set_stopping(COAST)
Inert.calibrate()
DrT.set_turn_constant(1.7)
DrT.set_turn_threshold(1.77)
def autonomous():
count = 0
brain.screen.clear_screen()
while True:
brain.screen.print_at("Auton.... %6d" %(count), x=10, y=40)
count = count + 1
DrivE(8,90,REVERSE)
DrivE(28,90,FORWARD)
wait(250000)
def usercontrol():
count = 0
brain.screen.clear_screen()
while True:
brain.screen.print_at("User Control.... %6d" %(count), x=10, y=40)
# controller with joy sticks
RiG.set_velocity((Cont.axis2.position() + Cont.axis1.position()),PERCENT)
LefG.set_velocity((Cont.axis2.position() - Cont.axis1.position()),PERCENT)
LefG.spin(FORWARD)
RiG.spin(FORWARD)
#Buttons
if Cont.buttonL1.pressing():
inke.set_velocity(100,PERCENT)
inke.spin(REVERSE)
elif Cont.buttonL2.pressing():
inke.set_velocity(100,PERCENT)
inke.spin(FORWARD)
else:
inke.stop()
if Cont.buttonR2.pressing():
PunchEr.set_velocity(100,PERCENT)
PunchEr.spin(FORWARD)
elif Cont.buttonR1.pressing():
PunchEr.set_velocity(100,PERCENT)
PunchEr.spin(REVERSE)
else:
PunchEr.stop()
comp = Competition(usercontrol, autonomous) #do not touch this