Add tof sensor calibration
Change-Id: I4bc2107bbf76f0c5f98ff749ada673c656e1c1ed
Signed-off-by: James Kuszmaul <jabukuszmaul@gmail.com>
diff --git a/y2023/constants/7971.json b/y2023/constants/7971.json
index 7cbb37e..a3bd130 100644
--- a/y2023/constants/7971.json
+++ b/y2023/constants/7971.json
@@ -13,6 +13,5 @@
"calibration": {% include 'y2023/vision/calib_files/calibration_pi-7971-4_cam-23-04_ext_2023-02-19.json' %}
}
],
- "target_map": {% include 'y2023/vision/maps/target_map.json' %},
- "scoring_map": {% include 'y2023/constants/scoring_map.json' %}
+ {% include 'y2023/constants/common.json' %}
}
diff --git a/y2023/constants/971.json b/y2023/constants/971.json
index 7e979c7..16681fb 100644
--- a/y2023/constants/971.json
+++ b/y2023/constants/971.json
@@ -13,6 +13,19 @@
"calibration": {% include 'y2023/vision/calib_files/calibration_pi-971-4_cam-23-08_ext_2023-02-22.json' %}
}
],
- "target_map": {% include 'y2023/vision/maps/target_map.json' %},
- "scoring_map": {% include 'y2023/constants/scoring_map.json' %}
+ "robot": {
+ "tof": {
+ "interpolation_table": [
+ {
+ "tof_reading": 0.05,
+ "lateral_position": 0.23
+ },
+ {
+ "tof_reading": 0.90,
+ "lateral_position": -0.23
+ }
+ ]
+ }
+ },
+ {% include 'y2023/constants/common.json' %}
}
diff --git a/y2023/constants/9971.json b/y2023/constants/9971.json
index 356b232..a4eaff4 100644
--- a/y2023/constants/9971.json
+++ b/y2023/constants/9971.json
@@ -13,6 +13,19 @@
"calibration": {% include 'y2023/vision/calib_files/calibration_pi-9971-4_cam-23-12_ext_2023-03-05.json' %}
}
],
- "target_map": {% include 'y2023/vision/maps/target_map.json' %},
- "scoring_map": {% include 'y2023/constants/scoring_map.json' %}
+ "robot": {
+ "tof": {
+ "interpolation_table": [
+ {
+ "tof_reading": 0.05,
+ "lateral_position": 0.23
+ },
+ {
+ "tof_reading": 0.90,
+ "lateral_position": -0.23
+ }
+ ]
+ }
+ },
+ {% include 'y2023/constants/common.json' %}
}
diff --git a/y2023/constants/BUILD b/y2023/constants/BUILD
index 95d04a8..c91aa56 100644
--- a/y2023/constants/BUILD
+++ b/y2023/constants/BUILD
@@ -31,6 +31,7 @@
"7971.json",
"971.json",
"9971.json",
+ "common.json",
":scoring_map",
"//y2023/vision/calib_files",
"//y2023/vision/maps",
diff --git a/y2023/constants/common.json b/y2023/constants/common.json
new file mode 100644
index 0000000..c559810
--- /dev/null
+++ b/y2023/constants/common.json
@@ -0,0 +1,2 @@
+ "target_map": {% include 'y2023/vision/maps/target_map.json' %},
+ "scoring_map": {% include 'y2023/constants/scoring_map.json' %}
diff --git a/y2023/constants/constants.fbs b/y2023/constants/constants.fbs
index e874275..bd038b8 100644
--- a/y2023/constants/constants.fbs
+++ b/y2023/constants/constants.fbs
@@ -8,10 +8,32 @@
calibration:frc971.vision.calibration.CameraCalibration (id: 0);
}
+// Data point for a single time of flight sensor reading. Used in a linear
+// interpolation table.
+table TimeOfFlightDatum {
+ // Time-of-flight sensor reading for the datum.
+ tof_reading:double (id: 0);
+ // Where the game piece is laterally in the robot frame. 0 = centered;
+ // positive = to the left of the robot.
+ // In meters.
+ lateral_position:double (id: 1);
+}
+
+table TimeOfFlight {
+ interpolation_table:[TimeOfFlightDatum] (id: 0);
+}
+
+table RobotConstants {
+ // Table of time-of-flight reading positions. Until we bother using one
+ // of our interpolation classes, should just contain two values.
+ tof:TimeOfFlight (id: 0);
+}
+
table Constants {
cameras:[CameraConfiguration] (id: 0);
target_map:frc971.vision.TargetMap (id: 1);
scoring_map:localizer.ScoringMap (id: 2);
+ robot:RobotConstants (id: 3);
}
root_type Constants;