Skip to content

Commit ec95707

Browse files
committed
try converting
1 parent abb8ccf commit ec95707

File tree

14 files changed

+283
-228
lines changed

14 files changed

+283
-228
lines changed

.github/workflows/photon-api-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ jobs:
105105
pattern: docs-*
106106
- run: find .
107107
- name: Publish Docs To Development
108-
if: github.ref == 'refs/heads/main'
108+
# if: github.ref == 'refs/heads/main'
109109
uses: up9cloud/[email protected]
110110
env:
111111
HOST: ${{ secrets.WEBMASTER_SSH_HOST }}

photon-lib/py/mkdocs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ plugins:
1313
python:
1414
options:
1515
show_source: false
16-
docstring_style: sphinx
1716
paths:
1817
- "."
1918
- gen-files:

photon-lib/py/photonlibpy/estimation/openCVHelp.py

Lines changed: 54 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ def translationToTVec(translations: list[Translation3d]) -> np.ndarray:
3333
"""Creates a new :class:`np.array` with these 3d translations. The opencv tvec is a vector with
3434
three elements representing {x, y, z} in the EDN coordinate system.
3535
36-
:param translations: The translations to convert into a np.array
36+
Args:
37+
translations: The translations to convert into a np.array
3738
"""
3839

3940
retVal: list[list] = []
@@ -51,7 +52,8 @@ def rotationToRVec(rotation: Rotation3d) -> np.ndarray:
5152
three elements representing the axis scaled by the angle in the EDN coordinate system. (angle =
5253
norm, and axis = rvec / norm)
5354
54-
:param rotation: The rotation to convert into a np.array
55+
Args:
56+
rotation: The rotation to convert into a np.array
5557
"""
5658

5759
retVal: list[np.ndarray] = []
@@ -115,12 +117,16 @@ def reorderCircular(
115117
116118
({1,2,3}, true, 1) == {3,2,1}
117119
118-
:param elements: list elements
119-
:param backwards: If indexing should happen in reverse (0, size-1, size-2, ...)
120-
:param shiftStart: How much the initial index should be shifted (instead of starting at index 0,
121-
start at shiftStart, negated if backwards)
120+
Args:
121+
elements: list elements
122+
backwards: If indexing should happen in reverse (0, size-1,
123+
size-2, ...)
124+
shiftStart: How much the initial index should be shifted
125+
(instead of starting at index 0, start at shiftStart,
126+
negated if backwards)
122127
123-
:returns: Reordered list
128+
Returns:
129+
Reordered list
124130
"""
125131

126132
size = len(elements)
@@ -154,7 +160,8 @@ def tVecToTranslation(tvecInput: np.ndarray) -> Translation3d:
154160
"""Returns a new 3d translation from this :class:`.Mat`. The opencv tvec is a vector with three
155161
elements representing {x, y, z} in the EDN coordinate system.
156162
157-
:param tvecInput: The tvec to create a Translation3d from
163+
Args:
164+
tvecInput: The tvec to create a Translation3d from
158165
"""
159166

