Skip to content

[python] Fix population of metadata#1578

Merged
mcm001 merged 1 commit intoPhotonVision:masterfrom
thedropbears:python-fix-metadata-return
Nov 17, 2024
Merged

[python] Fix population of metadata#1578
mcm001 merged 1 commit intoPhotonVision:masterfrom
thedropbears:python-fix-metadata-return

Conversation

@james-ward
Copy link
Copy Markdown
Contributor

No description provided.

@james-ward james-ward requested a review from a team as a code owner November 16, 2024 23:50
@james-ward james-ward marked this pull request as draft November 16, 2024 23:50
@james-ward james-ward force-pushed the python-fix-metadata-return branch from c902042 to 6facbbf Compare November 16, 2024 23:51
@james-ward james-ward marked this pull request as ready for review November 17, 2024 00:33
@mcm001 mcm001 merged commit f107c94 into PhotonVision:master Nov 17, 2024
@mythgarr
Copy link
Copy Markdown
Contributor

mythgarr commented Jan 9, 2025

@james-ward Metadata construction args still don't align with the structure. The layout of PhotonPipelineMetadata:

@dataclass
class PhotonPipelineMetadata:
    captureTimestampMicros: int = -1
    publishTimestampMicros: int = -1
    sequenceID: int = -1
    timeSinceLastPong: int = -1
    photonStruct: ClassVar["PhotonPipelineMetadataSerde"]

..compared to the constructor call (variable names added for clarity):

        return PhotonPipelineResult(
            metadata=PhotonPipelineMetadata(
                captureTimestampMicros: self.heartbeatCounter,
                publishTimestampMicros: int(now_micros - latency * 1e6),
                sequenceID: int(now_micros),
                timeSinceLastPong: int(np.random.uniform(950, 1050)),
            ),
            targets=detectableTgts,
            multitagResult=multiTagResults,
        )

If I reorder self.heartbeatCounter locally to be the third arg rather than the first everything works as expected

mcm001 pushed a commit that referenced this pull request Jan 12, 2025
mcm001 pushed a commit to mcm001/photonvision that referenced this pull request Feb 18, 2025
@Gold856 Gold856 added the photonlib Things related to the PhotonVision library label Jul 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

photonlib Things related to the PhotonVision library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants