Skip to content

Commit

Permalink
wpiformat
Browse files Browse the repository at this point in the history
  • Loading branch information
james-ward committed Nov 12, 2024
1 parent 4ff2230 commit 3afd69a
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions photon-lib/py/photonlibpy/photonCamera.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
from typing import List

import ntcore
import wpilib
from wpilib import RobotController, Timer

# magical import to make serde stuff work
import photonlibpy.generated # noqa
import wpilib
from wpilib import RobotController, Timer

from .packet import Packet
from .targeting.photonPipelineResult import PhotonPipelineResult
Expand Down
2 changes: 0 additions & 2 deletions photon-lib/py/photonlibpy/targeting/multiTargetPNPResult.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

from wpimath.geometry import Transform3d

from ..packet import Packet

if TYPE_CHECKING:
from .. import generated

Expand Down
5 changes: 3 additions & 2 deletions photon-lib/py/test/photonPoseEstimator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
## along with this program. If not, see <https://www.gnu.org/licenses/>.
###############################################################################

from robotpy_apriltag import AprilTag, AprilTagFieldLayout
from wpimath.geometry import Pose3d, Rotation3d, Transform3d, Translation3d

from photonlibpy import PhotonPoseEstimator, PoseStrategy
from photonlibpy.targeting import (
PhotonPipelineMetadata,
Expand All @@ -23,8 +26,6 @@
)
from photonlibpy.targeting.multiTargetPNPResult import MultiTargetPNPResult, PnpResult
from photonlibpy.targeting.photonPipelineResult import PhotonPipelineResult
from robotpy_apriltag import AprilTag, AprilTagFieldLayout
from wpimath.geometry import Pose3d, Rotation3d, Transform3d, Translation3d


class PhotonCameraInjector:
Expand Down
1 change: 1 addition & 0 deletions photon-lib/py/test/photonlibpy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from time import sleep

import ntcore

from photonlibpy import PhotonCamera
from photonlibpy.photonCamera import setVersionCheckEnabled

Expand Down
7 changes: 4 additions & 3 deletions photon-lib/py/test/visionSystemSim_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

import ntcore as nt
import pytest
from photonlibpy.estimation import TargetModel, VisionEstimation
from photonlibpy.photonCamera import PhotonCamera, setVersionCheckEnabled
from photonlibpy.simulation import PhotonCameraSim, VisionSystemSim, VisionTargetSim
from robotpy_apriltag import AprilTag, AprilTagFieldLayout
from wpimath.geometry import (
Pose2d,
Expand All @@ -17,6 +14,10 @@
)
from wpimath.units import feetToMeters, meters

from photonlibpy.estimation import TargetModel, VisionEstimation
from photonlibpy.photonCamera import PhotonCamera, setVersionCheckEnabled
from photonlibpy.simulation import PhotonCameraSim, VisionSystemSim, VisionTargetSim


@pytest.fixture(autouse=True)
def setupCommon() -> None:
Expand Down
1 change: 1 addition & 0 deletions photonlib-python-examples/aimandrange/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import drivetrain
import wpilib

from photonlibpy import PhotonCamera

VISION_TURN_kP = 0.01
Expand Down
1 change: 1 addition & 0 deletions photonlib-python-examples/aimattarget/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import drivetrain
import wpilib

from photonlibpy import PhotonCamera

VISION_TURN_kP = 0.01
Expand Down
3 changes: 2 additions & 1 deletion photonlib-python-examples/poseest/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
import drivetrain
import wpilib
import wpimath.geometry
from photonlibpy import PhotonCamera, PhotonPoseEstimator, PoseStrategy
from robotpy_apriltag import AprilTagField, loadAprilTagLayoutField

from photonlibpy import PhotonCamera, PhotonPoseEstimator, PoseStrategy

kRobotToCam = wpimath.geometry.Transform3d(
wpimath.geometry.Translation3d(0.5, 0.0, 0.5),
wpimath.geometry.Rotation3d.fromDegrees(0.0, -30.0, 0.0),
Expand Down

0 comments on commit 3afd69a

Please sign in to comment.