I am getting the error:
Program running, receiving output...
Adding image: main
Program size 5 kb.
Compile done. Time: 1289 ms
Listening for output...
Download done. Time: 1576 ms
Debugger engine started.
EXCEPTION: 0xEA Name error
__FILE_ID__ 0x09 / Line 1756
[File "main", line 172, in drivercontrol
](chrome-extension://ablgfcdjafdflgnbbbffcdginlaoembf/project.html?id=1#)INPUT ERROR: BytesToRead: ClearCommError failed
on this line of code:
Tilt.stop(vex.BrakeType.COAST)
. and when I comment out the line of code, the error moves to the next line of code.
Our full code
ββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββRobotics βββββββββββββββββββ
ββββββββββββββ Is The βββββββββββββββββββ
ββββββββββββββ Best βββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββ
_______β__________ββββββββββββββ
______β_______________ββββββββ
_____β________________ββββββββ
____β___________ββββββββββββββββββ
___β
__β______βββββββββββββββββββββββββββββββββββ
_β______βββββββββββββββββββββββββββββββββββ
ββββ___βββββββββββββββββββββββββββββββββββ
ββββ__βββββββββββββββββββββββββββββββββββ
βββ__βββββββββββββββββββββββββββββββββββ
ββ
VEX V5 Python Project with Competition Template
import sys
import vex
from vex import *
#region config
brain = vex.Brain()
Right_Front = vex.Motor(vex.Ports.PORT11, vex.GearSetting.RATIO18_1, True)
Right_Back = vex.Motor(vex.Ports.PORT12, vex.GearSetting.RATIO18_1, True)
Left_Front = vex.Motor(vex.Ports.PORT1, vex.GearSetting.RATIO18_1, False)
Left_Back = vex.Motor(vex.Ports.PORT2, vex.GearSetting.RATIO18_1, False)
#Tilt = vex.Motor(vex.Ports.PORT7, vex.GearSetting.RATIO36_1, False)
#Intake_Left = vex.Motor(vex.Ports.PORT10, vex.GearSetting.RATIO18_1, True)
#Intake_Right = vex.Motor(vex.Ports.PORT20, vex.GearSetting.RATIO18_1, False)
Arms = vex.Motor(vex.Ports.PORT19, vex.GearSetting.RATIO18_1, False)
Autton_1 = vex.Limit(brain.three_wire_port.a)
Autton_2 = vex.Limit(brain.three_wire_port.b)
Autton_3 = vex.Limit(brain.three_wire_port.c)
Autton_4 = vex.Limit(brain.three_wire_port.d)
Autton_5 = vex.Limit(brain.three_wire_port.e)
Autton_6 = vex.Limit(brain.three_wire_port.f)
Autton_7 = vex.Limit(brain.three_wire_port.g)
Autton_8 = vex.Limit(brain.three_wire_port.h)
con = vex.Controller(vex.ControllerType.PRIMARY)
#endregion config
Right = None
Left = None
Drive_Speed = None
Speed = None
def Drive(Right, Left, Drive_Speed):
Right_Front.set_velocity(Drive_Speed, vex.VelocityUnits.PCT)
Right_Back.set_velocity(Drive_Speed, vex.VelocityUnits.PCT)
Left_Front.set_velocity(Drive_Speed, vex.VelocityUnits.PCT)
Left_Back.set_velocity(Drive_Speed, vex.VelocityUnits.PCT)
Right_Front.start_rotate_for(vex.DirectionType.FWD, Right, vex.RotationUnits.REV)
Right_Back.start_rotate_for(vex.DirectionType.FWD, Right, vex.RotationUnits.REV)
Left_Front.start_rotate_for(vex.DirectionType.FWD, Left, vex.RotationUnits.REV)
Left_Back.rotate_for(vex.DirectionType.FWD, Left, vex.RotationUnits.REV)
def Turn_Intake(Speed):
Intake_Left.spin(vex.DirectionType.FWD, Speed, vex.VelocityUnits.PCT)
Intake_Right.spin(vex.DirectionType.FWD, Speed, vex.VelocityUnits.PCT)
Creates a competition object that allows access to Competition methods.
competition = vex.Competition()
def pre_auton():
# All activities that occur before competition start
# Example: setting initial positions
pass
Autton_5 is Red Procted
Autton_6 is Red UnProcted
Autton_7 is Blue Procted
Autton_8 is Blue UnProcted
def autonomous():
if Autton_5.pressing():
Drive(1, 1, 50)
Drive(-1, -1, 50)
elif Autton_6.pressing():
Drive(1, 1, 50)
Drive(-1, -1, 50)
elif Autton_7.pressing():
Drive(1, 1, 50)
Drive(-1, -1, 50)
elif Autton_8.pressing():
Drive(1, 1, 50)
Drive(-1, -1, 50)
elif Autton_1.pressing():
# Turn_Intake(None)
Drive(None, None, None)
Turn_Intake(None)
Drive(None, None, None)
Drive(None, None, None)
sys.sleep(1)
Drive(None, None, None)
Drive(None, None, None)
Drive(None, None, None)
Turn_Intake(None)
Drive(None, None, None)
Drive(None, None, None)
Drive(None, None, None)
brain.screen.print_line(1, 'No Jumper in Programed Port!')
con.screen.set_cursor(1, 1)
con.screen.print_('No Jumper in Programed Port!')
elif Autton_2.pressing():
brain.screen.print_line(1, βNo Jumper in Programed Port!β)
con.screen.set_cursor(1, 1)
con.screen.print_(βNo Jumper in Programed Port!β)
elif Autton_3.pressing():
brain.screen.print_line(1, βNo Jumper in Programed Port!β)
con.screen.set_cursor(1, 1)
con.screen.print_(βNo Jumper in Programed Port!β)
elif Autton_4.pressing():
brain.screen.print_line(1, βNo Jumper in Programed Port!β)
con.screen.set_cursor(1, 1)
con.screen.print_(βNo Jumper in Programed Port!β)
else:
brain.screen.print_line(1, βNo Jumper In The Robot!β)
con.screen.set_cursor(1, 1)
con.screen.print_(βNo Jumper!β)
pass
pass
def drivercontrol():
# Place drive control code here, inside the loop
# This code will run onece:
Intake = 0
while True:
# This code will repete
# This is the main loop for the driver control.
# Drive the robot using tank drive
con.set_deadband(10, vex.PercentUnits.PCT)
# Right_Front.spin(vex.DirectionType.FWD, (con.axis2.position(vex.PercentUnits.PCT)*0.65), vex.VelocityUnits.PCT)
# Right_Back.spin(vex.DirectionType.FWD, (con.axis2.position(vex.PercentUnits.PCT)*0.65), vex.VelocityUnits.PCT)
# Left_Front.spin(vex.DirectionType.FWD, (con.axis3.position(vex.PercentUnits.PCT)*0.65), vex.VelocityUnits.PCT)
# Left_Back.spin(vex.DirectionType.FWD, (con.axis3.position(vex.PercentUnits.PCT)*0.65), vex.VelocityUnits.PCT)
Right_Front.spin(vex.DirectionType.FWD, ((con.axis2.position(vex.PercentUnits.PCT)/100)**3)*100, vex.VelocityUnits.PCT)
Left_Front.spin(vex.DirectionType.FWD, ((con.axis2.position(vex.PercentUnits.PCT)/100)**3)*100, vex.VelocityUnits.PCT)
Right_Back.spin(vex.DirectionType.FWD, ((con.axis2.position(vex.PercentUnits.PCT)/100)**3)*100, vex.VelocityUnits.PCT)
Left_Back.spin(vex.DirectionType.FWD, ((con.axis2.position(vex.PercentUnits.PCT)/100)**3)*100, vex.VelocityUnits.PCT)
# Move the tilt tray if the buttons get pushed
if con.buttonA.pressing():
Tilt.spin(vex.DirectionType.FWD, 30, vex.VelocityUnits.PCT)
elif con.buttonB.pressing():
Tilt.spin(vex.DirectionType.REV, 30, vex.VelocityUnits.PCT)
else:
Tilt.stop(vex.BrakeType.COAST)
Tilt.spin(vex.DirectionType.REV, 0, vex.VelocityUnits.PCT)
Tilt.stop
#Spin the intake if the burrons are pushed
if con.Left.pressing():
Intake_Left.spin(vex.DirectionType.FWD, 100, vex.VelocityUnits.RPM)
elif con.Down.pressing():
Intake_Left.spin(vex.DirectionType.REV, 100, vex.VelocityUnits.RPM)
else:
Intake_Left.spin(vex.DirectionType.FWD, 0, vex.VelocityUnits.RPM)
if con.Up.pressing():
Intake_Right.spin(vex.DirectionType.FWD, 100, vex.VelocityUnits.RPM)
elif con.Right.pressing():
Intake_Right.spin(vex.DirectionType.REV, 100, vex.VelocityUnits.RPM)
else:
Intake_Right.spin(vex.DirectionType.FWD, 0, vex.VelocityUnits.RPM)
if con.R1.pressing():
Arms.spin(vex.DirectionType.FWD, 30, vex.VelocityUnits.PCT)
elif con.R2.pressing():
Arms.spin(vex.DirectionType.REV, 30, vex.VelocityUnits.PCT)
else:
Arms.stop(vex.BrakeType.COAST)
Arms.spin(vex.DirectionType.REV, 0, vex.VelocityUnits.PCT)
Arms.stop
if con.L1.pressing():
Intake_Left.spin(vex.DirectionType.FWD, 100, vex.VelocityUnits.RPM)
Intake_Right.spin(vex.DirectionType.FWD, 100, vex.VelocityUnits.RPM)
elif con.L2.pressing():
Intake_Left.spin(vex.DirectionType.REV, 100, vex.VelocityUnits.RPM)
Intake_Right.spin(vex.DirectionType.REV, 100, vex.VelocityUnits.RPM)
else:
Intake_Left.spin(vex.DirectionType.FWD, 0, vex.VelocityUnits.RPM)
Intake_Right.spin(vex.DirectionType.FWD, 0, vex.VelocityUnits.RPM)
sys.sleep(0.2)
pass
Do not adjust the lines below
Set up (but donβt start) callbacks for autonomous and driver control periods.
competition.autonomous(autonomous)
competition.drivercontrol(drivercontrol)
Run the pre-autonomous function.
pre_auton()
Robot Mesh Studio runtime continues to run until all threads and
competition callbacks are finished.
Thanks in advance for your help!