mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
Compare commits
65 Commits
v2026.0.1-
...
py-docs
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f022130bfa | ||
|
|
5457db947e | ||
|
|
a7329c48a3 | ||
|
|
ce0b00ee03 | ||
|
|
99ca8228a1 | ||
|
|
46e71703ef | ||
|
|
6fbb41fb76 | ||
|
|
05fcf876cd | ||
|
|
1637be6044 | ||
|
|
6f2fd19351 | ||
|
|
892e240b18 | ||
|
|
326c77fa38 | ||
|
|
8cf48bee57 | ||
|
|
26f08a6fdf | ||
|
|
abb8ccf4e9 | ||
|
|
50adef1672 | ||
|
|
cf68403182 | ||
|
|
dc0985dfb5 | ||
|
|
8fb29ff5c4 | ||
|
|
476cd6df8b | ||
|
|
783ed82d50 | ||
|
|
416e2f7607 | ||
|
|
ebd1071553 | ||
|
|
fa8b60fe27 | ||
|
|
c2581f3e99 | ||
|
|
96b0938dc0 | ||
|
|
697e52f886 | ||
|
|
87b219d9be | ||
|
|
abcd6b8f50 | ||
|
|
b22371d7c0 | ||
|
|
3eea79f0d4 | ||
|
|
0147a44100 | ||
|
|
0bec1f239c | ||
|
|
44b46cf117 | ||
|
|
ffdda9ddfa | ||
|
|
a5bc63878d | ||
|
|
a5b1cc0ded | ||
|
|
aacbdf5010 | ||
|
|
3547d0584b | ||
|
|
40815020de | ||
|
|
e522642a48 | ||
|
|
3cdda8a84e | ||
|
|
228caf47f2 | ||
|
|
d1761d07e9 | ||
|
|
331f4f0218 | ||
|
|
eb85834180 | ||
|
|
871ca61c8d | ||
|
|
358f5747ab | ||
|
|
e334d26459 | ||
|
|
77d5388a35 | ||
|
|
88a1e789ad | ||
|
|
abc67bdd95 | ||
|
|
05309b1e25 | ||
|
|
ddacff7079 | ||
|
|
32e4f0029b | ||
|
|
34057f223d | ||
|
|
55303ccd9c | ||
|
|
3c73b68ba3 | ||
|
|
6d816b5053 | ||
|
|
7c6bab1dfa | ||
|
|
462a2aa629 | ||
|
|
47b799a0ce | ||
|
|
35c72e8446 | ||
|
|
c440ce57ce | ||
|
|
8452527589 |
38
.github/workflows/photon-api-docs.yml
vendored
38
.github/workflows/photon-api-docs.yml
vendored
@@ -46,7 +46,7 @@ jobs:
|
||||
run: pnpm run build-demo
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: built-demo
|
||||
name: demo
|
||||
path: photon-client/dist/
|
||||
|
||||
run_java_cpp_docs:
|
||||
@@ -74,9 +74,39 @@ jobs:
|
||||
name: docs-java-cpp
|
||||
path: photon-docs/build/docs
|
||||
|
||||
run_py_docs:
|
||||
name: Build Python API Docs
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r photon-lib/py/docs/requirements.txt
|
||||
|
||||
- name: Build Sphinx site
|
||||
run: |
|
||||
sphinx-apidoc -o docs/source photonlibpy
|
||||
make -C docs html
|
||||
working-directory: photon-lib/py
|
||||
|
||||
- name: Upload built site as artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: docs-python
|
||||
path: photon-lib/py/docs/build/html
|
||||
|
||||
publish_api_docs:
|
||||
name: Publish API Docs
|
||||
needs: [run_java_cpp_docs]
|
||||
needs: [ run_java_cpp_docs, run_py_docs ]
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
# Download docs artifact
|
||||
@@ -85,7 +115,7 @@ jobs:
|
||||
pattern: docs-*
|
||||
- run: find .
|
||||
- name: Publish Docs To Development
|
||||
if: github.ref == 'refs/heads/main'
|
||||
# if: github.ref == 'refs/heads/main'
|
||||
uses: up9cloud/action-rsync@v1.4
|
||||
env:
|
||||
HOST: ${{ secrets.WEBMASTER_SSH_HOST }}
|
||||
@@ -108,7 +138,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: built-demo
|
||||
name: demo
|
||||
- run: find .
|
||||
- name: Publish demo
|
||||
if: github.ref == 'refs/heads/main'
|
||||
|
||||
2
.github/workflows/python.yml
vendored
2
.github/workflows/python.yml
vendored
@@ -29,7 +29,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install setuptools wheel pytest mypy
|
||||
pip install setuptools wheel pytest mypy mkdocs mkdocs-gen-files
|
||||
|
||||
- name: Build wheel
|
||||
working-directory: ./photon-lib/py
|
||||
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -142,9 +142,13 @@ venv
|
||||
.venv/*
|
||||
.venv
|
||||
networktables.json
|
||||
|
||||
# Web stuff
|
||||
photon-server/src/main/resources/web/*
|
||||
node_modules
|
||||
dist
|
||||
components.d.ts
|
||||
|
||||
# Py docs stuff
|
||||
photon-lib/py/docs/build
|
||||
photon-server/src/main/resources/web/index.html
|
||||
|
||||
@@ -20,6 +20,7 @@ If you are interested in contributing code or documentation to the project, plea
|
||||
- Photon UI demo: [http://photonvision.global/](http://photonvision.global/)
|
||||
- Javadocs: [javadocs.photonvision.org](https://javadocs.photonvision.org)
|
||||
- C++ Doxygen [cppdocs.photonvision.org](https://cppdocs.photonvision.org)
|
||||
- Python Documentation [pydocs.photonvision.org](https://pydocs.photonvision.org)
|
||||
|
||||
## Building
|
||||
|
||||
|
||||
@@ -138,5 +138,7 @@ docs/contributing/index
|
||||
|
||||
Java <https://javadocs.photonvision.org>
|
||||
|
||||
C++ <https://cppdocs.photonvision.org/>
|
||||
C++ <https://cppdocs.photonvision.org>
|
||||
|
||||
Python <https://pydocs.photonvision.org>
|
||||
```
|
||||
|
||||
20
photon-lib/py/docs/Makefile
Normal file
20
photon-lib/py/docs/Makefile
Normal file
@@ -0,0 +1,20 @@
|
||||
# Minimal makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line, and also
|
||||
# from the environment for the first two.
|
||||
SPHINXOPTS ?=
|
||||
SPHINXBUILD ?= sphinx-build
|
||||
SOURCEDIR = source
|
||||
BUILDDIR = build
|
||||
|
||||
# Put it first so that "make" without argument is like "make help".
|
||||
help:
|
||||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
|
||||
.PHONY: help Makefile
|
||||
|
||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||
%: Makefile
|
||||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
5
photon-lib/py/docs/_stubs/wpimath/__init__.py
Normal file
5
photon-lib/py/docs/_stubs/wpimath/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# Minimal wpimath stub for Sphinx docs build
|
||||
from . import geometry
|
||||
from . import units
|
||||
|
||||
__all__ = ["geometry", "units"]
|
||||
4
photon-lib/py/docs/_stubs/wpimath/_init__wpimath.py
Normal file
4
photon-lib/py/docs/_stubs/wpimath/_init__wpimath.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# Stub module to match wpimath compiled module names
|
||||
# This file exists so imports like `wpimath._init__wpimath` succeed during docs build.
|
||||
|
||||
# no-op
|
||||
130
photon-lib/py/docs/_stubs/wpimath/geometry.py
Normal file
130
photon-lib/py/docs/_stubs/wpimath/geometry.py
Normal file
@@ -0,0 +1,130 @@
|
||||
# Minimal geometry stubs for Sphinx documentation
|
||||
|
||||
class Rotation3d:
|
||||
def __init__(self, roll=0.0, pitch=0.0, yaw=0.0):
|
||||
# store yaw as the primary rotation for simple stubs
|
||||
self.roll = roll
|
||||
self.pitch = pitch
|
||||
self.yaw = yaw
|
||||
|
||||
def toRotation2d(self):
|
||||
# convert yaw to a Rotation2d for simple compatibility in docs build
|
||||
return Rotation2d(self.yaw)
|
||||
|
||||
class Translation3d:
|
||||
def __init__(self, x=0.0, y=0.0, z=0.0):
|
||||
# Support both (x, y, z) and (distance, Rotation3d) forms used by the real wpimath
|
||||
# If y is a Rotation3d, compute a point at 'distance' along its yaw/pitch
|
||||
try:
|
||||
from math import cos, sin
|
||||
except Exception:
|
||||
def cos(x):
|
||||
return x
|
||||
def sin(x):
|
||||
return x
|
||||
|
||||
if hasattr(y, "yaw") and hasattr(y, "pitch"):
|
||||
# interpret constructor as Translation3d(distance, Rotation3d)
|
||||
distance = float(x)
|
||||
pitch = float(getattr(y, "pitch", 0.0))
|
||||
yaw = float(getattr(y, "yaw", 0.0))
|
||||
# approximate spherical -> cartesian
|
||||
self._x = distance * cos(pitch) * cos(yaw)
|
||||
self._y = distance * cos(pitch) * sin(yaw)
|
||||
self._z = distance * sin(pitch)
|
||||
else:
|
||||
self._x = float(x)
|
||||
self._y = float(y)
|
||||
self._z = float(z)
|
||||
|
||||
def X(self):
|
||||
return self._x
|
||||
|
||||
def Y(self):
|
||||
return self._y
|
||||
|
||||
def Z(self):
|
||||
return self._z
|
||||
|
||||
class Pose3d:
|
||||
def __init__(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
class Rotation2d:
|
||||
def __init__(self, *args):
|
||||
# Accept several initialization forms used in the real wpimath Rotation2d
|
||||
# - Rotation2d(angle)
|
||||
# - Rotation2d(fx, xOffset) used by SimCameraProperties.getPixelYaw
|
||||
if len(args) == 0:
|
||||
self._angle = 0.0
|
||||
elif len(args) == 1:
|
||||
self._angle = float(args[0])
|
||||
else:
|
||||
# fallback: when called with fx, xOffset, approximate angle as 0.0
|
||||
self._angle = 0.0
|
||||
|
||||
def degrees(self):
|
||||
from math import degrees
|
||||
|
||||
return degrees(self._angle)
|
||||
|
||||
def radians(self):
|
||||
return float(self._angle)
|
||||
|
||||
def __add__(self, other):
|
||||
# allow Rotation2d + Rotation2d or Rotation2d + numeric
|
||||
if hasattr(other, "_angle"):
|
||||
return Rotation2d(self._angle + float(other._angle))
|
||||
try:
|
||||
return Rotation2d(self._angle + float(other))
|
||||
except Exception:
|
||||
return NotImplemented
|
||||
|
||||
def __radd__(self, other):
|
||||
# numeric + Rotation2d
|
||||
return self.__add__(other)
|
||||
|
||||
def __sub__(self, other):
|
||||
if hasattr(other, "_angle"):
|
||||
return Rotation2d(self._angle - float(other._angle))
|
||||
try:
|
||||
return Rotation2d(self._angle - float(other))
|
||||
except Exception:
|
||||
return NotImplemented
|
||||
|
||||
def __neg__(self):
|
||||
return Rotation2d(-self._angle)
|
||||
|
||||
def __repr__(self):
|
||||
return f"Rotation2d({self._angle})"
|
||||
|
||||
class Translation2d:
|
||||
def __init__(self, x=0.0, y=0.0):
|
||||
self._x = float(x)
|
||||
self._y = float(y)
|
||||
|
||||
def X(self):
|
||||
return self._x
|
||||
|
||||
def Y(self):
|
||||
return self._y
|
||||
|
||||
class Pose2d:
|
||||
def __init__(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return "Pose2d()"
|
||||
|
||||
|
||||
class Transform3d:
|
||||
def __init__(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
class Quaternion:
|
||||
def __init__(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
# Expose names commonly used by photonlibpy
|
||||
__all__ = ["Rotation3d", "Translation3d", "Pose3d", "Rotation2d", "Translation2d", "Pose2d"]
|
||||
12
photon-lib/py/docs/_stubs/wpimath/interpolation.py
Normal file
12
photon-lib/py/docs/_stubs/wpimath/interpolation.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# Minimal interpolation stub for docs
|
||||
class TimeInterpolatableRotation2dBuffer:
|
||||
def __init__(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def addSample(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def sample(self, *args, **kwargs):
|
||||
return None
|
||||
|
||||
__all__ = ["TimeInterpolatableRotation2dBuffer"]
|
||||
@@ -0,0 +1,3 @@
|
||||
from ._interpolation import *
|
||||
|
||||
__all__ = ["TimeInterpolatableRotation2dBuffer"]
|
||||
@@ -0,0 +1,25 @@
|
||||
# Minimal interpolation submodule stub for docs
|
||||
class TimeInterpolatableRotation2dBuffer:
|
||||
def __init__(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def addSample(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def sample(self, *args, **kwargs):
|
||||
return None
|
||||
|
||||
|
||||
class TimeInterpolatablePose3dBuffer:
|
||||
def __init__(self, *args, **kwargs):
|
||||
# buffer of Pose3d-like objects for docs import
|
||||
pass
|
||||
|
||||
def addSample(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def sample(self, *args, **kwargs):
|
||||
return None
|
||||
|
||||
|
||||
__all__ = ["TimeInterpolatableRotation2dBuffer", "TimeInterpolatablePose3dBuffer"]
|
||||
31
photon-lib/py/docs/_stubs/wpimath/units.py
Normal file
31
photon-lib/py/docs/_stubs/wpimath/units.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""Minimal wpimath.units stub for documentation builds."""
|
||||
|
||||
def degreesToRadians(deg: float) -> float:
|
||||
from math import pi
|
||||
|
||||
return deg * (pi / 180.0)
|
||||
|
||||
|
||||
# Represent seconds as a float alias for annotations
|
||||
seconds = float
|
||||
|
||||
__all__ = ["degreesToRadians", "seconds"]
|
||||
|
||||
# Common unit aliases used in type annotations in WPILib stubs
|
||||
meters = float
|
||||
meters_per_second = float
|
||||
meters_per_second_squared = float
|
||||
kilograms = float
|
||||
kilogram_square_meters = float
|
||||
|
||||
__all__.extend([
|
||||
"meters",
|
||||
"meters_per_second",
|
||||
"meters_per_second_squared",
|
||||
"kilograms",
|
||||
"kilogram_square_meters",
|
||||
"hertz",
|
||||
])
|
||||
|
||||
# frequency
|
||||
hertz = float
|
||||
35
photon-lib/py/docs/make.bat
Normal file
35
photon-lib/py/docs/make.bat
Normal file
@@ -0,0 +1,35 @@
|
||||
@ECHO OFF
|
||||
|
||||
pushd %~dp0
|
||||
|
||||
REM Command file for Sphinx documentation
|
||||
|
||||
if "%SPHINXBUILD%" == "" (
|
||||
set SPHINXBUILD=sphinx-build
|
||||
)
|
||||
set SOURCEDIR=source
|
||||
set BUILDDIR=build
|
||||
|
||||
%SPHINXBUILD% >NUL 2>NUL
|
||||
if errorlevel 9009 (
|
||||
echo.
|
||||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||
echo.installed, then set the SPHINXBUILD environment variable to point
|
||||
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||
echo.may add the Sphinx directory to PATH.
|
||||
echo.
|
||||
echo.If you don't have Sphinx installed, grab it from
|
||||
echo.https://www.sphinx-doc.org/
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||
goto end
|
||||
|
||||
:help
|
||||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||
|
||||
:end
|
||||
popd
|
||||
3
photon-lib/py/docs/requirements.txt
Normal file
3
photon-lib/py/docs/requirements.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
sphinx==7.2.6
|
||||
sphinx-autodoc-typehints==1.25.2
|
||||
sphinx-rtd-theme==1.3.0
|
||||
53
photon-lib/py/docs/source/conf.py
Normal file
53
photon-lib/py/docs/source/conf.py
Normal file
@@ -0,0 +1,53 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
# This adds the 'py/' directory to the Python path
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")))
|
||||
|
||||
# Configuration file for the Sphinx documentation builder.
|
||||
#
|
||||
# For the full list of built-in configuration values, see the documentation:
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
||||
|
||||
project = "PhotonVision"
|
||||
copyright = "2025, Matt Morley, Banks Troutman"
|
||||
author = "Matt Morley, Banks Troutman"
|
||||
|
||||
# -- General configuration ---------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
||||
|
||||
extensions = [
|
||||
"sphinx.ext.autodoc",
|
||||
"sphinx.ext.napoleon", # for Google/NumPy docstrings
|
||||
"sphinx_autodoc_typehints", # for type hints in docs
|
||||
]
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(
|
||||
0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "_stubs"))
|
||||
) # add docs stubs first so they shadow unavailable third-party packages
|
||||
|
||||
sys.path.insert(
|
||||
0, os.path.abspath("../../photonlibpy")
|
||||
) # adjust based on your project layout
|
||||
# Mock imports that aren't available in the docs build environment so autodoc
|
||||
# can import the local modules even if optional runtime deps (like wpimath)
|
||||
# aren't installed. Add other names here if you see warnings for missing
|
||||
# third-party packages during the build.
|
||||
autodoc_mock_imports = [
|
||||
"wpilib",
|
||||
]
|
||||
templates_path = ["_templates"]
|
||||
exclude_patterns = []
|
||||
|
||||
|
||||
# -- Options for HTML output -------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
||||
|
||||
html_theme = "sphinx_rtd_theme"
|
||||
html_static_path = ["_static"]
|
||||
17
photon-lib/py/docs/source/index.rst
Normal file
17
photon-lib/py/docs/source/index.rst
Normal file
@@ -0,0 +1,17 @@
|
||||
.. PhotonVision documentation master file, created by
|
||||
sphinx-quickstart on Fri May 9 12:16:37 2025.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
PhotonLib Python Documentation
|
||||
===============================
|
||||
|
||||
|
||||
The main documentation for PhotonVision can be found at `photonvision.org <https://photonvision.org>`_.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: Contents:
|
||||
|
||||
modules
|
||||
photonlibpy
|
||||
7
photon-lib/py/docs/source/modules.rst
Normal file
7
photon-lib/py/docs/source/modules.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
photonlibpy
|
||||
===========
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 4
|
||||
|
||||
photonlibpy
|
||||
53
photon-lib/py/docs/source/photonlibpy.estimation.rst
Normal file
53
photon-lib/py/docs/source/photonlibpy.estimation.rst
Normal file
@@ -0,0 +1,53 @@
|
||||
photonlibpy.estimation package
|
||||
==============================
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
photonlibpy.estimation.cameraTargetRelation module
|
||||
--------------------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.estimation.cameraTargetRelation
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
photonlibpy.estimation.openCVHelp module
|
||||
----------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.estimation.openCVHelp
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
photonlibpy.estimation.rotTrlTransform3d module
|
||||
-----------------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.estimation.rotTrlTransform3d
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
photonlibpy.estimation.targetModel module
|
||||
-----------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.estimation.targetModel
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
photonlibpy.estimation.visionEstimation module
|
||||
----------------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.estimation.visionEstimation
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: photonlibpy.estimation
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
61
photon-lib/py/docs/source/photonlibpy.generated.rst
Normal file
61
photon-lib/py/docs/source/photonlibpy.generated.rst
Normal file
@@ -0,0 +1,61 @@
|
||||
photonlibpy.generated package
|
||||
=============================
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
photonlibpy.generated.MultiTargetPNPResultSerde module
|
||||
------------------------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.generated.MultiTargetPNPResultSerde
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
photonlibpy.generated.PhotonPipelineMetadataSerde module
|
||||
--------------------------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.generated.PhotonPipelineMetadataSerde
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
photonlibpy.generated.PhotonPipelineResultSerde module
|
||||
------------------------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.generated.PhotonPipelineResultSerde
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
photonlibpy.generated.PhotonTrackedTargetSerde module
|
||||
-----------------------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.generated.PhotonTrackedTargetSerde
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
photonlibpy.generated.PnpResultSerde module
|
||||
-------------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.generated.PnpResultSerde
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
photonlibpy.generated.TargetCornerSerde module
|
||||
----------------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.generated.TargetCornerSerde
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: photonlibpy.generated
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
21
photon-lib/py/docs/source/photonlibpy.networktables.rst
Normal file
21
photon-lib/py/docs/source/photonlibpy.networktables.rst
Normal file
@@ -0,0 +1,21 @@
|
||||
photonlibpy.networktables package
|
||||
=================================
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
photonlibpy.networktables.NTTopicSet module
|
||||
-------------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.networktables.NTTopicSet
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: photonlibpy.networktables
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
58
photon-lib/py/docs/source/photonlibpy.rst
Normal file
58
photon-lib/py/docs/source/photonlibpy.rst
Normal file
@@ -0,0 +1,58 @@
|
||||
photonlibpy package
|
||||
===================
|
||||
|
||||
Subpackages
|
||||
-----------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 4
|
||||
|
||||
photonlibpy.estimation
|
||||
photonlibpy.generated
|
||||
photonlibpy.networktables
|
||||
photonlibpy.simulation
|
||||
photonlibpy.targeting
|
||||
photonlibpy.timesync
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
photonlibpy.estimatedRobotPose module
|
||||
-------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.estimatedRobotPose
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
photonlibpy.packet module
|
||||
-------------------------
|
||||
|
||||
.. automodule:: photonlibpy.packet
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
photonlibpy.photonCamera module
|
||||
-------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.photonCamera
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
photonlibpy.photonPoseEstimator module
|
||||
--------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.photonPoseEstimator
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: photonlibpy
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
53
photon-lib/py/docs/source/photonlibpy.simulation.rst
Normal file
53
photon-lib/py/docs/source/photonlibpy.simulation.rst
Normal file
@@ -0,0 +1,53 @@
|
||||
photonlibpy.simulation package
|
||||
==============================
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
photonlibpy.simulation.photonCameraSim module
|
||||
---------------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.simulation.photonCameraSim
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
photonlibpy.simulation.simCameraProperties module
|
||||
-------------------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.simulation.simCameraProperties
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
photonlibpy.simulation.videoSimUtil module
|
||||
------------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.simulation.videoSimUtil
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
photonlibpy.simulation.visionSystemSim module
|
||||
---------------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.simulation.visionSystemSim
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
photonlibpy.simulation.visionTargetSim module
|
||||
---------------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.simulation.visionTargetSim
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: photonlibpy.simulation
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
45
photon-lib/py/docs/source/photonlibpy.targeting.rst
Normal file
45
photon-lib/py/docs/source/photonlibpy.targeting.rst
Normal file
@@ -0,0 +1,45 @@
|
||||
photonlibpy.targeting package
|
||||
=============================
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
photonlibpy.targeting.TargetCorner module
|
||||
-----------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.targeting.TargetCorner
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
photonlibpy.targeting.multiTargetPNPResult module
|
||||
-------------------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.targeting.multiTargetPNPResult
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
photonlibpy.targeting.photonPipelineResult module
|
||||
-------------------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.targeting.photonPipelineResult
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
photonlibpy.targeting.photonTrackedTarget module
|
||||
------------------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.targeting.photonTrackedTarget
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: photonlibpy.targeting
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
21
photon-lib/py/docs/source/photonlibpy.timesync.rst
Normal file
21
photon-lib/py/docs/source/photonlibpy.timesync.rst
Normal file
@@ -0,0 +1,21 @@
|
||||
photonlibpy.timesync package
|
||||
============================
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
photonlibpy.timesync.timeSyncServer module
|
||||
------------------------------------------
|
||||
|
||||
.. automodule:: photonlibpy.timesync.timeSyncServer
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: photonlibpy.timesync
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -70,19 +70,11 @@ class Packet:
|
||||
return retVal
|
||||
|
||||
def getData(self) -> bytes:
|
||||
"""
|
||||
* Returns the packet data.
|
||||
*
|
||||
* @return The packet data.
|
||||
"""
|
||||
"""Return the packet data."""
|
||||
return self.packetData
|
||||
|
||||
def setData(self, data: bytes):
|
||||
"""
|
||||
* Sets the packet data.
|
||||
*
|
||||
* @param data The packet data.
|
||||
"""
|
||||
"""Set the packet data."""
|
||||
self.clear()
|
||||
self.packetData = data
|
||||
self.size = len(self.packetData)
|
||||
@@ -101,74 +93,42 @@ class Packet:
|
||||
return value
|
||||
|
||||
def decode8(self) -> int:
|
||||
"""
|
||||
* Returns a single decoded byte from the packet.
|
||||
*
|
||||
* @return A decoded byte from the packet.
|
||||
"""
|
||||
"""Return a single decoded byte from the packet."""
|
||||
return self._decodeGeneric("<b", 1)
|
||||
|
||||
def decode16(self) -> int:
|
||||
"""
|
||||
* Returns a single decoded short from the packet.
|
||||
*
|
||||
* @return A decoded short from the packet.
|
||||
"""
|
||||
"""Return a single decoded short from the packet."""
|
||||
return self._decodeGeneric("<h", 2)
|
||||
|
||||
def decodeInt(self) -> int:
|
||||
"""
|
||||
* Returns a decoded int (32 bytes) from the packet.
|
||||
*
|
||||
* @return A decoded int from the packet.
|
||||
"""
|
||||
"""Return a decoded 32-bit integer from the packet."""
|
||||
return self._decodeGeneric("<l", 4)
|
||||
|
||||
def decodeFloat(self) -> float:
|
||||
"""
|
||||
* Returns a decoded float from the packet.
|
||||
*
|
||||
* @return A decoded float from the packet.
|
||||
"""
|
||||
"""Return a decoded float from the packet."""
|
||||
return self._decodeGeneric("<f", 4)
|
||||
|
||||
def decodeLong(self) -> int:
|
||||
"""
|
||||
* Returns a decoded int64 from the packet.
|
||||
*
|
||||
* @return A decoded int64 from the packet.
|
||||
"""
|
||||
"""Return a decoded 64-bit integer from the packet."""
|
||||
return self._decodeGeneric("<q", 8)
|
||||
|
||||
def decodeDouble(self) -> float:
|
||||
"""
|
||||
* Returns a decoded double from the packet.
|
||||
*
|
||||
* @return A decoded double from the packet.
|
||||
"""
|
||||
"""Return a decoded double from the packet."""
|
||||
return self._decodeGeneric("<d", 8)
|
||||
|
||||
def decodeBoolean(self) -> bool:
|
||||
"""
|
||||
* Returns a decoded boolean from the packet.
|
||||
*
|
||||
* @return A decoded boolean from the packet.
|
||||
"""
|
||||
"""Return a decoded boolean from the packet."""
|
||||
return self.decode8() == 1
|
||||
|
||||
def decodeDoubleArray(self, length: int) -> list[float]:
|
||||
"""
|
||||
* Returns a decoded array of floats from the packet.
|
||||
"""
|
||||
"""Return a decoded list of doubles of the given length from the packet."""
|
||||
ret = []
|
||||
for _ in range(length):
|
||||
ret.append(self.decodeDouble())
|
||||
return ret
|
||||
|
||||
def decodeShortList(self) -> list[int]:
|
||||
"""
|
||||
* Returns a decoded array of shorts from the packet.
|
||||
"""
|
||||
"""Return a decoded list of shorts from the packet (length-prefixed)."""
|
||||
length = self.decode8()
|
||||
ret = []
|
||||
for _ in range(length):
|
||||
@@ -176,11 +136,7 @@ class Packet:
|
||||
return ret
|
||||
|
||||
def decodeTransform(self) -> Transform3d:
|
||||
"""
|
||||
* Returns a decoded Transform3d
|
||||
*
|
||||
* @return A decoded Tansform3d from the packet.
|
||||
"""
|
||||
"""Return a decoded Transform3d from the packet."""
|
||||
x = self.decodeDouble()
|
||||
y = self.decodeDouble()
|
||||
z = self.decodeDouble()
|
||||
|
||||
@@ -261,18 +261,18 @@ class PhotonPoseEstimator:
|
||||
def update(
|
||||
self, cameraResult: Optional[PhotonPipelineResult] = None
|
||||
) -> Optional[EstimatedRobotPose]:
|
||||
"""
|
||||
Updates the estimated position of the robot. Returns empty if:
|
||||
"""Update the estimated robot position.
|
||||
|
||||
- The timestamp of the provided pipeline result is the same as in the previous call to
|
||||
``update()``.
|
||||
Returns empty if one of the following is true:
|
||||
|
||||
- No targets were found in the pipeline results.
|
||||
- The timestamp of the provided pipeline result is the same as in the previous call to
|
||||
``update()``.
|
||||
- No targets were found in the pipeline results.
|
||||
|
||||
:param cameraResult: The latest pipeline result from the camera
|
||||
:param cameraResult: The latest pipeline result from the camera.
|
||||
|
||||
:returns: an :class:`EstimatedRobotPose` with an estimated pose, timestamp, and targets used to
|
||||
create the estimate.
|
||||
:returns: An :class:`EstimatedRobotPose` with an estimated pose, timestamp, and targets used
|
||||
to create the estimate, or ``None`` if no estimate could be made.
|
||||
"""
|
||||
if not cameraResult:
|
||||
if not self._camera:
|
||||
|
||||
@@ -306,14 +306,13 @@ class SimCameraProperties:
|
||||
:param a: The initial translation of the line
|
||||
:param b: The final translation of the line
|
||||
|
||||
:returns: A Pair of Doubles. The values may be null:
|
||||
:returns: A pair of floats (t_min, t_max) where each may be ``None``:
|
||||
|
||||
- {Double, Double} : Two parametrized values(t), minimum first, representing which
|
||||
segment of the line is visible in the camera frustum.
|
||||
- {Double, null} : One value(t) representing a single intersection point. For example,
|
||||
the line only intersects the intersection of two adjacent viewplanes.
|
||||
- {null, null} : No values. The line segment is not visible in the camera frustum.
|
||||
"""
|
||||
- ``(float, float)``: Two t values (minimum first) representing the visible segment.
|
||||
- ``(float, None)``: A single intersection point.
|
||||
- ``(None, None)``: No intersection; the segment is not visible.
|
||||
|
||||
"""
|
||||
|
||||
# translations relative to the camera
|
||||
relA = camRt.applyTranslation(a)
|
||||
|
||||
Reference in New Issue
Block a user