Skip to content

Commit

Permalink
Format after CI run
Browse files Browse the repository at this point in the history
  • Loading branch information
james-ward committed Nov 11, 2024
1 parent 177df76 commit 07e4ddc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
12 changes: 7 additions & 5 deletions photon-lib/py/photonlibpy/estimation/openCVHelp.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import math
from typing import Any, Tuple
from typing import Any

import cv2 as cv
import numpy as np
Expand Down Expand Up @@ -126,8 +126,8 @@ def solvePNP_Square(
objectMat = np.array(OpenCVHelp.translationToTVec(modelTrls))

alt: Transform3d | None = None
reprojectionError : cv.typing.MatLike | None = None
best : Transform3d = Transform3d()
reprojectionError: cv.typing.MatLike | None = None
best: Transform3d = Transform3d()
alt: Transform3d | None = None

for tries in range(2):
Expand All @@ -149,7 +149,9 @@ def solvePNP_Square(
OpenCVHelp.rVecToRotation(rvecs[1]),
)

if reprojectionError is not None and not math.isnan(reprojectionError[0, 0]):
if reprojectionError is not None and not math.isnan(
reprojectionError[0, 0]
):
break
else:
pt = imagePoints[0]
Expand All @@ -160,7 +162,7 @@ def solvePNP_Square(
if reprojectionError is None or math.isnan(reprojectionError[0, 0]):
print("SolvePNP_Square failed!")
return None

if alt:
return PnpResult(
best=best,
Expand Down
6 changes: 2 additions & 4 deletions photon-lib/py/photonlibpy/simulation/photonCameraSim.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,7 @@ def distance(target: VisionTargetSim):

targets.sort(key=distance, reverse=True)

visibleTgts: list[
typing.Tuple[VisionTargetSim, np.ndarray]
] = []
visibleTgts: list[typing.Tuple[VisionTargetSim, np.ndarray]] = []
detectableTgts: list[PhotonTrackedTarget] = []

camRt = RotTrlTransform3d.makeRelativeTo(cameraPose)
Expand Down Expand Up @@ -271,7 +269,7 @@ def distance(target: VisionTargetSim):
if i != t and i != l and i != b:
r = i
rect = cv.RotatedRect(
(center[0,0], center[0,1]),
(center[0, 0], center[0, 1]),
(
imagePoints[r, 0, 0] - lc[0, 0],
imagePoints[b, 0, 1] - imagePoints[t, 0, 1],
Expand Down
4 changes: 1 addition & 3 deletions photon-lib/py/photonlibpy/simulation/simCameraProperties.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,7 @@ def getLatencyStdDev(self) -> seconds:
return self.latencyStdDev

def getContourAreaPercent(self, points: np.ndarray) -> float:
return (
cv.contourArea(cv.convexHull(points)) / self.getResArea() * 100.0
)
return cv.contourArea(cv.convexHull(points)) / self.getResArea() * 100.0

def getPixelYaw(self, pixelX: float) -> Rotation2d:
fx = self.camIntrinsics[0, 0]
Expand Down

0 comments on commit 07e4ddc

Please sign in to comment.