When I try typing in all of the correct stuff on python for our autonomous and when we download it and do a time run it does nothing. Anyone know how to fix this?
Are you using VSCode? Any errors? Please specify.
There’s no errors. We had our best top 3 people who know VEXcode python that remember everything about it and they went through our code and they said that it was perfectly fine.
Can you share your code so we can figure out what’s wrong? Have you tried a different brain/controller? Does it work when connected to a match switch?
We haven’t tried the match switch and I’ll be able to show you guys the code sometime tomorrow most likely
Trust me, even when you think there are no errors, there are likely some errors. They may not be errors in the sense that it is syntactically incorrect, but more so an issue with patterns in the code being incorrect, thus causing the issue.
#region VEXcode Generated Robot Configuration
from vex import *
import urandom
# Brain should be defined by default
brain=Brain()
# Robot configuration code
controller_1 = Controller(PRIMARY)
motor_1 = Motor(Ports.PORT1, GearSetting.RATIO_18_1, False)
motor_2 = Motor(Ports.PORT2, GearSetting.RATIO_18_1, False)
motor_3 = Motor(Ports.PORT3, GearSetting.RATIO_18_1, False)
motor_4 = Motor(Ports.PORT4, GearSetting.RATIO_18_1, False)
motor_5 = Motor(Ports.PORT5, GearSetting.RATIO_18_1, False)
motor_6 = Motor(Ports.PORT6, GearSetting.RATIO_18_1, False)
Wings = DigitalOut(brain.three_wire_port.h)
motor_group_8_motor_a = Motor(Ports.PORT8, GearSetting.RATIO_6_1, True)
motor_group_8_motor_b = Motor(Ports.PORT9, GearSetting.RATIO_6_1, False)
motor_group_8 = MotorGroup(motor_group_8_motor_a, motor_group_8_motor_b)
# wait for rotation sensor to fully initialize
wait(30, MSEC)
def play_vexcode_sound(sound_name):
# Helper to make playing sounds from the V5 in VEXcode easier and
# keeps the code cleaner by making it clear what is happening.
print("VEXPlaySound:" + sound_name)
wait(5, MSEC)
# add a small delay to make sure we don't print in the middle of the REPL header
wait(200, MSEC)
# clear the console to make sure we don't have the REPL in the console
print("\033[2J")
#endregion VEXcode Generated Robot Configuration
# ------------------------------------------
#
# Project: VEXcode Project
# Author: VEX
# Created:
# Description: VEXcode V5 Python Project
#
# ------------------------------------------
# Library imports
from vex import *
# Begin project code
controller_1 = Controller(PRIMARY)
leftdrive = MotorGroup(motor_1, motor_2, motor_3)
rightdrive = MotorGroup(motor_4, motor_5, motor_6)
motor_group_8.set_velocity(100, PERCENT)
drivetrain = MotorGroup(leftdrive, rightdrive)
def motorlock():
drivetrain.set_stopping(HOLD)
if controller_1.buttonUp.pressing():
motorlock
if controller_1.buttonDown.pressing():
drivetrain.set_stopping(COAST)
def autonomous():
drivetrain.set_velocity(65, PERCENT)
drivetrain.set_max_torque(50, PERCENT)
drivetrain.spin_for(FORWARD, 4, TURNS)
def driver_control():
# Main Controller loop to set motors to controller axis positions
while True:
leftdrive.set_velocity((controller_1.axis3.position() + controller_1.axis1.position()), PERCENT)
rightdrive.set_velocity((controller_1.axis3.position() - controller_1.axis1.position()), PERCENT)
rightdrive.spin(FORWARD)
leftdrive.spin(REVERSE)
wait(5, MSEC)
if controller_1.buttonL1.pressing():
motor_group_8.spin(FORWARD)
if controller_1.buttonL2.pressing():
motor_group_8.stop()
if controller_1.buttonA.pressing():
Wings.set(True)
if controller_1.buttonB.pressing():
Wings.set(False)
competition = Competition(autonomous, driver_control)
that’s our code so yeah.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.