586B_V_3.v5python (7.5 KB)
I think you’ll have to update your brain firmware. It worked for me
2 Likes
It works for a little bit at first, but it eventually throw that error. I’ve tried it on two different brains and it still throws the error. Also, I did check and the brain is currently up to date.
Move the controller button event registration outside of your while loop.
every time you call
controller_1.buttonL1.pressed
you are registering a new event handler on that button, you run out of resources almost immeadiately and cause some type of issue with the Python VM.
def user_control():
brain.screen.clear_screen()
# place driver control in this while loop
while True:
wait(20, MSEC)
left_front.spin(FORWARD)
left_rear.spin(FORWARD)
right_front.spin(FORWARD)
right_rear.spin(FORWARD)
left_front.set_velocity((controller_1.axis3.position()), PERCENT)
left_rear.set_velocity((controller_1.axis3.position()), PERCENT)
right_front.set_velocity((controller_1.axis2.position()), PERCENT)
right_rear.set_velocity((controller_1.axis2.position()), PERCENT)
# create competition instance
comp = Competition(user_control, autonomous)
pre_autonomous()
controller_1.buttonL1.pressed(controller_L1_Pressed)
controller_1.buttonL2.pressed(controller_L2_Pressed)
controller_1.buttonR1.pressed(controller_R1_Pressed)
controller_1.buttonR2.pressed(controller_R2_Pressed)
9 Likes