Unify source of camera geometry data
Due to parallel development, camera pose information ended up being
populated in two constants files. This makes //y2019/vision:constants
the source for all of the constants.
Also, because the camera 19 calibration was done as if it was a front
camera, I had to negate its x/y position and offset the angle by 180
degrees.
This commit also adds validation for //y2019/vision:constants.cc to
ensure that it is not accidentally changed in a way that the codegen
cannot account for.
Change-Id: I85654d973e15ae7bf76589be63c3d0eaf72c3a45
diff --git a/y2019/jevois/teensy.cc b/y2019/jevois/teensy.cc
index 982e04b..9ccc7d4 100644
--- a/y2019/jevois/teensy.cc
+++ b/y2019/jevois/teensy.cc
@@ -389,15 +389,6 @@
return r;
}
-std::array<int, 5> CameraSerialNumbers() {
- switch (ProcessorIdentifier()) {
- case 0xffff322e: // CODE bot
- return {{0, 0, 0, 16, 19}};
- default:
- return {{0, 0, 0, 0, 0}};
- }
-}
-
extern "C" {
void *__stack_chk_guard = (void *)0x67111971;
@@ -770,7 +761,8 @@
for (int i = 0; i < 5; ++i) {
const y2019::vision::CameraCalibration *const constants =
- y2019::vision::GetCamera(CameraSerialNumbers()[i]);
+ y2019::vision::GetCamera(y2019::vision::CameraSerialNumbers(
+ ProcessorIdentifier())[i]);
(void)constants;
calibration.calibration(0, 0) = constants->intrinsics.mount_angle;
calibration.calibration(0, 1) = constants->intrinsics.focal_length;
@@ -807,8 +799,9 @@
case 'c':
printf("This UART board is 0x%" PRIx32 "\n", ProcessorIdentifier());
for (int i = 0; i < 5; ++i) {
- printf("Camera slot %d's serial number is %d\n", i,
- CameraSerialNumbers()[i]);
+ printf(
+ "Camera slot %d's serial number is %d\n", i,
+ y2019::vision::CameraSerialNumbers(ProcessorIdentifier())[i]);
}
break;
case 'v':