Compare commits

...

65 Commits

Author SHA1 Message Date
samfreund
f022130bfa do stuff 2025-11-26 21:10:02 -06:00
Sam Freund
5457db947e Merge branch 'main' into py-docs 2025-11-26 20:01:24 -06:00
samfreund
a7329c48a3 lint 2025-11-25 15:31:11 -06:00
Sam Freund
ce0b00ee03 Merge branch 'main' into py-docs 2025-11-25 15:25:17 -06:00
Sam Freund
99ca8228a1 Merge branch 'main' into py-docs 2025-10-23 16:14:46 -05:00
samfreund
46e71703ef trigger docs run 2025-06-18 16:06:54 -05:00
samfreund
6fbb41fb76 this should fix importing? 2025-05-09 13:06:42 -05:00
samfreund
05fcf876cd debugggggging 2025-05-09 13:03:05 -05:00
samfreund
1637be6044 change path 2025-05-09 12:57:42 -05:00
samfreund
6f2fd19351 add files to index 2025-05-09 12:47:58 -05:00
samfreund
892e240b18 change theme 2025-05-09 12:44:31 -05:00
samfreund
326c77fa38 dammit, it was a typo 2025-05-09 12:41:57 -05:00
samfreund
8cf48bee57 update requirements.txt 2025-05-09 12:35:33 -05:00
samfreund
26f08a6fdf switch to sphinx 2025-05-09 12:29:47 -05:00
Sam Freund
abb8ccf4e9 add conditionals for publishing 2025-05-09 11:06:18 -05:00
Sam Freund
50adef1672 publish release docs 2025-05-09 11:04:26 -05:00
samfreund
cf68403182 Merge branch 'py-docs' of github.com:photonvision/photonvision into py-docs 2025-05-09 11:01:09 -05:00
samfreund
dc0985dfb5 fix docstrings style 2025-05-09 11:01:05 -05:00
Sam Freund
8fb29ff5c4 Update photon-api-docs.yml 2025-05-09 10:17:45 -05:00
Sam Freund
476cd6df8b Update photon-api-docs.yml 2025-05-09 10:17:00 -05:00
samfreund
783ed82d50 Merge branch 'py-docs' of github.com:photonvision/photonvision into py-docs 2025-05-08 23:36:29 -05:00
samfreund
416e2f7607 update versions 2025-05-08 23:36:23 -05:00
Sam Freund
ebd1071553 Merge branch 'main' into py-docs 2025-05-08 23:33:50 -05:00
samfreund
fa8b60fe27 convert to requirements.txt 2025-05-08 23:33:00 -05:00
Sam Freund
c2581f3e99 limit publishing 2025-05-08 18:34:20 -05:00
samfreund
96b0938dc0 Merge branch 'py-docs' of github.com:photonvision/photonvision into py-docs 2025-05-08 18:31:35 -05:00
samfreund
697e52f886 lint 2025-05-08 18:30:42 -05:00
Sam Freund
87b219d9be Merge branch 'main' into py-docs 2025-05-08 18:29:37 -05:00
samfreund
abcd6b8f50 add docs to readme 2025-05-08 17:30:16 -05:00
Sam Freund
b22371d7c0 Merge branch 'main' into py-docs 2025-04-14 21:41:09 -05:00
samfreund
3eea79f0d4 Merge branch 'py-docs' of github.com:photonvision/photonvision into py-docs 2025-04-14 00:36:07 -05:00
samfreund
0147a44100 remove source 2025-04-14 00:36:02 -05:00
Sam Freund
0bec1f239c Update photon-api-docs.yml 2025-04-13 23:31:09 -05:00
samfreund
44b46cf117 yeah that's good enough 2025-04-13 23:29:32 -05:00
Sam Freund
ffdda9ddfa Update photon-api-docs.yml 2025-04-13 14:57:00 -05:00
Sam Freund
a5bc63878d Merge branch 'main' into py-docs 2025-04-13 14:50:54 -05:00
Sam Freund
a5b1cc0ded Update photon-api-docs.yml 2025-04-13 14:48:39 -05:00
Sam Freund
aacbdf5010 Update index.md 2025-04-13 10:53:34 -05:00
samfreund
3547d0584b exclude generated files 2025-04-13 10:51:39 -05:00
Sam Freund
40815020de Update photon-api-docs.yml 2025-04-13 10:47:52 -05:00
samfreund
e522642a48 linting 2025-04-13 10:43:40 -05:00
Sam Freund
3cdda8a84e Add instructions for excluding a file 2025-04-13 10:38:44 -05:00
Sam Freund
228caf47f2 Update photon-api-docs.yml 2025-04-13 10:30:34 -05:00
samfreund
d1761d07e9 update to exclude packet.py 2025-04-13 10:22:10 -05:00
samfreund
331f4f0218 Merge branch 'py-docs' of github.com:photonvision/photonvision into py-docs 2025-04-13 08:09:23 -05:00
samfreund
eb85834180 add brand color 2025-04-13 08:09:17 -05:00
Sam Freund
871ca61c8d Merge branch 'main' into py-docs 2025-04-13 07:56:26 -05:00
samfreund
358f5747ab man I hate linting 2025-04-12 22:54:50 -05:00
Sam Freund
e334d26459 Update python.yml 2025-04-12 22:53:16 -05:00
Sam Freund
77d5388a35 Update photon-api-docs.yml 2025-04-12 22:46:27 -05:00
samfreund
88a1e789ad actually add the logo 2025-04-12 22:41:36 -05:00
samfreund
abc67bdd95 add logo 2025-04-12 22:37:18 -05:00
Sam Freund
05309b1e25 Update mkdocs.yml 2025-04-12 22:35:20 -05:00
Sam Freund
ddacff7079 Update photon-api-docs.yml 2025-04-12 22:32:18 -05:00
samfreund
32e4f0029b Merge branch 'py-docs' of github.com:photonvision/photonvision into py-docs 2025-04-12 22:30:08 -05:00
samfreund
34057f223d autogen files 2025-04-12 22:29:41 -05:00
Sam Freund
55303ccd9c Update index.md 2025-04-12 17:33:57 -05:00
Sam Freund
3c73b68ba3 Update index.md 2025-04-12 17:33:37 -05:00
Sam Freund
6d816b5053 Update photon-api-docs.yml 2025-04-12 17:19:46 -05:00
Sam Freund
7c6bab1dfa Update photon-api-docs.yml 2025-04-12 17:17:21 -05:00
Sam Freund
462a2aa629 Update photon-api-docs.yml 2025-04-12 17:16:07 -05:00
samfreund
47b799a0ce add docs for python 2025-04-12 17:12:13 -05:00
Sam Freund
35c72e8446 Update photon-api-docs.yml 2025-04-12 16:49:42 -05:00
Sam Freund
c440ce57ce Update photon-api-docs.yml 2025-04-12 16:49:06 -05:00
Sam Freund
8452527589 Update photon-api-docs.yml 2025-04-12 16:44:25 -05:00
28 changed files with 726 additions and 77 deletions

View File

@@ -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'

View File

@@ -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
View File

@@ -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

View File

@@ -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

View File

@@ -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>
```

View 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)

View File

@@ -0,0 +1,5 @@
# Minimal wpimath stub for Sphinx docs build
from . import geometry
from . import units
__all__ = ["geometry", "units"]

View 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

View 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"]

View 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"]

View File

@@ -0,0 +1,3 @@
from ._interpolation import *
__all__ = ["TimeInterpolatableRotation2dBuffer"]

View File

@@ -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"]

View 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

View 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

View File

@@ -0,0 +1,3 @@
sphinx==7.2.6
sphinx-autodoc-typehints==1.25.2
sphinx-rtd-theme==1.3.0

View 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"]

View 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

View File

@@ -0,0 +1,7 @@
photonlibpy
===========
.. toctree::
:maxdepth: 4
photonlibpy

View 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:

View 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:

View 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:

View 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:

View 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:

View 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:

View 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:

View File

@@ -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()

View File

@@ -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:

View File

@@ -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)