Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CLAUDE.md
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be commited

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- never work on an issue that already has a PR fixing it
25 changes: 14 additions & 11 deletions source/docs/software/python/pyproject_toml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,34 @@ The ``pyproject.toml`` file looks something like this:
[tool.robotpy]
# Version of robotpy this project depends on
robotpy_version = "2024.2.1.0"
# Which extra RobotPy components should be installed
# Which core WPILib components should be installed
# -> equivalent to `pip install robotpy[extra1, ...]
robotpy_extras = [
components = [
# "all"
# "apriltag"
# "commands2"
# "cscore"
# "navx"
# "pathplannerlib"
# "phoenix5"
# "phoenix6"
# "playingwithfusion"
# "rev"
# "romi"
# "sim"
# "xrp"
]
# Other pip packages to install (including vendor packages)
requires = [
# Vendor packages (examples):
# "robotpy-navx"
# "robotpy-pathplannerlib"
# "robotpy-ctre" # Phoenix 5
# "phoenix6"
# "robotpy-playingwithfusion"
# "robotpy-rev"
]
# Other pip packages to install
requires = []
```

Each of the following will instruct the deploy process to install packages to the roboRIO:

``robotpy_version`` is the version of the ``robotpy`` PyPI package that this robot code depends on.

``robotpy_extras`` defines extra RobotPy components that can be installed, as only the core RobotPy libraries are installed by default.
``components`` defines which optional core WPILib packages should be installed (equivalent to ``pip install robotpy[component1, ...]``). Only core WPILib packages can be specified here; vendor packages must be listed in ``requires``.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional core sounds wierd, I think here just optional WPILib packages is ok.


``requires`` is a list of strings, and each item is equivalent to a line of a [requirements.txt](https://pip.pypa.io/en/stable/reference/requirements-file-format/) file. You can install any pure python packages on the roboRIO and they will likely work, but any packages that have binary dependencies must be cross-compiled for the roboRIO. For example, if you needed to use ``numpy`` in your robot code:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ If you're interested in just switching what the driver sees, and are using Smart
```toml
[tool.robotpy]
...
# Add cscore to the robotpy-extras list
robotpy_extras = ["cscore"]
# Add cscore to the components list
components = ["cscore"]
```

If you're using some other dashboard, you can change the camera used by the camera server dynamically. If you open a stream viewer nominally to camera1, the robot code will change the stream contents to either camera1 or camera2 based on the joystick trigger.
Expand Down Expand Up @@ -259,8 +259,8 @@ By default, the cscore library is pretty aggressive in turning off cameras not i
```toml
[tool.robotpy]
...
# Add cscore to the robotpy-extras list
robotpy_extras = ["cscore"]
# Add cscore to the components list
components = ["cscore"]
```

.. note::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ In the following example a thread created in ``Robot`` constructor gets the Came
:lines: 12-55
:linenos:

You need to update ``pyproject.toml`` contents to include cscore in the robotpy-extras key (this only shows the portions you need to update):
You need to update ``pyproject.toml`` contents to include cscore in the components key (this only shows the portions you need to update):

```toml
[tool.robotpy]
...
# Add cscore to the robotpy-extras list
robotpy_extras = ["cscore"]
# Add cscore to the components list
components = ["cscore"]
```

Notice that in these examples, the ``PutVideo()`` method writes the video to a named stream. To view that stream on SmartDashboard or Shuffleboard, select that named stream. In this case that is "Rectangle".
88 changes: 45 additions & 43 deletions source/docs/software/vscode-overview/3rd-party-libraries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,52 +42,54 @@ Vendor dependencies are installed on a per-project basis (so each robot project
.. tab-item:: Python
:sync: python

All RobotPy project dependencies are specified in ``pyproject.toml``. You can add additional vendor-specific dependencies either by:
All RobotPy project dependencies are specified in ``pyproject.toml``. You can add additional dependencies by:

* Adding the component name to ``robotpy_extras``
* Adding the PyPI package name to ``requires``
* Adding WPILib component names to ``components`` (for core WPILib packages built by WPILib only)
* Adding PyPI package names to ``requires`` (for all vendor packages and other dependencies)

.. important:: Only core WPILib packages can be specified in ``components``. All vendor packages must be listed in ``requires``.

.. seealso:: :doc:`/docs/software/python/pyproject_toml`

Optional WPILib components:

+----------+----------------+---------------------+
| | robotpy_extras | requires |
+==========+================+=====================+
| Apriltag | apriltag | robotpy-apriltag |
+----------+----------------+---------------------+
| Commands | commands2 | robotpy-commands-v2 |
+----------+----------------+---------------------+
| cscore | cscore | robotpy-cscore |
+----------+----------------+---------------------+
| Romi | romi | robotpy-romi |
+----------+----------------+---------------------+
| XRP | xrp | robotpy-xrp |
+----------+----------------+---------------------+

Optional vendor-specific components (not all are available at the beginning of the season):

+---------------------+-----------+-------------------+---------------------------+
| | Origin | robotpy_extras | requires |
+=====================+===========+===================+===========================+
| ChoreoLib | Vendor | | sleipnirgroup-choreolib |
+---------------------+-----------+-------------------+---------------------------+
| CTRE Phoenix 6 | Vendor | phoenix6 | phoenix6 |
+---------------------+-----------+-------------------+---------------------------+
| CTRE Phoenix 5 | Community | phoenix5 | robotpy-ctre |
+---------------------+-----------+-------------------+---------------------------+
| PathPlannerLib | Vendor | pathplannerlib | robotpy-pathplannerlib |
+---------------------+-----------+-------------------+---------------------------+
| PhotonVision | Vendor | photonvision | photonlibpy |
+---------------------+-----------+-------------------+---------------------------+
| Playing With Fusion | Community | playingwithfusion | robotpy-playingwithfusion |
+---------------------+-----------+-------------------+---------------------------+
| REVLib | Community | rev | robotpy-rev |
+---------------------+-----------+-------------------+---------------------------+
| Studica | Community | navx | robotpy-navx |
+---------------------+-----------+-------------------+---------------------------+
| URCL | Community | | robotpy-urcl |
+---------------------+-----------+-------------------+---------------------------+
Optional WPILib components (use ``components``):

+----------+------------+
| | components |
+==========+============+
| Apriltag | apriltag |
+----------+------------+
| Commands | commands2 |
+----------+------------+
| cscore | cscore |
+----------+------------+
| Romi | romi |
+----------+------------+
| XRP | xrp |
+----------+------------+

Vendor packages (use ``requires``, not all are available at the beginning of the season):

+---------------------+-----------+---------------------------+
| | Origin | PyPI Package Name |
+=====================+===========+===========================+
| ChoreoLib | Vendor | sleipnirgroup-choreolib |
+---------------------+-----------+---------------------------+
| CTRE Phoenix 6 | Vendor | phoenix6 |
+---------------------+-----------+---------------------------+
| CTRE Phoenix 5 | Community | robotpy-ctre |
+---------------------+-----------+---------------------------+
| PathPlannerLib | Vendor | robotpy-pathplannerlib |
+---------------------+-----------+---------------------------+
| PhotonVision | Vendor | photonlibpy |
+---------------------+-----------+---------------------------+
| Playing With Fusion | Community | robotpy-playingwithfusion |
+---------------------+-----------+---------------------------+
| REVLib | Community | robotpy-rev |
+---------------------+-----------+---------------------------+
| Studica | Community | robotpy-navx |
+---------------------+-----------+---------------------------+
| URCL | Community | robotpy-urcl |
+---------------------+-----------+---------------------------+

When using ``requires``, you can specify a version by appending ``==<version>`` to the package name, e.g. ``robotpy-commands-v2==2024.0.0``. If you do not specify a version, the latest version will be installed.

Expand Down Expand Up @@ -155,4 +157,4 @@ Vendor dependencies are installed on a per-project basis (so each robot project
.. tab-item:: Python
:sync: python

Third party libraries are packaged into Python wheels and uploaded to PyPI (if pure python) and/or WPILib's artifactory. Users can enable them as dependencies either by adding the component name to ``robotpy_extras`` (recommended) or by adding an explicit dependency for the PyPI package in ``requires``. The dependencies are downloaded when ``robotpy sync`` is executed, and installed on the roboRIO when ``robotpy deploy`` is executed.
Third party libraries are packaged into Python wheels and uploaded to PyPI (if pure python) and/or WPILib's artifactory. Core WPILib packages can be installed by adding the component name to ``components``, while vendor packages must be added to ``requires`` with their PyPI package name. The dependencies are downloaded when ``robotpy sync`` is executed, and installed on the roboRIO when ``robotpy deploy`` is executed.