Adding the remaining intrinsic calibration files for cameras 7-12

Also, created a script that's very useful for changing where we attach the
cameras (which orin, which port, etc).

Change-Id: Ib6e67206ccb04c48008cb0ff7bf2b5f9f5ce4f1c
Signed-off-by: Jim Ostrowski <yimmy13@gmail.com>
diff --git a/y2024/constants/7971.json b/y2024/constants/7971.json
index ec59033..3888e9a 100644
--- a/y2024/constants/7971.json
+++ b/y2024/constants/7971.json
@@ -8,7 +8,16 @@
 {
   "cameras": [
     {
-      "calibration": {% include 'y2024/constants/calib_files/calibration_orin-971-1_cam-24-00.json' %}
+      "calibration": {% include 'y2024/constants/calib_files/calibration_orin-7971-1-0_cam-24-01_2024-02-07_20-11-35.566609408.json' %}
+    },
+    {
+      "calibration": {% include 'y2024/constants/calib_files/calibration_orin-7971-1-1_cam-24-02_2024-02-07_20-11-32.368359264.json' %}
+    },
+    {
+      "calibration": {% include 'y2024/constants/calib_files/calibration_orin-7971-2-0_cam-24-03_2024-02-07_20-40-34.928600992.json' %}
+    },
+    {
+      "calibration": {% include 'y2024/constants/calib_files/calibration_orin-7971-2-1_cam-24-04_2024-02-07_20-45-22.787382400.json' %}
     }
   ],
   "robot": {
diff --git a/y2024/constants/971.json b/y2024/constants/971.json
index 441c9c5..e79ebaf 100644
--- a/y2024/constants/971.json
+++ b/y2024/constants/971.json
@@ -8,13 +8,16 @@
 {
   "cameras": [
     {
-      "calibration": {% include 'y2024/constants/calib_files/calibration_orin-971-1_cam-24-00.json' %}
-    },
-    {
       "calibration": {% include 'y2024/constants/calib_files/calibration_orin-971-1-1_cam-24-05_1970-01-05_17-40-27.793683328.json' %}
     },
     {
       "calibration": {% include 'y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-06_1970-01-05_17-40-29.245444672.json' %}
+    },
+    {
+      "calibration": {% include 'y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-07_2024-02-24_19-52-27.338466592.json' %}
+    },
+    {
+      "calibration": {% include 'y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-08_2024-02-24_16-21-54.420797344.json' %}
     }
   ],
   "robot": {
diff --git a/y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-01_2024-02-07_20-11-35.566609408.json b/y2024/constants/calib_files/calibration_orin-7971-1-0_cam-24-01_2024-02-07_20-11-35.566609408.json
similarity index 93%
rename from y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-01_2024-02-07_20-11-35.566609408.json
rename to y2024/constants/calib_files/calibration_orin-7971-1-0_cam-24-01_2024-02-07_20-11-35.566609408.json
index 63f4ea8..b0bdadd 100755
--- a/y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-01_2024-02-07_20-11-35.566609408.json
+++ b/y2024/constants/calib_files/calibration_orin-7971-1-0_cam-24-01_2024-02-07_20-11-35.566609408.json
@@ -1,6 +1,6 @@
 {
  "node_name": "orin1",
- "team_number": 971,
+ "team_number": 7971,
  "intrinsics": [
   646.870789,
   0.0,
diff --git a/y2024/constants/calib_files/calibration_orin-971-1-1_cam-24-02_2024-02-07_20-11-32.368359264.json b/y2024/constants/calib_files/calibration_orin-7971-1-1_cam-24-02_2024-02-07_20-11-32.368359264.json
similarity index 93%
rename from y2024/constants/calib_files/calibration_orin-971-1-1_cam-24-02_2024-02-07_20-11-32.368359264.json
rename to y2024/constants/calib_files/calibration_orin-7971-1-1_cam-24-02_2024-02-07_20-11-32.368359264.json
index 482158c..d5d2d61 100755
--- a/y2024/constants/calib_files/calibration_orin-971-1-1_cam-24-02_2024-02-07_20-11-32.368359264.json
+++ b/y2024/constants/calib_files/calibration_orin-7971-1-1_cam-24-02_2024-02-07_20-11-32.368359264.json
@@ -1,6 +1,6 @@
 {
  "node_name": "orin1",
- "team_number": 971,
+ "team_number": 7971,
  "intrinsics": [
   644.604858,
   0.0,
diff --git a/y2024/constants/calib_files/calibration_orin-971-1-1_cam-24-03_2024-02-07_20-40-34.928600992.json b/y2024/constants/calib_files/calibration_orin-7971-2-0_cam-24-03_2024-02-07_20-40-34.928600992.json
similarity index 80%
rename from y2024/constants/calib_files/calibration_orin-971-1-1_cam-24-03_2024-02-07_20-40-34.928600992.json
rename to y2024/constants/calib_files/calibration_orin-7971-2-0_cam-24-03_2024-02-07_20-40-34.928600992.json
index febd9ef..32d5db6 100755
--- a/y2024/constants/calib_files/calibration_orin-971-1-1_cam-24-03_2024-02-07_20-40-34.928600992.json
+++ b/y2024/constants/calib_files/calibration_orin-7971-2-0_cam-24-03_2024-02-07_20-40-34.928600992.json
@@ -1,6 +1,6 @@
 {
- "node_name": "orin1",
- "team_number": 971,
+ "node_name": "orin2",
+ "team_number": 7971,
  "intrinsics": [
   648.13446,
   0.0,
@@ -21,5 +21,5 @@
  ],
  "calibration_timestamp": 1707367234928600992,
  "camera_id": "24-03",
- "camera_number": 1
+ "camera_number": 0
 }
\ No newline at end of file
diff --git a/y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-04_2024-02-07_20-45-22.787382400.json b/y2024/constants/calib_files/calibration_orin-7971-2-1_cam-24-04_2024-02-07_20-45-22.787382400.json
similarity index 80%
rename from y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-04_2024-02-07_20-45-22.787382400.json
rename to y2024/constants/calib_files/calibration_orin-7971-2-1_cam-24-04_2024-02-07_20-45-22.787382400.json
index a3ea964..4f76b07 100755
--- a/y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-04_2024-02-07_20-45-22.787382400.json
+++ b/y2024/constants/calib_files/calibration_orin-7971-2-1_cam-24-04_2024-02-07_20-45-22.787382400.json
@@ -1,6 +1,6 @@
 {
- "node_name": "orin1",
- "team_number": 971,
+ "node_name": "orin2",
+ "team_number": 7971,
  "intrinsics": [
   642.80365,
   0.0,
@@ -21,5 +21,5 @@
  ],
  "calibration_timestamp": 1707367522787382400,
  "camera_id": "24-04",
- "camera_number": 0
+ "camera_number": 1
 }
\ No newline at end of file
diff --git a/y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-07_2024-02-24_19-52-27.338466592.json b/y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-07_2024-02-24_19-52-27.338466592.json
new file mode 100755
index 0000000..b691f56
--- /dev/null
+++ b/y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-07_2024-02-24_19-52-27.338466592.json
@@ -0,0 +1,26 @@
+{
+ "node_name": "orin1",
+ "team_number": 971,
+ "intrinsics": [
+  647.822815,
+  0.0,
+  715.37616,
+  0.0,
+  647.799316,
+  494.638641,
+  0.0,
+  0.0,
+  1.0
+ ],
+ "dist_coeffs": [
+  -0.2423,
+  0.057169,
+  0.000302,
+  0.000016,
+  -0.005638
+ ],
+ "calibration_timestamp": 1708833147338466592,
+ "camera_id": "24-07",
+ "camera_number": 0,
+ "reprojection_error": 1.362672
+}
\ No newline at end of file
diff --git a/y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-08_2024-02-24_16-21-54.420797344.json b/y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-08_2024-02-24_16-21-54.420797344.json
new file mode 100755
index 0000000..b5a848b
--- /dev/null
+++ b/y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-08_2024-02-24_16-21-54.420797344.json
@@ -0,0 +1,26 @@
+{
+ "node_name": "orin1",
+ "team_number": 971,
+ "intrinsics": [
+  645.963562,
+  0.0,
+  751.21698,
+  0.0,
+  645.34906,
+  605.204102,
+  0.0,
+  0.0,
+  1.0
+ ],
+ "dist_coeffs": [
+  -0.248733,
+  0.06221,
+  -0.000901,
+  0.000128,
+  -0.006595
+ ],
+ "calibration_timestamp": 1708820514420797344,
+ "camera_id": "24-08",
+ "camera_number": 0,
+ "reprojection_error": 1.591953
+}
diff --git a/y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-10_2024-02-24_16-44-05.975708672.json b/y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-10_2024-02-24_16-44-05.975708672.json
new file mode 100755
index 0000000..0912038
--- /dev/null
+++ b/y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-10_2024-02-24_16-44-05.975708672.json
@@ -0,0 +1,26 @@
+{
+ "node_name": "orin1",
+ "team_number": 971,
+ "intrinsics": [
+  646.04834,
+  0.0,
+  703.327576,
+  0.0,
+  645.444458,
+  527.86261,
+  0.0,
+  0.0,
+  1.0
+ ],
+ "dist_coeffs": [
+  -0.251594,
+  0.064935,
+  0.000479,
+  0.000036,
+  -0.007207
+ ],
+ "calibration_timestamp": 1708821845975708672,
+ "camera_id": "24-10",
+ "camera_number": 0,
+ "reprojection_error": 1.523209
+}
diff --git a/y2024/constants/calib_files/calibration_orin-971-1-1_cam-24-09_2024-02-24_16-10-16.872521280.json b/y2024/constants/calib_files/calibration_orin-971-1-1_cam-24-09_2024-02-24_16-10-16.872521280.json
new file mode 100755
index 0000000..9eed9bf
--- /dev/null
+++ b/y2024/constants/calib_files/calibration_orin-971-1-1_cam-24-09_2024-02-24_16-10-16.872521280.json
@@ -0,0 +1,26 @@
+{
+ "node_name": "orin1",
+ "team_number": 971,
+ "intrinsics": [
+  648.187805,
+  0.0,
+  736.903137,
+  0.0,
+  648.028687,
+  557.169861,
+  0.0,
+  0.0,
+  1.0
+ ],
+ "dist_coeffs": [
+  -0.265564,
+  0.078084,
+  -0.000231,
+  0.000386,
+  -0.010425
+ ],
+ "calibration_timestamp": 1708819816872521280,
+ "camera_id": "24-09",
+ "camera_number": 1,
+ "reprojection_error": 1.881098
+}
\ No newline at end of file
diff --git a/y2024/constants/calib_files/calibration_orin-971-1-1_cam-24-11_2024-02-24_16-44-06.986729504.json b/y2024/constants/calib_files/calibration_orin-971-1-1_cam-24-11_2024-02-24_16-44-06.986729504.json
new file mode 100755
index 0000000..4957b75
--- /dev/null
+++ b/y2024/constants/calib_files/calibration_orin-971-1-1_cam-24-11_2024-02-24_16-44-06.986729504.json
@@ -0,0 +1,26 @@
+{
+ "node_name": "orin1",
+ "team_number": 971,
+ "intrinsics": [
+  649.866699,
+  0.0,
+  709.355713,
+  0.0,
+  648.893066,
+  576.101868,
+  0.0,
+  0.0,
+  1.0
+ ],
+ "dist_coeffs": [
+  -0.248092,
+  0.060938,
+  0.000313,
+  0.00009,
+  -0.006163
+ ],
+ "calibration_timestamp": 1708821846986729504,
+ "camera_id": "24-11",
+ "camera_number": 1,
+ "reprojection_error": 1.450069
+}
\ No newline at end of file
diff --git a/y2024/constants/calib_files/calibration_orin-971-1-1_cam-24-12_2024-02-24_19-52-39.488095264.json b/y2024/constants/calib_files/calibration_orin-971-1-1_cam-24-12_2024-02-24_19-52-39.488095264.json
new file mode 100755
index 0000000..0fda16d
--- /dev/null
+++ b/y2024/constants/calib_files/calibration_orin-971-1-1_cam-24-12_2024-02-24_19-52-39.488095264.json
@@ -0,0 +1,26 @@
+{
+ "node_name": "orin1",
+ "team_number": 971,
+ "intrinsics": [
+  647.19928,
+  0.0,
+  690.698181,
+  0.0,
+  646.449158,
+  530.162842,
+  0.0,
+  0.0,
+  1.0
+ ],
+ "dist_coeffs": [
+  -0.249799,
+  0.062593,
+  0.00003,
+  0.000366,
+  -0.006532
+ ],
+ "calibration_timestamp": 1708833159488095264,
+ "camera_id": "24-12",
+ "camera_number": 1,
+ "reprojection_error": 1.23409
+}
\ No newline at end of file
diff --git a/y2024/vision/rename_calibration_file.sh b/y2024/vision/rename_calibration_file.sh
new file mode 100755
index 0000000..dcdf2f2
--- /dev/null
+++ b/y2024/vision/rename_calibration_file.sh
@@ -0,0 +1,86 @@
+#!/bin/bash
+
+# Helper script to rename the camera calibration file when moving to new robot
+
+# grep isn't happy with set
+# set -e
+
+
+usage_and_exit () {
+    echo
+    echo "Usage:"
+    echo "$0 ORIG_FILENAME NEW_TEAM_NUMBER NEW_ORIN_NUMBER NEW_CAMERA_NUMBER"
+    echo
+    exit 2
+}
+
+if [[ $# -ne 4 ]]; then
+    echo "ERROR: Requires 4 parameters"
+    usage_and_exit
+fi
+
+ORIG_FILENAME=$1
+NEW_TEAM_NUMBER=$2
+NEW_ORIN_NUMBER=$3
+NEW_CAMERA_NUMBER=$4
+
+if [[ ! -x ${ORIG_FILENAME} ]]; then
+    echo "${ORIG_FILENAME} does not exist"
+    usage_and_exit
+fi
+
+check_971=`echo "${NEW_TEAM_NUMBER}" | grep "971"`
+if [[ ${check_971} == "" ]]; then
+    echo "NEW_TEAM_NUMBER (${NEW_TEAM_NUMBER}) does not contain '971'"
+    usage_and_exit
+fi
+
+if [[ ${NEW_ORIN_NUMBER} != 1 && ${NEW_ORIN_NUMBER} != 2 ]]; then
+    echo "NEW_ORIN_NUMBER (${NEW_ORIN_NUMBER}) must be either 1 or 2"
+    usage_and_exit
+fi
+
+if [[ ${NEW_CAMERA_NUMBER} != 0 && ${NEW_CAMERA_NUMBER} != 1 ]]; then
+    echo "NEW_CAMERA_NUMBER (${NEW_CAMERA_NUMBER}) must be either 0 or 1"
+    usage_and_exit
+fi
+
+# Extract parts of the filename, based on just the basename
+# This assumes filenames of the form:
+# calibration_orin-971-1-0_cam-24-01_2024-02-07_20-11-35.566609408.json
+IFS='_' read -r -a name_parts <<< `basename "${ORIG_FILENAME}"`
+
+echo "For ${ORIG_FILENAME}:"
+for element in "${name_parts[@]}"
+do
+    echo "$element"
+done
+
+# Rename file based on this new info (be sure to handle paths properly)
+NEW_FILENAME=`dirname ${ORIG_FILENAME}`"/${name_parts[0]}_orin-${NEW_TEAM_NUMBER}-${NEW_ORIN_NUMBER}-${NEW_CAMERA_NUMBER}_${name_parts[2]}_${name_parts[3]}_${name_parts[4]}"
+
+echo
+echo "For camera id: ${name_parts[2]}"
+echo "Renaming from:"
+echo "${ORIG_FILENAME} to: "
+echo "${NEW_FILENAME}"
+echo
+echo "and changing from "
+echo "${name_parts[1]} to: "
+echo "orin-${NEW_TEAM_NUMBER}-${NEW_ORIN_NUMBER}-${NEW_CAMERA_NUMBER}"
+echo 
+
+mv ${ORIG_FILENAME} ${NEW_FILENAME}
+
+
+echo "REPLACING ORIN_NUMBER"
+sed -i s/orin./orin${NEW_ORIN_NUMBER}/ ${NEW_FILENAME}
+
+echo "Replacing TEAM NUMBER"
+sed -i s/\"team_number\"\:\ [1-9]*\,/\"team_number\"\:\ ${NEW_TEAM_NUMBER},/ ${NEW_FILENAME}
+
+echo "REPLACING CAMERA_NUMBER"
+sed -i s/\"camera_number\"\:\ [0-9]/\"camera_number\"\:\ ${NEW_CAMERA_NUMBER}/ ${NEW_FILENAME}
+
+
+