Switching languages: Python to Java

Hello, I am new on chief delphi and I’ve heard that this is the main place to go for getting info from the public so happy to be here for once. Not too familiar with how formal or what community customs I should follow so please let me know.

My team (6343) has been running on Python for a while and we have heard that the grass is greener on the other side, being Java. We plan to switch to Java but I, personally, had some worries about making sure the transfer is as smooth as possible. I specifically want to know what are some hidden pros and cons, fancy new technical stuff I would have access to and some major differences (outside of syntax)

Thank you so much, and any info given will be highly appreciated.

Chima.

5 Likes

I think a lot of the pros with java come from the community support. It’s gonna be easiest to find example code using java, and it will be easier to copy code from top teams in previous years since they mostly use java as well. It’s also easier to get help with code problems since java is the most well known language in frc.
One thing that was new to us this year but very beneficial was logging through Epilogue. It’s super simple to just add the annotation to the top of the class and automatically log all fields. This helped immensely with debugging this year.
One thing you could also do to gain experience is to re program your robot from this year in java, that way you get a headstart on programming inseason next year. Good luck and lmk any questions!

3 Likes

Thank you for your input, especially on logging. Were coming from AdvantageScope and I’ve heard of Advantage kit, do you know how that compares to Epilogue? Also thank you for the idea of re-programming our robot, I’ll probably bring that up to our mentor

Advantagekit is a lot more work to setup, but can provide some advantages like sim replay. You have to change a lot of the structure of your code with IO layers and whatnot, while epilogue is adding a single line to the top of each subsystem file.

2 Likes

What would you say is your team’s experience level with Java? Do you have mentors or members with a solid background in it? Or are you all just learning?

Our main programming mentor is pretty much fluent in java but he is relatively new to robotics since this his first year.

Would you say that the setup and different code structure is worth the benefits or is it something that is an offseason project in itself. And if were all learning java fresh, couldn’t we couple the IO layers and the extra knowledge in the learning process?

I haven’t personally used advantagekit, and for our team this year it wasnt worth it. Epilogue provided most of what we would want, with the only thing missing being sim replay. You will need to decide for yourself whether the extra functionality of advantagekit is worth it, and I’d recommend watching the video recording of the 6328 champs presentation to gain more insight for that decision.

There are some great resources to get started with “robot” programming and having someone experienced with Java should make those pretty easy to follow. And the off-season is definitely the right time to be looking into this (if you run into some unexpected trouble worst case you can always use Python for another year).

Here’s one set of instructional videos https://youtube.com/@0toauto?si=B1A6XaTu2SXUFav-

Alright sounds good, thank you so much for the input!

Oh this looks really helpful, Thanks so much for the help!

1076 was in the same spot last year. Luckily, we documented our transition, from timed-based Python to command-based Java :slight_smile:
Here’s a link to the Google Doc: FRC1076 - Switching to Java Notes - Google Docs

Would you say that the setup and different code structure is worth the benefits or is it something that is an offseason project in itself. And if were all learning java fresh, couldn’t we couple the IO layers and the extra knowledge in the learning process?

For us, we started by converting the WPiLib swerve template to be compatible with a REV drivetrain. Only after that did we move into adopting AdvantageKit. By doing this, you’ll ensure that you can learn the fundamentals of command-based programming and Java, so adopting AdvantageKit will be less of a jump.

This does take a bit longer since you’ll have to write more code. We had a lot of time during school and in the offseason, but if you’re unable to spend as much time then you may find more success in splitting the transition into two years (one year for command-based programming and the next for AdvantageKit).

Hope this helps!

2 Likes

Thank you so much for the advice, this all will be so helpful. wish us luck for our transitions.

Good luck on your transition. Conversely, our team switched from Java to Python for this year. Although different transitions, the same principles apply. While the main programming students were working on the comp bot laster year, me and my friend (both sophomores) worked on getting swerve drive first. Then we moved to other systems till we were able to fully code our comp bot in Python. Many of the principles with Java stuck with us and a senior who has experience with Java was able to work with us, and we were able to get things going smoothly.

1 Like

Is there an advantage to Java beyond community resources?

2 Likes

Java, unlike other programming languages has much broader support for libraries such as WPILib, and other sorts of programs and apps.
In addition, Java is really good with object oriented programming, this that contributes to command based development and object oriented programming in FRC to be easy and effective.

1 Like

Python has a terrible lambda syntax, and no multiline lambdas.

3 Likes

Definitely. It’s mostly not a problem though unless you’re using a framework that was designed around that paradigm, like commands.

2 Likes

Java/C++/Python all have effectively the same support for WPILib.

In the FRC world, this is mostly true, because vendors have become more important over time, and they mostly just support Java and mildly support other languages.

Outside of FRC, it really depends.

Java/C++/Python can all be effectively used for object oriented programming.

5 Likes

Which is, at least for Java teams, the defacto standard in 2025 :slight_smile: .

How to write python lambda with multiple lines? - Stack Overflow there’s always \ but…

I still come down hard on “do what your local experts have the most experience with”. And if you have no local experts, Java.

The point is that you want to minimize how much new stuff you’re learning at once. Most incoming people will be just learning “How to program a robot”, which is a different pedagogical outcome from “How to use programming language X”. Both have to be learned, but if you can separate those at all, the better your chance at success.

For the same reason, choosing to transition languages over the summer (on the same robot that you, in theory, already know how it works) is superior to transitioning in build season.

We switched Java to Python for that exact reason. Our local experts and students were much more likely to walk in the door knowing Python over Java. We’ve seen a marked improvement in how well students and mentors are able to contribute, and focus on the things that are unique to FRC.

Of note too… we were always a timed-robot team in the past, so we did not have the hump of “commands look a bit different in Python”.

3 Likes