photonlibpy 2024.3.1__py3-none-any.whl → 2025.0.0b1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
photonlibpy/__init__.py CHANGED
@@ -1 +1,21 @@
1
- # No one here but us chickens
1
+ ###############################################################################
2
+ ## Copyright (C) Photon Vision.
3
+ ###############################################################################
4
+ ## This program is free software: you can redistribute it and/or modify
5
+ ## it under the terms of the GNU General Public License as published by
6
+ ## the Free Software Foundation, either version 3 of the License, or
7
+ ## (at your option) any later version.
8
+ ##
9
+ ## This program is distributed in the hope that it will be useful,
10
+ ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ ## GNU General Public License for more details.
13
+ ##
14
+ ## You should have received a copy of the GNU General Public License
15
+ ## along with this program. If not, see <https://www.gnu.org/licenses/>.
16
+ ###############################################################################
17
+
18
+ from .packet import Packet # noqa
19
+ from .estimatedRobotPose import EstimatedRobotPose # noqa
20
+ from .photonPoseEstimator import PhotonPoseEstimator, PoseStrategy # noqa
21
+ from .photonCamera import PhotonCamera # noqa
@@ -1,9 +1,26 @@
1
+ ###############################################################################
2
+ ## Copyright (C) Photon Vision.
3
+ ###############################################################################
4
+ ## This program is free software: you can redistribute it and/or modify
5
+ ## it under the terms of the GNU General Public License as published by
6
+ ## the Free Software Foundation, either version 3 of the License, or
7
+ ## (at your option) any later version.
8
+ ##
9
+ ## This program is distributed in the hope that it will be useful,
10
+ ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ ## GNU General Public License for more details.
13
+ ##
14
+ ## You should have received a copy of the GNU General Public License
15
+ ## along with this program. If not, see <https://www.gnu.org/licenses/>.
16
+ ###############################################################################
17
+
1
18
  from dataclasses import dataclass
2
19
  from typing import TYPE_CHECKING
3
20
 
4
21
  from wpimath.geometry import Pose3d
5
22
 
6
- from .photonTrackedTarget import PhotonTrackedTarget
23
+ from .targeting.photonTrackedTarget import PhotonTrackedTarget
7
24
 
8
25
  if TYPE_CHECKING:
9
26
  from .photonPoseEstimator import PoseStrategy
