@John_TYler - wondering if you saw code before some changes were made to it? I can only see 395 lines in the present online code. So perhaps the issue you point out was already fixed…
What I found in the code is that it is mixing tabs and spaces, which is not allowed in python generally. Due to the exceptionally weak lint check that RobotMesh Studio has, it does not complain at all. This is a bug which should be fixed, Vex!! (Students: Lint checking is a part of a standard software tool flow that looks for silly mistakes we all make - missing semi-colons, brackets, etc. Its designed to help us find syntactical errors in our code. Really good lint checkers are capable of finding simple programatic errors too. They are REALLY helpful!)
The specific issue is in the def drivercontrol(): currently residing from lines 334-384. Using a modern IDE which allows to see invisibles, you can clearly see tabs and spaces mixed. Remove the tabs and replace with FOUR spaces, and the code will most likely work.
If you ever wonder if your code has this issue a really simple way is to check using python3 on your Mac or PC from a terminal window. you can literally type python3 code.py
and it will respond with something like:
python3 CyberBot_Code.py
File "CyberBot_Code.py", line 338
drive_right_power = 0
^
TabError: inconsistent use of tabs and spaces in indentation
(note the ^ does not show the correct place in this post because its not a monospace font. The part that matters is the “TabError” line.)
If a program does not have this issue, it will likely instead fail looking for the vex lib since I do not have that installed in my Python install. e.g. :
python3 CyberBot_Code.py
Traceback (most recent call last):
File “CyberBot_Code.py”, line 3, in
import vex
ModuleNotFoundError: No module named ‘vex’
You can use python3 as a lint check that Robot Mesh Studio ought to be doing for you.
Students: There is an important and not so obvious lesson here. Some editors default to using tabs when you edit code. Some convert your spaces to tabs. Some convert your tabs to spaces. Most leave your code alone. If you copy and paste code outside of Robot Mesh Studio, it may make changes like this to your code and you will likely never see them. Make sure you check your code for proper syntax before you paste it back in. In particular, if your editor you are using allows you to show invisibles, that is a great way to visually check.
An even better way is to be able to search for tabs. That can often be done by searching for \t
in your find window. If you find any tabs, replace them with FOUR spaces. We engineers have developed strategies like these to avoid these kinds of issues - because we have been burned by them. ;). BTW - I did try that in Robot Mesh Studio and \t does not work in the search window.
Good luck at State teams!
Hope that helps