mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
Expose camera name in PhotonCamera (#523)
Co-authored-by: Matt <matthew.morley.ca@gmail.com>
This commit is contained in:
@@ -80,6 +80,7 @@ public class PhotonCamera {
|
||||
}
|
||||
|
||||
private final String path;
|
||||
private final String name;
|
||||
|
||||
private static boolean VERSION_CHECK_ENABLED = true;
|
||||
private static long VERSION_CHECK_INTERVAL = 5;
|
||||
@@ -104,6 +105,7 @@ public class PhotonCamera {
|
||||
* @param cameraName The name of the camera, as seen in the UI.
|
||||
*/
|
||||
public PhotonCamera(NetworkTableInstance instance, String cameraName) {
|
||||
name = cameraName;
|
||||
var mainTable = instance.getTable("photonvision");
|
||||
this.rootTable = mainTable.getSubTable(cameraName);
|
||||
path = rootTable.getPath();
|
||||
@@ -252,6 +254,16 @@ public class PhotonCamera {
|
||||
return getLatestResult().hasTargets();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the camera. This will return the same value that was given to the
|
||||
* constructor as cameraName.
|
||||
*
|
||||
* @return The name of the camera.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the camera is connected and actively returning new data. Connection status is
|
||||
* debounced.
|
||||
|
||||
Reference in New Issue
Block a user