Pyfrc Units not Available on Roborio

Trying to deploy my code to the Rio, which works in the simulator.

Error message we’re getting on robot startup is:

/usr/local/lib/python3.12/site-packages/pyfrc/mains/cli_create_physics.py:5: SyntaxWarning: invalid escape sequence '\o'
    physics_starter = '''

Not sure how to get pyfrc on the Rio successfully to run with the units etc.
Here’s my pyproject.toml file:

#
# 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.2"

# 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",
    # "xrp"
]

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

Why are you trying to use pyfrc on the roborio? It’s not intended to be used there. Though, that error message is weird and in principle it should be fine installing it on the rio.

If you want to use the units library that pyfrc uses, it’s called pint and you can install that separately. Be warned that it’s not very performant and I would expect it to make your robot code very slow, so it’s probably not a good idea to use it unless you’re very careful.

1 Like

Well, it’s a good question. We had our constants.py file with pyfrc units and dimensions.

Taking that out, I got the code to deploy, and it runs without crashing now which is good…BUT

If I have a physics.py file for simulation in my repository, how do I tell the deploy process to skip the physics.py file so I don’t have any Pyfrc stuff on there at all?

Edit to add: I tried

exclude = [ "physics.py" ]

But that didn’t seem to work.

Our current repo is updated on Github: GitHub - Lambda-Corps/2024_Crescendo

For some reason I still get pyfrc invalid escape sequences in the console on deploy, but at least the code is no longer hanging/crashing.

There isn’t an exclude mechanism, but that seems useful.

There isn’t anything that’s importing physics.py on the rio, so the fact that it imports pyfrc means there’s no need to exclude it.

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