@@ -0,0 +1,57 @@
1
+ ###############################################################################
2
+ ## Copyright (C) Photon Vision.
3
+ ###############################################################################
4
+ ## This program is free software: you can redistribute it and/or modify
5
+ ## it under the terms of the GNU General Public License as published by
6
+ ## the Free Software Foundation, either version 3 of the License, or
7
+ ## (at your option) any later version.
8
+ ##
9
+ ## This program is distributed in the hope that it will be useful,
10
+ ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ ## GNU General Public License for more details.
13
+ ##
14
+ ## You should have received a copy of the GNU General Public License
15
+ ## along with this program. If not, see <https://www.gnu.org/licenses/>.
16
+ ###############################################################################
17
+
18
+ ###############################################################################
19
+ ## THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py.
20
+ ## --> DO NOT MODIFY <--
21
+ ###############################################################################
22
+
23
+ from ..targeting import *
24
+ from ..packet import Packet
25
+
26
+
27
+ class MultiTargetPNPResultSerde:
28
+ # Message definition md5sum. See photon_packet.adoc for details
29
+ MESSAGE_VERSION = "541096947e9f3ca2d3f425ff7b04aa7b"
30
+ MESSAGE_FORMAT = "PnpResult:ae4d655c0a3104d88df4f5db144c1e86 estimatedPose;int16 fiducialIDsUsed[?];"
31
+
32
+ @staticmethod
33
+ def pack(value: "MultiTargetPNPResult") -> "Packet":
34
+ ret = Packet()
35
+
36
+ # estimatedPose is of non-intrinsic type PnpResult
37
+ ret.encodeBytes(PnpResult.photonStruct.pack(value.estimatedPose).getData())
38
+
39
+ # fiducialIDsUsed is a custom VLA!
40
+ ret.encodeShortList(value.fiducialIDsUsed)
41
+ return ret
42
+
43
+ @staticmethod
44
+ def unpack(packet: "Packet") -> "MultiTargetPNPResult":
45
+ ret = MultiTargetPNPResult()
46
+
47
+ # estimatedPose is of non-intrinsic type PnpResult
48
+ ret.estimatedPose = PnpResult.photonStruct.unpack(packet)
49
+
50
+ # fiducialIDsUsed is a custom VLA!
51
+ ret.fiducialIDsUsed = packet.decodeShortList()
52
+
53
+ return ret
54
+
55
+
56
+ # Hack ourselves into the base class
57
+ MultiTargetPNPResult.photonStruct = MultiTargetPNPResultSerde()
@@ -0,0 +1,69 @@
1
+ ###############################################################################
2
+ ## Copyright (C) Photon Vision.
3
+ ###############################################################################
4
+ ## This program is free software: you can redistribute it and/or modify
5
+ ## it under the terms of the GNU General Public License as published by
6
+ ## the Free Software Foundation, either version 3 of the License, or
7
+ ## (at your option) any later version.
8
+ ##
9
+ ## This program is distributed in the hope that it will be useful,
10
+ ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ ## GNU General Public License for more details.
13
+ ##
14
+ ## You should have received a copy of the GNU General Public License
15
+ ## along with this program. If not, see <https://www.gnu.org/licenses/>.
16
+ ###############################################################################
17
+
18
+ ###############################################################################
19
+ ## THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py.
20
+ ## --> DO NOT MODIFY <--
21
+ ###############################################################################
22
+
23
+ from ..targeting import *
24
+ from ..packet import Packet
25
+
26
+
27
+ class PhotonPipelineMetadataSerde:
28
+ # Message definition md5sum. See photon_packet.adoc for details
29
+ MESSAGE_VERSION = "ac0a45f686457856fb30af77699ea356"
30
+ MESSAGE_FORMAT = "int64 sequenceID;int64 captureTimestampMicros;int64 publishTimestampMicros;int64 timeSinceLastPong;"
31
+
32
+ @staticmethod
33
+ def pack(value: "PhotonPipelineMetadata") -> "Packet":
34
+ ret = Packet()
35
+
36
+ # sequenceID is of intrinsic type int64
37
+ ret.encodeLong(value.sequenceID)
38
+
39
+ # captureTimestampMicros is of intrinsic type int64
40
+ ret.encodeLong(value.captureTimestampMicros)
41
+
42
+ # publishTimestampMicros is of intrinsic type int64
43
+ ret.encodeLong(value.publishTimestampMicros)
44
+
45
+ # timeSinceLastPong is of intrinsic type int64
46
+ ret.encodeLong(value.timeSinceLastPong)
47
+ return ret
48
+
49
+ @staticmethod
50
+ def unpack(packet: "Packet") -> "PhotonPipelineMetadata":
51
+ ret = PhotonPipelineMetadata()
52
+
53
+ # sequenceID is of intrinsic type int64
54
+ ret.sequenceID = packet.decodeLong()
55
+
56
+ # captureTimestampMicros is of intrinsic type int64
57
+ ret.captureTimestampMicros = packet.decodeLong()
58
+
59
+ # publishTimestampMicros is of intrinsic type int64
60
+ ret.publishTimestampMicros = packet.decodeLong()
61
+
62
+ # timeSinceLastPong is of intrinsic type int64
63
+ ret.timeSinceLastPong = packet.decodeLong()
64
+
65
+ return ret
66
+
67
+
68
+ # Hack ourselves into the base class
69
+ PhotonPipelineMetadata.photonStruct = PhotonPipelineMetadataSerde()
@@ -0,0 +1,65 @@
1
+ ###############################################################################
2
+ ## Copyright (C) Photon Vision.
3
+ ###############################################################################
4
+ ## This program is free software: you can redistribute it and/or modify
5
+ ## it under the terms of the GNU General Public License as published by
6
+ ## the Free Software Foundation, either version 3 of the License, or
7
+ ## (at your option) any later version.
8
+ ##
9
+ ## This program is distributed in the hope that it will be useful,
10
+ ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ ## GNU General Public License for more details.
13
+ ##
14
+ ## You should have received a copy of the GNU General Public License
15
+ ## along with this program. If not, see <https://www.gnu.org/licenses/>.
16
+ ###############################################################################
17
+
18
+ ###############################################################################
19
+ ## THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py.
20
+ ## --> DO NOT MODIFY <--
21
+ ###############################################################################
22
+
23
+ from ..targeting import *
24
+ from ..packet import Packet
25
+
26
+
27
+ class PhotonPipelineResultSerde:
28
+ # Message definition md5sum. See photon_packet.adoc for details
29
+ MESSAGE_VERSION = "4b2ff16a964b5e2bf04be0c1454d91c4"
30
+ MESSAGE_FORMAT = "PhotonPipelineMetadata:ac0a45f686457856fb30af77699ea356 metadata;PhotonTrackedTarget:cc6dbb5c5c1e0fa808108019b20863f1 targets[?];optional MultiTargetPNPResult:541096947e9f3ca2d3f425ff7b04aa7b multitagResult;"
31
+
32
+ @staticmethod
33
+ def pack(value: "PhotonPipelineResult") -> "Packet":
34
+ ret = Packet()
35
+
36
+ # metadata is of non-intrinsic type PhotonPipelineMetadata
37
+ ret.encodeBytes(
38
+ PhotonPipelineMetadata.photonStruct.pack(value.metadata).getData()
39
+ )
40
+
41
+ # targets is a custom VLA!
42
+ ret.encodeList(value.targets, PhotonTrackedTarget.photonStruct)
43
+
44
+ # multitagResult is optional! it better not be a VLA too
45
+ ret.encodeOptional(value.multitagResult, MultiTargetPNPResult.photonStruct)
46
+ return ret
47
+
48
+ @staticmethod
49
+ def unpack(packet: "Packet") -> "PhotonPipelineResult":
50
+ ret = PhotonPipelineResult()
51
+
52
+ # metadata is of non-intrinsic type PhotonPipelineMetadata
53
+ ret.metadata = PhotonPipelineMetadata.photonStruct.unpack(packet)
54
+
55
+ # targets is a custom VLA!
56
+ ret.targets = packet.decodeList(PhotonTrackedTarget.photonStruct)
57
+
58
+ # multitagResult is optional! it better not be a VLA too
59
+ ret.multitagResult = packet.decodeOptional(MultiTargetPNPResult.photonStruct)
60
+
61
+ return ret
62
+
63
+
64
+ # Hack ourselves into the base class
65
+ PhotonPipelineResult.photonStruct = PhotonPipelineResultSerde()
@@ -0,0 +1,113 @@
1
+ ###############################################################################
2
+ ## Copyright (C) Photon Vision.
3
+ ###############################################################################
4
+ ## This program is free software: you can redistribute it and/or modify
5
+ ## it under the terms of the GNU General Public License as published by
6
+ ## the Free Software Foundation, either version 3 of the License, or
7
+ ## (at your option) any later version.
8
+ ##
9
+ ## This program is distributed in the hope that it will be useful,
10
+ ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ ## GNU General Public License for more details.
13
+ ##
14
+ ## You should have received a copy of the GNU General Public License
15
+ ## along with this program. If not, see <https://www.gnu.org/licenses/>.
16
+ ###############################################################################
17
+
18
+ ###############################################################################
19
+ ## THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py.
20
+ ## --> DO NOT MODIFY <--
21
+ ###############################################################################
22
+
23
+ from ..targeting import *
24
+ from ..packet import Packet
25
+
26
+
27
+ class PhotonTrackedTargetSerde:
28
+ # Message definition md5sum. See photon_packet.adoc for details
29
+ MESSAGE_VERSION = "cc6dbb5c5c1e0fa808108019b20863f1"
30
+ MESSAGE_FORMAT = "float64 yaw;float64 pitch;float64 area;float64 skew;int32 fiducialId;int32 objDetectId;float32 objDetectConf;Transform3d bestCameraToTarget;Transform3d altCameraToTarget;float64 poseAmbiguity;TargetCorner:16f6ac0dedc8eaccb951f4895d9e18b6 minAreaRectCorners[?];TargetCorner:16f6ac0dedc8eaccb951f4895d9e18b6 detectedCorners[?];"
31
+
32
+ @staticmethod
33
+ def pack(value: "PhotonTrackedTarget") -> "Packet":
34
+ ret = Packet()
35
+
36
+ # yaw is of intrinsic type float64
37
+ ret.encodeDouble(value.yaw)
38
+
39
+ # pitch is of intrinsic type float64
40
+ ret.encodeDouble(value.pitch)
41
+
42
+ # area is of intrinsic type float64
43
+ ret.encodeDouble(value.area)
44
+
45
+ # skew is of intrinsic type float64
46
+ ret.encodeDouble(value.skew)
47
+
48
+ # fiducialId is of intrinsic type int32
49
+ ret.encodeInt(value.fiducialId)
50
+
51
+ # objDetectId is of intrinsic type int32
52
+ ret.encodeInt(value.objDetectId)
53
+
54
+ # objDetectConf is of intrinsic type float32
55
+ ret.encodeFloat(value.objDetectConf)
56
+
57
+ ret.encodeTransform(value.bestCameraToTarget)
58
+
59
+ ret.encodeTransform(value.altCameraToTarget)
60
+
61
+ # poseAmbiguity is of intrinsic type float64
62
+ ret.encodeDouble(value.poseAmbiguity)
63
+
64
+ # minAreaRectCorners is a custom VLA!
65
+ ret.encodeList(value.minAreaRectCorners, TargetCorner.photonStruct)
66
+
67
+ # detectedCorners is a custom VLA!
68
+ ret.encodeList(value.detectedCorners, TargetCorner.photonStruct)
69
+ return ret
70
+
71
+ @staticmethod
72
+ def unpack(packet: "Packet") -> "PhotonTrackedTarget":
73
+ ret = PhotonTrackedTarget()
74
+
75
+ # yaw is of intrinsic type float64
76
+ ret.yaw = packet.decodeDouble()
77
+
78
+ # pitch is of intrinsic type float64
79
+ ret.pitch = packet.decodeDouble()
80
+
81
+ # area is of intrinsic type float64
82
+ ret.area = packet.decodeDouble()
83
+
84
+ # skew is of intrinsic type float64
85
+ ret.skew = packet.decodeDouble()
86
+
87
+ # fiducialId is of intrinsic type int32
88
+ ret.fiducialId = packet.decodeInt()
89
+
90
+ # objDetectId is of intrinsic type int32
91
+ ret.objDetectId = packet.decodeInt()
92
+
93
+ # objDetectConf is of intrinsic type float32
94
+ ret.objDetectConf = packet.decodeFloat()
95
+
96
+ ret.bestCameraToTarget = packet.decodeTransform()
97
+
98
+ ret.altCameraToTarget = packet.decodeTransform()
99
+
100
+ # poseAmbiguity is of intrinsic type float64
101
+ ret.poseAmbiguity = packet.decodeDouble()
102
+
103
+ # minAreaRectCorners is a custom VLA!
104
+ ret.minAreaRectCorners = packet.decodeList(TargetCorner.photonStruct)
105
+
106
+ # detectedCorners is a custom VLA!
107
+ ret.detectedCorners = packet.decodeList(TargetCorner.photonStruct)
108
+
109
+ return ret
110
+
111
+
112
+ # Hack ourselves into the base class
113
+ PhotonTrackedTarget.photonStruct = PhotonTrackedTargetSerde()
@@ -0,0 +1,71 @@
1
+ ###############################################################################
2
+ ## Copyright (C) Photon Vision.
3
+ ###############################################################################
4
+ ## This program is free software: you can redistribute it and/or modify
5
+ ## it under the terms of the GNU General Public License as published by
6
+ ## the Free Software Foundation, either version 3 of the License, or
7
+ ## (at your option) any later version.
8
+ ##
9
+ ## This program is distributed in the hope that it will be useful,
10
+ ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ ## GNU General Public License for more details.
13
+ ##
14
+ ## You should have received a copy of the GNU General Public License
15
+ ## along with this program. If not, see <https://www.gnu.org/licenses/>.
16
+ ###############################################################################
17
+
18
+ ###############################################################################
19
+ ## THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py.
20
+ ## --> DO NOT MODIFY <--
21
+ ###############################################################################
22
+
23
+ from ..targeting import *
24
+ from ..packet import Packet
25
+
26
+
27
+ class PnpResultSerde:
28
+ # Message definition md5sum. See photon_packet.adoc for details
29
+ MESSAGE_VERSION = "ae4d655c0a3104d88df4f5db144c1e86"
30
+ MESSAGE_FORMAT = "Transform3d best;Transform3d alt;float64 bestReprojErr;float64 altReprojErr;float64 ambiguity;"
31
+
32
+ @staticmethod
33
+ def pack(value: "PnpResult") -> "Packet":
34
+ ret = Packet()
35
+
36
+ ret.encodeTransform(value.best)
37
+
38
+ ret.encodeTransform(value.alt)
39
+
40
+ # bestReprojErr is of intrinsic type float64
41
+ ret.encodeDouble(value.bestReprojErr)
42
+
43
+ # altReprojErr is of intrinsic type float64
44
+ ret.encodeDouble(value.altReprojErr)
45
+
46
+ # ambiguity is of intrinsic type float64
47
+ ret.encodeDouble(value.ambiguity)
48
+ return ret
49
+
50
+ @staticmethod
51
+ def unpack(packet: "Packet") -> "PnpResult":
52
+ ret = PnpResult()
53
+
54
+ ret.best = packet.decodeTransform()
55
+
56
+ ret.alt = packet.decodeTransform()
57
+
58
+ # bestReprojErr is of intrinsic type float64
59
+ ret.bestReprojErr = packet.decodeDouble()
60
+
61
+ # altReprojErr is of intrinsic type float64
62
+ ret.altReprojErr = packet.decodeDouble()
63
+
64
+ # ambiguity is of intrinsic type float64
65
+ ret.ambiguity = packet.decodeDouble()
66
+
67
+ return ret
68
+
69
+
70
+ # Hack ourselves into the base class
71
+ PnpResult.photonStruct = PnpResultSerde()
@@ -0,0 +1,57 @@
1
+ ###############################################################################
2
+ ## Copyright (C) Photon Vision.
3
+ ###############################################################################
4
+ ## This program is free software: you can redistribute it and/or modify
5
+ ## it under the terms of the GNU General Public License as published by
6
+ ## the Free Software Foundation, either version 3 of the License, or
7
+ ## (at your option) any later version.
8
+ ##
9
+ ## This program is distributed in the hope that it will be useful,
10
+ ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ ## GNU General Public License for more details.
13
+ ##
14
+ ## You should have received a copy of the GNU General Public License
15
+ ## along with this program. If not, see <https://www.gnu.org/licenses/>.
16
+ ###############################################################################
17
+
18
+ ###############################################################################
19
+ ## THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py.
20
+ ## --> DO NOT MODIFY <--
21
+ ###############################################################################
22
+
23
+ from ..targeting import *
24
+ from ..packet import Packet
25
+
26
+
27
+ class TargetCornerSerde:
28
+ # Message definition md5sum. See photon_packet.adoc for details
29
+ MESSAGE_VERSION = "16f6ac0dedc8eaccb951f4895d9e18b6"
30
+ MESSAGE_FORMAT = "float64 x;float64 y;"
31
+
32
+ @staticmethod
33
+ def pack(value: "TargetCorner") -> "Packet":
34
+ ret = Packet()
35
+
36
+ # x is of intrinsic type float64
37
+ ret.encodeDouble(value.x)
38
+
39
+ # y is of intrinsic type float64
40
+ ret.encodeDouble(value.y)
41
+ return ret
42
+
43
+ @staticmethod
44
+ def unpack(packet: "Packet") -> "TargetCorner":
45
+ ret = TargetCorner()
46
+
47
+ # x is of intrinsic type float64
48
+ ret.x = packet.decodeDouble()
49
+
50
+ # y is of intrinsic type float64
51
+ ret.y = packet.decodeDouble()
52
+
53
+ return ret
54
+
55
+
56
+ # Hack ourselves into the base class
57
+ TargetCorner.photonStruct = TargetCornerSerde()
@@ -0,0 +1,9 @@
1
+ # no one but us chickens
2
+
3
+ from .MultiTargetPNPResultSerde import MultiTargetPNPResultSerde # noqa
4
+ from .PhotonPipelineMetadataSerde import PhotonPipelineMetadataSerde # noqa
5
+ from .PhotonPipelineMetadataSerde import PhotonPipelineMetadataSerde # noqa
6
+ from .PhotonPipelineResultSerde import PhotonPipelineResultSerde # noqa
7
+ from .PhotonTrackedTargetSerde import PhotonTrackedTargetSerde # noqa
8
+ from .PnpResultSerde import PnpResultSerde # noqa
9
+ from .TargetCornerSerde import TargetCornerSerde # noqa