Skip to content

Commit

Permalink
Initial 2024 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
virtuald committed Jan 18, 2024
1 parent 6019b0d commit b0da04b
Show file tree
Hide file tree
Showing 35 changed files with 118 additions and 1,276 deletions.
57 changes: 27 additions & 30 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,9 @@
copyright = f"2014-{date.today().year}, RobotPy development team"


frc_docs = "https://docs.wpilib.org/en/stable"

intersphinx_mapping = {
"commandsv1": (
"https://robotpy.readthedocs.io/projects/commands-v1/en/%s/" % rtd_version,
None,
),
"commandsv2": (
"https://robotpy.readthedocs.io/projects/commands-v2/en/%s/" % rtd_version,
None,
Expand All @@ -83,40 +81,47 @@
"https://robotpy.readthedocs.io/projects/pyfrc/en/%s/" % rtd_version,
None,
),
"ntcore": (
"https://robotpy.readthedocs.io/projects/pyntcore/en/%s/" % rtd_version,
None,
),
"wpilib": (
"https://robotpy.readthedocs.io/projects/wpilib/en/%s/" % rtd_version,
None,
),
"hal": (
"https://robotpy.readthedocs.io/projects/hal/en/%s/" % rtd_version,
"robotpy": (
"https://robotpy.readthedocs.io/projects/robotpy/en/%s/" % rtd_version,
None,
),
"robotpy_ext": (
"https://robotpy.readthedocs.io/projects/utilities/en/%s/" % rtd_version,
None,
),
"cscore": (
"https://robotpy.readthedocs.io/projects/cscore/en/%s/" % rtd_version,
None,
),
"frc": ("https://docs.wpilib.org/en/stable", None),
"frc": (frc_docs, None),
}

redirects = {
"2020_notes": "upgrade_notes.html",
"install/pynetworktables": "pyntcore.html"
"install/pynetworktables": "pyntcore.html",
"frameworks/command": f"{frc_docs}/docs/software/commandbased/index",
"guide/examples": "https://github.com/robotpy/examples",
"guide/nt": f"{frc_docs}/docs/software/networktables/index.html",
"hw": f"{frc_docs}/docs/hardware/hardware-basics/index.html",
"install/commands": "install/components",
"install/cscore": "install/components",
"install/ctre": "install/components",
"install/navx": "install/components",
"install/pathplannerlib": "install/components",
"install/pwfusion": "install/components",
"install/pyfrc": "install/components",
"install/pyntcore": "install/components",
"install/rev": "install/components",
"vision/code": f"{frc_docs}/docs/software/vision-processing/index.html",
"vision/index": f"{frc_docs}/docs/software/vision-processing/index.html",
"vision/other": f"{frc_docs}/docs/software/vision-processing/index.html",
"vision/roborio": f"{frc_docs}/docs/software/vision-processing/roborio/index.html",
}

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = subprocess.check_output(("git", "describe", "--tags"), text=True).split(".")[0]
version = subprocess.check_output(("git", "describe", "--tags"), text=True).split(".")[
0
]
# The full version, including alpha/beta/rc tags.
release = version

Expand All @@ -133,15 +138,7 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = "default"

if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme

html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
else:
html_theme = "default"
html_theme = "sphinx_rtd_theme"

# Output file base name for HTML help builder.
htmlhelp_basename = "RobotPy"
Expand Down
2 changes: 1 addition & 1 deletion dev/deploy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pretty simple too.

::

python3 robot.py run
python3 -m robotpy run

Your driver station should be able to connect to your code, and it will be able
to operate your robot!
Expand Down
48 changes: 13 additions & 35 deletions faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ documentation <https://docs.python.org/3/>`__ instead of the Python
2.x documentation.

- RobotPy WPILib on the roboRIO uses the latest version of Python 3 at kickoff.
In 2023, this was Python 3.11. When using pyfrc or similar projects,
you should use a Python 3.7 or newer interpreter (the latest is recommended).
In 2024, this was Python 3.12. When using pyfrc or similar projects,
you should use a Python 3.8 or newer interpreter (the latest is recommended).
- RobotPy 2014.x is based on Python 3.2.5.

`pynetworktables <https://github.com/robotpy/pynetworktables>`__ is
Expand Down Expand Up @@ -71,15 +71,17 @@ Prior to 2015, the API matched the C++ version of WPILib.
Is Command-based programming available?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Of course! Check out the :mod:`commands2 <commands2>` package. There
is also some :ref:`python-specific documentation available <command_framework_docs>`.
Of course! Check out the :mod:`commands2 <commands2>` package.

Is there an easy way to test my code outside of the robot?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Are Vendor libraries available?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Glad you asked! Our pyfrc project has a built in :ref:`lightweight robot simulator <simulator>`
you can use to run your code, and also has builtin support for unit testing
with `py.test <http://pytest.org>`_.
We encourage vendors to make Python versions of their libraries available. Since
Python support has only been official since 2024, not all vendors do this. If
you are a vendor, please reach out to our team and we'd be happy to assist.

The RobotPy project also provides unofficial wrappers for vendor libraries that don't
take a lot of effort to create and maintain.

Competition
-----------
Expand All @@ -89,38 +91,14 @@ Competition
Is RobotPy competition-legal?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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.

As RobotPy was not written by anyone involved with the GDC, we can't
provide a guaranteed answer (particularly not for future years).
However, we see no reason that RobotPy would not be legal: to the
cRIO/RoboRIO, it looks just like any other C++ WPILib-using program that
reads text files. RobotPy itself should be considered COTS software as
it is freely available to all teams. Teams have been using RobotPy since
2010 without any problems from FIRST, and we expect that to continue.

Caveat emptor: while RobotPy is almost certainly legal to use, your team
should carefully consider the risk of using such a large piece of
unofficial software; unless RobotPy is used by many teams, if you run
into trouble at a competition, there may not be anyone else there to
help! However, we've found that most problems teams run into are
problems with WPILib itself, and not RobotPy.

Also, be sure to keep in mind the fact that Python is a dynamic language
and is NOT compiled. This means that typos can easily go undetected
until your robot runs that particular line of code, resulting in an
exception and 5 second restart. Make sure to test your code thoroughly
(see our :ref:`unit testing documentation <unit_tests>`).

As of 2024, Python is officially supported for use in FRC.

.. _is_stable:

Is RobotPy stable?
~~~~~~~~~~~~~~~~~~

Yes! While Python is not an officially supported language, teams have been
Yes! Teams have been
using RobotPy since 2010, and the maintainer of RobotPy is a member of the
WPILib team. Much of the time when bugs are found, they are found in the
underlying WPILib, instead of RobotPy itself.
Expand Down
16 changes: 0 additions & 16 deletions frameworks/command.rst

This file was deleted.

4 changes: 2 additions & 2 deletions frameworks/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ While frameworks sometimes have a learning curve associated with them, once you
learn how they work you will find that they can save you a lot of effort and
prevent you from making certain kinds of mistakes.

* :ref:`command_framework_docs`: this framework comes with WPILib
* :doc:`Command Framework <frc:docs/software/commandbased/index>`: this framework comes with WPILib
* :ref:`magicbot_framework_docs`: Created as a pythonic alternative to the Command framework

.. toctree::
:maxdepth: 2
:hidden:

command
magicbot
2 changes: 0 additions & 2 deletions frameworks/magicbot.rst
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,6 @@ The simplest method to communicate with other programs external to your robot
code (examples include dashboards and image processing code) is using
NetworkTables. NetworkTables is a distributed keystore, or put more simply,
it is similar to a python dictionary that is shared across multiple processes.

.. note:: For more information about NetworkTables, see :ref:`networktables_guide`

Magicbot provides a simple way to interact with NetworkTables, using the
:func:`tunable <robotpy_ext:magicbot.magic_tunable.tunable>` property.
Expand Down
4 changes: 0 additions & 4 deletions getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,3 @@ the following steps:

Once you've played around with some code in simulation, then you should
:ref:`install RobotPy on your robot <install_robotpy>`.

If you're looking to use NetworkTables on the driver station or on a
coprocessor, then check out the :ref:`pyntcore install docs <install_pyntcore>`.

6 changes: 3 additions & 3 deletions guide/anatomy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Adding motors and sensors

Everything that interacts with the robot hardware directly must use the wpilib
library to do so. Starting in 2015, full documentation for the python version
of WPILib is published online. Check out the API documentation (:external+wpilib:doc:`wpilib`)
of WPILib is published online. Check out the API documentation (:external+robotpy:doc:`wpilib`)
for details on all the objects available in WPILib.

.. note::
Expand All @@ -90,7 +90,7 @@ Creating individual devices
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Let's say you wanted to create an object that interacted with a Jaguar motor
controller via PWM. First, you would read through the table (:external+wpilib:doc:`wpilib`) and
controller via PWM. First, you would read through the table (:external+robotpy:doc:`wpilib`) and
see that there is a :class:`.Jaguar` object. Looking further, you can see that
the constructor takes a single argument that indicates which PWM port to
connect to. You could create the `Jaguar` object that is using port 4 using the
Expand Down Expand Up @@ -142,7 +142,7 @@ Once you have one of these objects, it has various methods that you can use
to control the robot via joystick, or you can specify the control inputs
manually.

.. seealso:: Documentation for the :external+wpilib:doc:`wpilib.drive`, and the FIRST WPILib Programming Guide.
.. seealso:: Documentation for the :external+robotpy:doc:`wpilib.drive`, and the FIRST WPILib Programming Guide.

Robot Operating Modes (TimedRobot)
--------------------------------------
Expand Down
17 changes: 8 additions & 9 deletions guide/deploy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,20 @@ code, and if they pass then it will upload the robot code to the roboRIO.
Running the tests is really important, it allows you to catch errors in your
code before you run it on the robot.

1. Make sure you have RobotPy installed on the robot (:ref:`RobotPy install guide <install_robotpy>`)
2. Make sure you have pyfrc installed (:ref:`pyfrc install guide <install_pyfrc>`)
3. Once that is done, you can just run the following command and it will upload the code and start it immediately.
1. Make sure you have RobotPy installed on the robot (:ref:`RobotPy install guide <install_robotpy>`) and on your computer
2. Once that is done, you can just run the following command and it will upload the code and start it immediately.

.. tab:: Windows

.. code-block:: sh
py -3 robot.py deploy
py -3 -m robotpy deploy
.. tab:: Linux/macOS

.. code-block:: sh
python3 robot.py deploy
python3 -m robotpy deploy
You can watch your robot code's output (and see any problems) by using the
netconsole program (you can either use NI's tool, or `pynetconsole <https://github.com/robotpy/pynetconsole>`_.
Expand All @@ -49,13 +48,13 @@ your program's console output, by launching a netconsole listener.

.. code-block:: sh
py -3 robot.py deploy --nc
py -3 -m robotpy deploy --nc
.. tab:: Linux/macOS

.. code-block:: sh
python3 robot.py deploy --nc
python3 -m robotpy deploy --nc
.. note:: This requires the driver station software to be connected to your robot

Expand All @@ -69,13 +68,13 @@ don't care about the tests. That's OK, you can still upload code to the robot:

.. code-block:: sh
py -3 robot.py deploy --skip-tests
py -3 -m robotpy deploy --skip-tests
.. tab:: Linux/macOS

.. code-block:: sh
python3 robot.py deploy --skip-tests
python3 -m robotpy deploy --skip-tests
Starting deployed code at boot
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
9 changes: 0 additions & 9 deletions guide/examples.rst

This file was deleted.

3 changes: 1 addition & 2 deletions guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ Programmer's Guide
simulator
testing
guidelines
nt
examples
nt
2 changes: 0 additions & 2 deletions guide/nt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ Resources

- :doc:`Networktables concepts and documentation <frc:docs/software/networktables/index>`

- :ref:`pyntcore installation <install_pyntcore>`

- :ref:`NTCore API Reference <ntcore_api>`

- :ref:`NetworkTables troubleshooting <troubleshooting_nt>`
13 changes: 5 additions & 8 deletions guide/running.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ Now that you've created your first Python robot program, you probably want to
know how to run the code. The process to run a python script is slightly
different for each operating system.

.. note:: This section assumes that you've already :ref:`installed pyfrc <install_pyfrc>`.
If you haven't, now's a great time to do so!

How to execute the script
-------------------------

Expand All @@ -22,7 +19,7 @@ How to execute the script

.. code-block:: sh
py -3 robot.py
py -3 -m robotpy
.. tab:: Linux/macOS

Expand All @@ -32,7 +29,7 @@ How to execute the script

.. code-block:: sh
python3 robot.py
python3 -m robotpy
Commands
--------
Expand All @@ -47,16 +44,16 @@ robot code. To discover the various features that are installed, you can use the

.. code-block:: batch
py -3 robot.py --help
py -3 -m robotpy --help
.. tab:: Linux/macOS

.. code-block:: sh
python3 robot.py --help
python3 -m robotpy --help
.. note:: RobotPy supports an extension mechanism that allows advanced users the
ability to create their own custom ``robot.py`` commandline options.
ability to create their own custom ``robotpy`` commandline options.
For more information, see :ref:`robotpy_extension_options`

Next steps
Expand Down
Loading

0 comments on commit b0da04b

Please sign in to comment.