mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[wpilibc] DriverStation: Remove ReportError and ReportWarning
Change use cases to directly call FRC_ReportError.
This commit is contained in:
@@ -625,8 +625,8 @@ cs::CvSink CameraServer::GetVideo(const cs::VideoSource& camera) {
|
||||
auto kind = it->second.GetKind();
|
||||
if (kind != cs::VideoSink::kCv) {
|
||||
auto csShared = GetCameraServerShared();
|
||||
csShared->SetCameraServerError("expected OpenCV sink, but got " +
|
||||
wpi::Twine(kind));
|
||||
csShared->SetCameraServerError("expected OpenCV sink, but got {}",
|
||||
kind);
|
||||
return cs::CvSink{};
|
||||
}
|
||||
return *static_cast<cs::CvSink*>(&it->second);
|
||||
@@ -648,7 +648,7 @@ cs::CvSink CameraServer::GetVideo(const wpi::Twine& name) {
|
||||
auto it = m_impl->m_sources.find(nameStr);
|
||||
if (it == m_impl->m_sources.end()) {
|
||||
auto csShared = GetCameraServerShared();
|
||||
csShared->SetCameraServerError("could not find camera " + nameStr);
|
||||
csShared->SetCameraServerError("could not find camera {}", nameStr);
|
||||
return cs::CvSink{};
|
||||
}
|
||||
source = it->second;
|
||||
@@ -711,7 +711,7 @@ cs::VideoSink CameraServer::GetServer(const wpi::Twine& name) {
|
||||
auto it = m_impl->m_sinks.find(nameStr);
|
||||
if (it == m_impl->m_sinks.end()) {
|
||||
auto csShared = GetCameraServerShared();
|
||||
csShared->SetCameraServerError("could not find server " + nameStr);
|
||||
csShared->SetCameraServerError("could not find server {}", nameStr);
|
||||
return cs::VideoSink{};
|
||||
}
|
||||
return it->second;
|
||||
|
||||
@@ -12,9 +12,12 @@ class DefaultCameraServerShared : public frc::CameraServerShared {
|
||||
void ReportUsbCamera(int id) override {}
|
||||
void ReportAxisCamera(int id) override {}
|
||||
void ReportVideoServer(int id) override {}
|
||||
void SetCameraServerError(const wpi::Twine& error) override {}
|
||||
void SetVisionRunnerError(const wpi::Twine& error) override {}
|
||||
void ReportDriverStationError(const wpi::Twine& error) override {}
|
||||
void SetCameraServerErrorV(fmt::string_view format,
|
||||
fmt::format_args args) override {}
|
||||
void SetVisionRunnerErrorV(fmt::string_view format,
|
||||
fmt::format_args args) override {}
|
||||
void ReportDriverStationErrorV(fmt::string_view format,
|
||||
fmt::format_args args) override {}
|
||||
std::pair<std::thread::id, bool> GetRobotMainThreadId() const override {
|
||||
return std::make_pair(std::thread::id(), false);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ void VisionRunnerBase::RunOnce() {
|
||||
auto frameTime = m_cvSink.GrabFrame(*m_image);
|
||||
if (frameTime == 0) {
|
||||
auto error = m_cvSink.GetError();
|
||||
csShared->ReportDriverStationError(error);
|
||||
csShared->ReportDriverStationError(error.c_str());
|
||||
} else {
|
||||
DoProcess(*m_image);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user