James Kuszmaul | d67f6d2 | 2023-02-05 17:37:25 -0800 | [diff] [blame^] | 1 | #include "y2023/vision/vision_util.h" |
| 2 | |
| 3 | #include "glog/logging.h" |
| 4 | |
| 5 | namespace y2023::vision { |
| 6 | const frc971::vision::calibration::CameraCalibration *FindCameraCalibration( |
| 7 | const y2023::Constants &calibration_data, std::string_view node_name) { |
| 8 | CHECK(calibration_data.has_cameras()); |
| 9 | for (const y2023::CameraConfiguration *candidate : |
| 10 | *calibration_data.cameras()) { |
| 11 | CHECK(candidate->has_calibration()); |
| 12 | if (candidate->calibration()->node_name()->string_view() != node_name) { |
| 13 | continue; |
| 14 | } |
| 15 | return candidate->calibration(); |
| 16 | } |
| 17 | LOG(FATAL) << ": Failed to find camera calibration for " << node_name; |
| 18 | } |
| 19 | } // namespace y2023::vision |