Programming with External Python Libraries (or Running Code on Computer)

I’m not in the VEX competition, but was just experimenting with code using VEX V5 Python and wanted to use some external processor-intensive libraries for motion planning.

Is there any way to run the code on my computer sending live instructions to the robot instead of the code running locally on the robot? Or is there a way to install Python packages on the robot?

Python on the v5 is meant for simple programs so you won’t be able to use external libraries directly in your code. Instead you need to download the libraries onto a mini SD card and insert that into the brain, then you can access it in your program. However take this with a grain of salt as I have not tried it myself, just heard about it from reading previous forum posts.

This JPearman’s post shows how to import a Python library onto the brain using SD card:

Ok, thanks. What about somehow running the code on your computer which sends live instructions to the brain? In that case, the packages could be installed on the computer and I wouldn’t need to deal with the brain and its slow processor/limited packages.

Or could I send preprocessed data from the computer to the brain while a program is running?

You would have to run code on the V5 to send/receive commands from/to the PC. It’s been done before, but is probably not for beginners. On V5 you would be using stdio, that uses CDC (serial over USB) on the V5 USB port.

1 Like

Can you provide some sample code for CDC and stdio? Does the computer have to be connected with a wire to the brain while the code is running? Could it be done wirelessly?

Nope, I do not have time this year. But use search, it’s not that hard.

So on V5 it’s far more complicated to do that, EXP and IQ Generation 2 it’s pretty much the same as when directly connected.

1 Like

I’m also in VEX U fyi but we’re not competing this year.

Ok thanks for the help!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.