Autonomous not working in Vexcode V5 Python, Day before competiton!
We orignally have had and still have a problem where our auto just never runs, I have tried several different ways for the auto function with no luck. Now Vexcode is giving me a weird error that even our most experienced programmer in pridetronics has no clue. We have a competition tomorrow and I am at a loss. I need both driver control and autonomous to work on 6 different programs, I have attached a small snip of our auto and the error it is (currently) giving me.
This isn’t Pro, it’s V5. I just didn’t realize the tag was for pro.
1 Like
I do not know that much about python, but it looks like the (wait=False)
at the end of most of your lines is causing the error. In the VEXcode python docs, for the wait parameter it says:
" Optional. Determines whether the command will block subsequent commands (wait=True
) or allow immediate execution (wait=False
). If unspecified, the default for The wait
parameter is wait=True
."
This probably caused confusion, as you are not meant to write (wait=False
), as the code tags are not around the parentheses; on the docs it is ( wait=False
), not (wait=False)
. wait
is a parameter for the function and goes inside the function, e.g.: DriveR1.set_velocity(95, PERCENT, False)
. VEXcode thinks that DriveR1.set_velocity(95, PERCENT)
evaluates to a function and you are trying to call it with a parameter of wait=False
, but since DriveR1.set_velocity(95, PERCENT)
doesn’t return a function to call (it returns nothing), VEXcode throws an error saying that what DriveR1.set_velocity(95, PERCENT)
returns (nothing) is not callable as a function.
2 Likes
So essentially, remove (wait=False) and add the false statement in the code?
2 Likes
Yes, though make sure to note that false is not a statement but a parameter, and it goes inside the function.
Update: I got it to work, I ended up tweaking the setup in Blocks then transferring to Python, and then adding the auto/driver control code and now it works great! I am now transitioning into C++ most likely as more people in the community use it and it’s a more mainstream program for programming in the real world! Thank you for the help!
1 Like
I would say to try the block code function and make sure the code is under the “When Autonomous” section of the code template. (I had a problem about forgetting to put it in the “When Autonomous” folder.
I am still having this problem