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