Is their a way to transfer code on a roboRio to a computer?

We lost our code on our hard drive but still have the code on the roboRio and I was wondering if there was any way to get it from the roboRio

Unfortunately no.

It’s not because you can’t transfer files back from the roboRIO to a computer, but rather because the “code” on the roboRIO isn’t your source code. The roboRIO only has binary files (file extension varies, depending on your programming language of choice), which are the compiled version of the source code.

There’s some chance there may be some debugging symbols in those files, but that’s a stretch…

1 Like

Sorry to read this. While this will not help on the short term, in the future you should consider setting up a GitHub repository.

This is another advantage of Python. Since python is decoded at runtime, the file you send is the code. We did not have our recent change backed up at an event last year, and were able to move our code from the Rio using winscp. Unfortunately though, this is only true of Python to my knowledge.

If you’re using Java, you can also do this because of how good Java decompilers are. I don’t know where the jar file would be located, but if you could get that, you’d basically get your source code without variable names and without comments, etc.

2 Likes

JetBrains IntelliJ is very good at decompiling. Give that a try before you give up.

1 Like

I may have some time tomorrow to navigate the folder structure to test (we were thinking of trying a java characterization file anyway). Let me know if you need help finding the java program.

If you’re using Java, the process is relatively simple:

  1. Copy FRCUserProgram.jar from the home directory of the roboRIO to your computer. If you have a Mac, any common Linux distro, or Windows with MinGW/Git Bash you can run scp lvuser@roboRIO-####-FRC.local:/home/lvuser/FRCUserProgram.jar ./ in your terminal emulator—replace #### with your team number. If asked for a password just hit enter (the password is blank.)
  2. Decompile the code in the JAR with something like d4j.
  3. Start using version control like Git.
5 Likes

d4j heavily struggles on Java 11 (having used it) and still struggles on Java 8 lambdas. Unfortunately while they decompiled code may compile, it’ll be in such a sorry state that I doubt it’d be useful

Thanks everyone, I’ll use your advice and let you know how it goes

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