Python 3 for the FIRST Robotics Competition (FRC)

RobotPy 2024 is now available

This is the first year that Python has been an officially supported language! Lots of changes this year.

  • The biggest change is instead of python robot.py XXX, you run python -m robotpy XXX
  • The installation process will be much smoother! Just run python -m robotpy sync and python -m robotpy deploy in a directory with your robot code and everything will get downloaded and installed on the rio.
  • commands2 is not available yet, but hopefully soon

I am still working on updating the robotpy documentation site, but lots of documentation has been done on frc-docs! See https://github.com/wpilibsuite/frc-docs/pull/2501 for new documentation on defining requirements, deploy, and more.


Note that there is a 2024-compatible version of robotpy-commands-v2 available, it’s just marked as a beta release at this time because it’s incomplete and I’m not comfortable saying that it’s good to go. If you want to use it, you can set up the following pyproject.toml next to your robot.py:

#
# Use this configuration file to control what RobotPy packages are installed
# on your RoboRIO
#

[tool.robotpy]

# Version of robotpy this project depends on
robotpy_version = "2024.1.1.1"

# Which extra RobotPy components should be installed
# -> equivalent to `pip install robotpy[extra1, ...]
robotpy_extras = [
    # "all"
    # "apriltag"
    # "commands2"
    # "cscore"
    # "navx"
    # "pathplannerlib"
    # "phoenix5"
    # "phoenix6"
    # "playingwithfusion"
    # "rev"
    # "romi"
    # "sim"
]

# Other pip packages to install
requires = [
    "robotpy-commands-v2==2024.0.0b4"
]

After that, run python -m robotpy sync and it should download/install commands v2 + the kickoff release.

RobotPy 2024 Beta 3 is now available

Python will be an official FRC language for 2024, and this is our first beta release for the season. We’ve done a lot of work on infrastructure related to RobotPy, and hopefully it will be simpler to maintain in the future.

There is no updated documentation at this time. To install the beta release, you can do pip install robotpy==2024.0.0b3. See our normal documentation for installation, deployment, etc – most things haven’t changed.

  • Development has moved to a monorepo called mostrobotpy
  • Most WPILib 2024.0.0 beta 3 features are available
    • NT4 structured binding support is not implemented
    • Python 3.8 and 3.9 support is broken, oops
  • The commands implementation is now pure python thanks to @TheTripleV, please try it out and report bugs
    • .. there are a lot of bugs
    • .. there is a lot missing – see https://github.com/robotpy/robotpy-commands-v2/issues/28
    • Do you love commands and love writing python? It would be great to have more people contribute to this.
  • REV and NavX vendors are available
    • CTRE is managing their own releases this year, and I believe it will be available soon
  • Our examples repository has a 2024-beta branch

RobotPy 2023 is now available

We’re happy to announce the release of RobotPy for 2023! Just pip3 install robotpy and you’re off and running! Well, read the install guide.

  • All WPILib 2023.1.1 features are available
  • Commands v1 is gone (yay) but Commands v2 is available
  • CTRE, PWFusion, REV vendors are available
  • robotpy-cscore has wheels now for desktop platforms, which makes it much easier to install
  • robotpy-apriltag is a thing now, check it out
  • pyntcore no longer requires pynetworktables and replaces it. Lots of API changes here because of NT4
  • Our examples repository has a lot more examples! Thanks especially to @BerkeSinanYetkin and @mrguisamuel

Python is not an official FRC language yet, but we are working with the WPILib team to make it official in 2024. See https://wpilib.org/blog/bringing-python-to-frc for the announcement.

Thanks to everyone who contributed to this release!

Robot integration testing is back!

We’re really happy to announce that py robot.py test will work once again (after upgrading to pyfrc 2022.1.0 or later)! For those who don’t remember, historically RobotPy would run a quick integration test on your code when you deploy it. It was quite useful for catching typos and other silly things that would be caught by a compiler in other languages.

Currently, we am not enabling tests on deploy by default until the stability of this feature is proven. We’ve tested it on many of our examples, so we’re reasonably confident that it isn’t entirely useless.

Please try this out and let me know if it works (or not) for your robot!

Known Issues

If you use REV robotics motor controllers, the test program may hang after tests complete. I’ve alerted the vendor but they still haven’t released a fix.

RobotPy 2022 now available

We’re happy to announce the release of RobotPy for 2022!

  • WPILib 2022.2.1 libraries with most features
  • Old commands (please stop using it!) and new commands
  • All supported vendors – CTRE, NavX, PWFusion, Rev, Romi

Everything is very lightly tested, and I’ve only tested the core WPILib stuff on a roboRIO. Try it out, find a bug, file an issue on github!

Later this season, we will bringing back pytest support for your robot! I’ve definitely missed it, and I think I have an approach that will work (want it to come sooner? Implement #3867 for me!).

The documentation and examples have not been updated yet. We would love your help doing that! Please.

Thanks as always to @auscompgeek and @TheTripleV for their help getting this season’s release out.