Does the roborio Package code before its run or run it directly from the files?

I’m working on a tool for teams without programming departments and Part of the tool is being able to list all classes within a certain directory. It lead me to asking if the roborio actually packages the code it runs or if its just running the whole project directory from root.

For Java/C++, the development environment compiles (not packages) the code into an executable before sending it to the RIO.
Neither Java nor C++ have been designed to run directly as source code directories.
For LabView, probably not applicable.
For Python see below.


Python does run exactly as source code however. We have pulled our code off the Rio, modified it, and sent it back. We acrually did it at an event once (before we learned to back our code up).


@OP it may be worthwhile to spend a bit of time doing more description of your thoughts and questions. I suspect there’s a knowledge gap here. The vocabulary you’re using is somewhat non-standard for this space - it seems you’re a bit too far down the rabbit hole in the wrong direction.

If you’re willing to back up a few steps, I know folks around here love to help students deep dive topics like this - I’m sure they could set you on the straight and narrow real quick!

A few leading questions in this backing-up process:

  1. What’s the end usage of the tool? What sorts of information will it need to collect, and how does it improve the lives of its users?
  2. Can you provide an example of “classes within a certain directory” you’d want to gather information about?
  3. Are you limiting scope to any particular programming language(s)?
  4. Can you describe what steps you currently know happen during the code “Deploy” process for the robot? I suspect your “packaging” comment relates to part of Deploy, but I’m not 100% sure.

It’s totally cool if you’re not super knowledgeable (yet) on any of these topics - I just want to be sure I’m not re-feeding you info you already have.


@gerthworm Thats fine! I actually should’ve described more. Essentially I want to make a system that uses a series of “Module” classes that are loaded at run time instead of a compilation. The problem is that I want the system to run any module it’s given which means i need a way to give it the modules and as such My idea is for the java program to be run is to check for all class files in the package and dynamically construct them. The setup front end handles assinging ports through an xml file (Note still in construction. Working on getting the back end stuff first)

1 Like

I’ve tried looking into the reflection api and It may be able to be done with it but i need to find a clear tutorial on how to use it

You could use something like and precompile your modules into your project’s deploy directory so that they are copied to the robot and can be loaded at runtime.

However, what is the purpose of loading the modules at runtime instead of compilation? See What is the XY problem?. I don’t have enough information to see the big picture. Are you trying to do some GUI-based code generation? In that case, I think you’re going to have an easier time generating a static project like RobotBuilder does rather than building out a complicated plugin system.

Hmm, I can’t say I’ve done anything like this in Java. It sounds similar to how “Plugins” or Dynamically Linked Libraries might be used. Here’s another lead on a way to do it in java. But I’d be hard pressed to tell you which way to start looking.

To add on to Connor’s point, yes, this does currently smell a bit like a solution in search of a problem. That’s not necessarily a bad thing but… A key component of getting really solid help online is convincing your audience of the importance of your problem, so they’re motivated to help you solve it. The good news, on this forum, the single best way to ask a question - “I am looking to learn about X. Tell me about X”.

If you are going to continue down this path, be aware of some changes in Java 9+ that will change how you want to dynamically load jar files (and their subsequent classes). I say be aware, because I think you’ll find many “solutions” that only apply to Java 8 and below (or at least those will bubble up to the top of searches).

There are some good use cases for plugins. I’m not sure many apply to FRC. I think you’ll find re-deploying your robot code with different options enabled to be just as fast as using plug-in .jars, and it’s already available and works.

That being said, it can be fun and educational to try out something new that has seemingly little value. Sometimes you climb the mountain just because it’s there, even if there’s a convenient tunnel straight through. Look into classloaders, and spend some time thinking about what it would mean to “run any module” and “check for all class files and dynamically construct them.” Think about what that means even without the dynamic loading part. What do you have to know to “run” any piece of code, and does this impact what you’re trying to accomplish.

Alrighty Well as Connor.Worley accurately guessed I’m trying to make GUI-based code generation similar to robot builder however my base concept is that instead of the code being generated by the computer it instead is modified from plugin classes. Imagine your on a build team and your get unforntantly stuck on setting up the robo rio. You know nothing of code you just know what port and what specific devices your using. So you would look for a victorsp drivetrain module with a few others and load it into the program to configure the port values and other variables that need to be user defined. The reason I wanna do it modularly is so that we can get a more efficiant system because at the current moment robot builder currently does not support using the api specific methods and interfaces. seems to only support “Low level” Control.

I think you might not quite grasp the scale of what you’re trying to do - code generation is a substantial undertaking, and if you’re not already quite familiar with java packaging and deployment this might not be the right direction for your efforts.

1 Like

What would those “few others” be and what sort of contract would you need between the modules (and the main robot code) to run correctly? Beyond the complexities of loading modules dynamically, you’ll have to spend time planning how everything interacts or else you’ll end up with a mess.

I haven’t used RobotBuilder so I don’t know what functionality it’s missing, or what is inefficient, but just scanning the documentation, it looks like a pretty useful tool? The RobotBuilder source code is available on the wpilib github. As another option, have you considered extending RobotBuilder to do what you want?

If you want to go the module route no matter what, if for no other reason than to try something out, then continue posting when you get stuck and I’m sure someone will try to help. But if you’re intent on solving the problem of “team has no programmers” I think there are much simpler solutions. Point team to wpilib documentation, point team to example programs (the tankdrive example for instance), and give them some info on what to modify to make it work for them, is a better start. Maybe I’m missing some part of what you want to do, but the “team without programmers” is still going to have to have some robot code running to use your modules.

To put a slightly different spin on what others are saying:

Good answers to questions don’t necessarily answer the question asked. Rather, they push the asker toward success. This is the implicit pact of between the asker and the answerer - if a person can’t help move you toward success, they shouldn’t provide an answer.

Where you’re encountering some resistance is that people don’t know how to help you have success within the parameters you’re defining. I would recommend you make at least one of these changes to how you’re posing your questions:

  1. Take a few steps backward, and look at the fundamental problem being solved. Explore all the possible ways to solve it. Put parameters on what constitutes “better” or “worse” answers. Do the selection process to determine which solution is best.
  2. Reframe the questions you’re asking to be “I would like to learn more about specific technology X. What are good resources for learning about X?”.

The core issue I see right now is you’re trying to do both the design and learning simultaneously, which gets really dicey really quick.

FWIW: Good engineers are doing #1 in their heads, all the time. Once you know lots of technologies, on the small scale, you get skilled at making these decisions quickly - even to the extent that to an external observer it looks instantaneous and transparent. Doing #2 is part of the groundwork for being able to do #1 independently of input from others.

1 Like

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