Skip to content

Commit

Permalink
Pass in NetworkTables instance from camera to simulated camera
Browse files Browse the repository at this point in the history
  • Loading branch information
james-ward committed Nov 24, 2024
1 parent f455a54 commit 75b1d94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions photon-lib/py/photonlibpy/networktables/NTTopicSet.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ class NTTopicSet:
different for sim vs. real camera
"""

def __init__(self, tableName: str, cameraName: str) -> None:
instance = nt.NetworkTableInstance.getDefault()
photonvision_root_table = instance.getTable(tableName)
self.subTable = photonvision_root_table.getSubTable(cameraName)
def __init__(
self,
ntSubTable: nt.NetworkTable,
) -> None:
self.subTable = ntSubTable

def updateEntries(self) -> None:
options = nt.PubSubOptions()
Expand Down
2 changes: 1 addition & 1 deletion photon-lib/py/photonlibpy/simulation/photonCameraSim.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def __init__(
(self.prop.getResWidth(), self.prop.getResHeight())
)

self.ts = NTTopicSet("photonvision", self.cam.getName())
self.ts = NTTopicSet(self.cam._cameraTable)
self.ts.updateEntries()

# Handle this last explicitly for this function signature because the other constructor is called in the initialiser list
Expand Down

0 comments on commit 75b1d94

Please sign in to comment.