Allow file uploads of any size and better report active cameras in PhotonCamera error print (#1298)

Previously reported itself which was confusing. New print:

```
Error at org.photonvision.PhotonCamera.verifyVersion(PhotonCamera.java:378): Found the following PhotonVision cameras active on NetworkTables:
 ==> HD_Pro_Webcam_C920
 ==> Arducam_OV9281_USB_Camera
```
This commit is contained in:
Matt
2024-05-10 14:58:18 -04:00
committed by GitHub
parent 1708376df8
commit 713fad6f6b
6 changed files with 76 additions and 27 deletions

View File

@@ -91,9 +91,9 @@ PhotonCamera::PhotonCamera(nt::NetworkTableInstance instance,
rootTable->GetBooleanTopic("driverMode").Subscribe(false)),
driverModePublisher(
rootTable->GetBooleanTopic("driverModeRequest").Publish()),
m_topicNameSubscriber(instance, PHOTON_PREFIX, {.topicsOnly = true}),
topicNameSubscriber(instance, PHOTON_PREFIX, {.topicsOnly = true}),
path(rootTable->GetPath()),
m_cameraName(cameraName) {
cameraName(cameraName) {
HAL_Report(HALUsageReporting::kResourceType_PhotonCamera, InstanceCount);
InstanceCount++;
}
@@ -173,7 +173,7 @@ void PhotonCamera::SetLEDMode(LEDMode mode) {
}
const std::string_view PhotonCamera::GetCameraName() const {
return m_cameraName;
return cameraName;
}
std::optional<cv::Mat> PhotonCamera::GetDistCoeffs() {
@@ -232,4 +232,17 @@ void PhotonCamera::VerifyVersion() {
}
}
std::vector<std::string> PhotonCamera::tablesThatLookLikePhotonCameras() {
std::vector<std::string> cameraNames = mainTable->GetSubTables();
std::vector<std::string> ret;
std::copy_if(
cameraNames.begin(), cameraNames.end(), std::back_inserter(ret),
[this](auto& it) {
return mainTable->GetSubTable(it)->GetEntry("rawBytes").Exists();
});
return ret;
}
} // namespace photon