The good news is, all the non-vendor source code upgrades were actually done awhile ago (AND if you were really motivated, all of the source repos have a 2024-beta branch that builds and works if you install the beta version of robotpy-build – but this is complicated and so most people probably shouldn’t do this, but you could).
The even better news is that Python definitely will be an official language in 2024, and as part of that I’ve been working on a lot of infrastructurey related things that will make it easier for other people in the WPILib team to help maintain RobotPy related projects
The bad news is that those infrastructure related projects take time, and I have less of that at the moment, but hopefully will be done soon.
What can you do to help?
I don’t personally have time to update frc-docs with python examples. But maybe you do? I’d love to see a dozen pull requests on frc-docs with python related updates (but just code examples for now! don’t bother with install related things)
Leave a message on here telling everyone how you’re looking forward to RobotPy this year!
I’m really looking forward to RobotPy becoming official. It’s actually been quite nice to teach new students in Python, it’s just cleaner and simpler for beginners than Java (in my observation with our students).
I am more than happy to try out the PR for command-based, not quite sure how to do it. I’m not really a Pythonista by any stretch. Don’t know the exact mechanics in swapping out just the robotpy pieces, when I’d still need things like robotpy-ctre as a dependency as one example.
I will think about what I can do to get python examples into frc-docs as well. Might be a do-able thing for me.
I’m a programming mentor and am very excited to see robotpy being officially supported! My experience with it has been the same as @NewtonCrosby - it just seems like it’s been a lot easier to work with new programming students in Python.
I’ve left a couple comments in the PR. I’m not entire sure about whether my testing of it is correct. If anyone else has better insight as to how to properly test the PR let me know.
My methodology has been:
Clone the repo
Create and activate virtual environment
Install robotpy (but not commands2 or any extras)
Run setup.py develop (in this repos base directory)
question: Is robotpy close enough to the previously supported wpilib language structures that once I learn how write those structures I can use my previous knowledge to make robot code? Or would I need to relearn how to structure my robot projects? (for reference I use the command based structure)
I deleted them for a bit, because I know that I broke the test setup. Running setup.py develop wasn’t using the virtualenv, so I was in a weird frankenstate with packaging. Trying again with just setup build to try and get only the commands2 package from the forked repo.
The answer is generally yes, but I suggest you compare the RobotPy examples with their equivalents in WPILibJ (they are typically going to be one to one) to evaluate the answer to that yourself.
Okay, I restructured my testing of the PR for the pure Python command implementation.
Some of the observations for posterity:
1 - Inline commands defined in the subsystem no longer pass the self as a list, and in fact, you get a runtime error if you do.
# Move the arm to neutral position when the 'B' button is pressed.
self.driverController.B().onTrue(
self.robotArm.setArmGoalCommand(constants.kArmOffsetRads)
)
So each of those will need to lowercase the Button binding.
Those individual pieces, along wtih the global set of changes of changing all references for CommandBase and SubsystemBase and everything has been working just fine.
Tomorrow I’ll try to port our 2023 robot written in Java to Python (with the pure python commands2) but I expect it will work well.