160167
return OpenCVHelp.translationEDNToNWU(Translation3d(tvecInput))
@@ -165,7 +172,8 @@ def rVecToRotation(rvecInput: np.ndarray) -> Rotation3d:
165172
elements representing the axis scaled by the angle in the EDN coordinate system. (angle = norm,
166173
and axis = rvec / norm)
167174
168-
:param rvecInput: The rvec to create a Rotation3d from
175+
Args:
176+
rvecInput: The rvec to create a Rotation3d from
169177
"""
170178

171179
return OpenCVHelp.rotationEDNToNWU(Rotation3d(rvecInput))
@@ -189,20 +197,27 @@ def solvePNP_Square(
189197
This method is intended for use with individual AprilTags, and will not work unless 4 points
190198
are provided.
191199
192-
:param cameraMatrix: The camera intrinsics matrix in standard opencv form
193-
:param distCoeffs: The camera distortion matrix in standard opencv form
194-
:param modelTrls: The translations of the object corners. These should have the object pose as
195-
their origin. These must come in a specific, pose-relative order (in NWU):
196-
197-
- Point 0: [0, -squareLength / 2, squareLength / 2]
198-
- Point 1: [0, squareLength / 2, squareLength / 2]
199-
- Point 2: [0, squareLength / 2, -squareLength / 2]
200-
- Point 3: [0, -squareLength / 2, -squareLength / 2]
201-
:param imagePoints: The projection of these 3d object points into the 2d camera image. The order
202-
should match the given object point translations.
203-
204-
:returns: The resulting transformation that maps the camera pose to the target pose and the
205-
ambiguity if an alternate solution is available.
200+
Args:
201+
cameraMatrix: The camera intrinsics matrix in standard
202+
opencv form
203+
distCoeffs: The camera distortion matrix in standard opencv
204+
form
205+
modelTrls: The translations of the object corners. These
206+
should have the object pose as their origin. These must
207+
come in a specific, pose-relative order (in NWU):
208+
209+
- Point 0: [0, -squareLength / 2, squareLength / 2]
210+
- Point 1: [0, squareLength / 2, squareLength / 2]
211+
- Point 2: [0, squareLength / 2, -squareLength / 2]
212+
- Point 3: [0, -squareLength / 2, -squareLength / 2]
213+
imagePoints: The projection of these 3d object points into
214+
the 2d camera image. The order should match the given
215+
object point translations.
216+
217+
Returns:
218+
The resulting transformation that maps the camera pose to
219+
the target pose and the ambiguity if an alternate solution
220+
is available.
206221
"""
207222
modelTrls = OpenCVHelp.reorderCircular(modelTrls, True, -1)
208223
imagePoints = np.array(OpenCVHelp.reorderCircular(imagePoints, True, -1))
@@ -283,15 +298,22 @@ def solvePNP_SQPNP(
283298
solution-- if you are intending to use solvePNP on a single AprilTag, see {@link
284299
#solvePNP_SQUARE} instead.
285300
286-
:param cameraMatrix: The camera intrinsics matrix in standard opencv form
287-
:param distCoeffs: The camera distortion matrix in standard opencv form
288-
:param objectTrls: The translations of the object corners, relative to the field.
289-
:param imagePoints: The projection of these 3d object points into the 2d camera image. The order
290-
should match the given object point translations.
291-
292-
:returns: The resulting transformation that maps the camera pose to the target pose. If the 3d
293-
model points are supplied relative to the origin, this transformation brings the camera to
294-
the origin.
301+
Args:
302+
cameraMatrix: The camera intrinsics matrix in standard
303+
opencv form
304+
distCoeffs: The camera distortion matrix in standard opencv
305+
form
306+
objectTrls: The translations of the object corners, relative
307+
to the field.
308+
imagePoints: The projection of these 3d object points into
309+
the 2d camera image. The order should match the given
310+
object point translations.
311+
312+
Returns:
313+
The resulting transformation that maps the camera pose to
314+
the target pose. If the 3d model points are supplied
315+
relative to the origin, this transformation brings the
316+
camera to the origin.
295317
"""
296318

297319
objectMat = np.array(OpenCVHelp.translationToTVec(modelTrls))

photon-lib/py/photonlibpy/estimation/rotTrlTransform3d.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ def __init__(
1414
Applying this RotTrlTransform3d to poses will preserve their current origin-to-pose
1515
transform as if the origin was transformed by these components instead.
1616
17-
:param rot: The rotation component
18-
:param trl: The translation component
17+
Args:
18+
rot: The rotation component
19+
trl: The translation component
1920
"""
2021
self.rot = rot
2122
self.trl = trl
@@ -61,7 +62,8 @@ def makeRelativeTo(cls, pose: Pose3d) -> Self:
6162
"""The rotation-translation transformation that makes poses in the world consider this pose as the
6263
new origin, or change the basis to this pose.
6364
64-
:param pose: The new origin
65+
Args:
66+
pose: The new origin
6567
"""
6668
return cls(pose.rotation(), pose.translation()).inverse()
6769

photon-lib/py/photonlibpy/estimation/targetModel.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,9 @@ def createArbitrary(cls, verts: List[Translation3d]) -> Self:
106106
vertices are planar(x == 0). More than 2 vertices must be given. If this is a planar model, the
107107
vertices should define a non-intersecting contour.
108108
109-
:param vertices: Translations representing the vertices of this target model relative to its
110-
pose.
109+
Args:
110+
vertices: Translations representing the vertices of this
111+
target model relative to its pose.
111112
"""
112113

113114
tm = cls()
@@ -151,10 +152,12 @@ def getOrientedPose(cls, tgtTrl: Translation3d, cameraTrl: Translation3d):
151152
to the camera translation. This is used for spherical targets which should not have their
152153
projection change regardless of their own rotation.
153154
154-
:param tgtTrl: This target's translation
155-
:param cameraTrl: Camera's translation
155+
Args:
156+
tgtTrl: This target's translation
157+
cameraTrl: Camera's translation
156158
157-
:returns: This target's pose oriented to the camera
159+
Returns:
160+
This target's pose oriented to the camera
158161
"""
159162

160163
relCam = cameraTrl - tgtTrl

photon-lib/py/photonlibpy/estimation/visionEstimation.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,19 @@ def estimateCamPosePNP(
4141
4242
With multiple tags: {@link OpenCVHelp#solvePNP_SQPNP}
4343
44-
:param cameraMatrix: The camera intrinsics matrix in standard opencv form
45-
:param distCoeffs: The camera distortion matrix in standard opencv form
46-
:param visTags: The visible tags reported by PV. Non-tag targets are automatically excluded.
47-
:param tagLayout: The known tag layout on the field
48-
49-
:returns: The transformation that maps the field origin to the camera pose. Ensure the {@link
50-
PnpResult} are present before utilizing them.
44+
Args:
45+
cameraMatrix: The camera intrinsics matrix in standard
46+
opencv form
47+
distCoeffs: The camera distortion matrix in standard opencv
48+
form
49+
visTags: The visible tags reported by PV. Non-tag targets
50+
are automatically excluded.
51+
tagLayout: The known tag layout on the field
52+
53+
Returns:
54+
The transformation that maps the field origin to the camera
55+
pose. Ensure the {@link PnpResult} are present before
56+
utilizing them.
5157
"""
5258
if len(visTags) == 0:
5359
return None

0 commit comments

Comments
 (0)