I was looking into the micropython documentation and say the c modules and see that you can make .mpy files i was wandering if it is possible to use it with vex v5 and if not what options can i get to get better performance in python (i cant just natively use C++ as my team uses blocks for its speed for programing also i have a different code i work on in the Sd card that is imported so any options that involve C++ use just for me is fine)
The only support we have tested for mpy files is in place of Python source code, that is, downloaded as an alternative to the python source (they are a byte code representation of the source). Whether they work from the SD card I don’t know, whether they work when containing native code I also don’t know. Note that the mpy file has to be created for the specific version of micropython used, in the case of V5 it’s 1.13.
In terms of performance, I doubt you would notice.
What do you recommend to do for better performance? Is there a way to use C++ in a python program or will i just need to try and optimize my code?
You cannot use C++ in a Python program.
Where do you feel that you need more performance ?
The speed of the execution is the biggest the ram is fine as it take multiple milliseconds to do a full loop of the program i use.
perhaps share the code.
I’ve never felt that performance was lacking for Python on a V5 running typical robot code where motors and other sensors will not respond that fast. If you are calling into many VEX API functions, it may also be the scheduler allowing other tasks to run.
here is the link to my code since i cant send it raw. Vex-v5-GitHub/vs_code/CLEAR code/CLEAR v1.1 at main · BlackHawk12222/Vex-v5-GitHub · GitHub
ok, well, I don’t know exactly which loop or code you are referring to running slow, but I do see calls printing on the controller screen.
controller_1.screen.print("Right recording.")
That will be slow in both C++ and Python as vexos enforces a 50mS delay between any text sent to the controller.
(due to low radio bandwidth)
SD Card access can also be quite slow from both Python and C++.
The code i am talking about is in CLEAR.py in log.auto_start()
I would have to run it to understand what may be the time consuming part.
I do know this will be slow
brain.sdcard.appendfile("Logstart.txt" , bytearray(funtion + ", ", self.format))
especially if the SD card has many existing files.
Sorry this is off topic but where can i find the latest updates to the firmware and stuff and see exactly what the vex v5 python can do(I am aware of the documentation for vex but i cant find the exact things that it takes from micropython)
What do you mean exactly, api.vex.com has details of the various classes, not sure there is anything else.