Switch to a 2 orin configuration

This moves y2024_orin_template into y2024_orin1 and adds channels and
binaries needed to do tag detection on the y2024_imu config.

Signed-off-by: Maxwell Henderson <mxwhenderson@gmail.com>
Change-Id: I24eddc2ce9198307bf2016d9233f12bc0a4aade7
diff --git a/y2024/BUILD b/y2024/BUILD
index bba7b51..9e27ab2 100644
--- a/y2024/BUILD
+++ b/y2024/BUILD
@@ -1,6 +1,5 @@
 load("//frc971:downloader.bzl", "robot_downloader")
 load("//aos:config.bzl", "aos_config")
-load("//tools/build_rules:template.bzl", "jinja2_template")
 load("//aos/util:config_validator_macro.bzl", "config_validator_test")
 
 config_validator_test(
@@ -106,7 +105,6 @@
     deps = [
         ":config_imu",
         ":config_orin1",
-        ":config_orin2",
         ":config_roborio",
     ],
 )
@@ -127,6 +125,10 @@
         "//y2024/localizer:visualization_fbs",
         "//aos/network:timestamp_fbs",
         "//aos/network:remote_message_fbs",
+        "//frc971/vision:calibration_fbs",
+        "//frc971/vision:target_map_fbs",
+        "//frc971/vision:vision_fbs",
+        "@com_github_foxglove_schemas//:schemas",
     ],
     target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
@@ -166,46 +168,30 @@
     ],
 )
 
-[
-    aos_config(
-        name = "config_" + orin,
-        src = "y2024_" + orin + ".json",
-        flatbuffers = [
-            "//aos/network:message_bridge_client_fbs",
-            "//aos/network:message_bridge_server_fbs",
-            "//aos/network:timestamp_fbs",
-            "//aos/network:remote_message_fbs",
-            "//y2024/constants:constants_fbs",
-            "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
-            "//frc971/vision:calibration_fbs",
-            "//frc971/vision:target_map_fbs",
-            "//frc971/vision:vision_fbs",
-            "//y2024/localizer:visualization_fbs",
-            "@com_github_foxglove_schemas//:schemas",
-        ],
-        target_compatible_with = ["@platforms//os:linux"],
-        visibility = ["//visibility:public"],
-        deps = [
-            "//aos/events:aos_config",
-            "//frc971/control_loops/drivetrain:aos_config",
-            "//frc971/input:aos_config",
-        ],
-    )
-    for orin in [
-        "orin1",
-        "orin2",
-    ]
-]
-
-[
-    jinja2_template(
-        name = "y2024_orin" + str(num) + ".json",
-        src = "y2024_orin_template.json",
-        parameters = {"NUM": str(num)},
-        target_compatible_with = ["@platforms//os:linux"],
-    )
-    for num in range(1, 3)
-]
+aos_config(
+    name = "config_orin1",
+    src = "y2024_orin1.json",
+    flatbuffers = [
+        "//aos/network:message_bridge_client_fbs",
+        "//aos/network:message_bridge_server_fbs",
+        "//aos/network:timestamp_fbs",
+        "//aos/network:remote_message_fbs",
+        "//y2024/constants:constants_fbs",
+        "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
+        "//frc971/vision:calibration_fbs",
+        "//y2024/localizer:visualization_fbs",
+        "//frc971/vision:target_map_fbs",
+        "//frc971/vision:vision_fbs",
+        "@com_github_foxglove_schemas//:schemas",
+    ],
+    target_compatible_with = ["@platforms//os:linux"],
+    visibility = ["//visibility:public"],
+    deps = [
+        "//aos/events:aos_config",
+        "//frc971/control_loops/drivetrain:aos_config",
+        "//frc971/input:aos_config",
+    ],
+)
 
 cc_library(
     name = "constants",
diff --git a/y2024/y2024.json b/y2024/y2024.json
index c901ac6..b55aebe 100644
--- a/y2024/y2024.json
+++ b/y2024/y2024.json
@@ -15,6 +15,5 @@
     "y2024_roborio.json",
     "y2024_imu.json",
     "y2024_orin1.json",
-    "y2024_orin2.json"
   ]
 }
diff --git a/y2024/y2024_imu.json b/y2024/y2024_imu.json
index 647009b..9ee0922 100644
--- a/y2024/y2024_imu.json
+++ b/y2024/y2024_imu.json
@@ -8,7 +8,6 @@
       "logger": "LOCAL_AND_REMOTE_LOGGER",
       "logger_nodes": [
         "orin1",
-        "orin2"
       ],
       "destination_nodes": [
         {
@@ -20,15 +19,6 @@
             "imu"
           ]
         },
-        {
-          "name": "orin2",
-          "priority": 5,
-          "time_to_live": 50000000,
-          "timestamp_logger": "LOCAL_AND_REMOTE_LOGGER",
-          "timestamp_logger_nodes": [
-            "imu"
-          ]
-        },
       ]
     },
     {
@@ -41,15 +31,6 @@
       "max_size": 200
     },
     {
-      "name": "/imu/aos/remote_timestamps/orin2/imu/aos/aos-JoystickState",
-      "type": "aos.message_bridge.RemoteMessage",
-      "source_node": "imu",
-      "logger": "NOT_LOGGED",
-      "frequency": 300,
-      "num_senders": 2,
-      "max_size": 200
-    },
-    {
       "name": "/imu/aos",
       "type": "aos.timing.Report",
       "source_node": "imu",
@@ -70,7 +51,7 @@
       "source_node": "imu",
       "frequency": 50,
       "num_senders": 20,
-      "max_size": 2048
+      "max_size": 4096
     },
     {
       "name": "/imu/aos",
@@ -190,6 +171,90 @@
       "max_size": 200
     },
     {
+      "name": "/orin2/camera0",
+      "type": "frc971.vision.CameraImage",
+      "source_node": "imu",
+      "channel_storage_duration": 1000000000,
+      "frequency": 65,
+      "max_size": 4752384,
+      "num_readers": 6,
+      "read_method": "PIN",
+      "num_senders": 18
+    },
+    {
+      "name": "/orin2/camera1",
+      "type": "frc971.vision.CameraImage",
+      "source_node": "imu",
+      "channel_storage_duration": 1000000000,
+      "frequency": 65,
+      "max_size": 4752384,
+      "num_readers": 6,
+      "read_method": "PIN",
+      "num_senders": 18
+    },
+    {
+      "name": "/orin2/camera0",
+      "type": "foxglove.CompressedImage",
+      "source_node": "imu",
+      "logger": "NOT_LOGGED",
+      "channel_storage_duration": 1000000000,
+      "frequency": 65,
+      "max_size": 622384
+    },
+    {
+      "name": "/orin2/camera1",
+      "type": "foxglove.CompressedImage",
+      "source_node": "imu",
+      "logger": "NOT_LOGGED",
+      "channel_storage_duration": 1000000000,
+      "frequency": 65,
+      "max_size": 622384
+    },
+    {
+      "name": "/orin2/camera0",
+      "type": "foxglove.ImageAnnotations",
+      "source_node": "imu",
+      "frequency": 65,
+      "max_size": 50000
+    },
+    {
+      "name": "/orin2/camera1",
+      "type": "foxglove.ImageAnnotations",
+      "source_node": "imu",
+      "frequency": 65,
+      "max_size": 50000
+    },
+    {
+      "name": "/orin2/camera0",
+      "type": "y2024.localizer.Visualization",
+      "source_node": "imu",
+      "frequency": 65,
+      "max_size": 50000
+    },
+    {
+      "name": "/orin2/camera1",
+      "type": "y2024.localizer.Visualization",
+      "source_node": "imu",
+      "frequency": 65,
+      "max_size": 50000
+    },
+    {
+      "name": "/orin2/camera0",
+      "type": "frc971.vision.TargetMap",
+      "source_node": "imu",
+      "frequency": 65,
+      "num_senders": 2,
+      "max_size": 1024
+    },
+    {
+      "name": "/orin2/camera1",
+      "type": "frc971.vision.TargetMap",
+      "source_node": "imu",
+      "frequency": 65,
+      "num_senders": 2,
+      "max_size": 1024
+    },
+    {
       "name": "/imu",
       "type": "frc971.imu.DualImu",
       "source_node": "imu",
@@ -359,6 +424,105 @@
       "nodes": [
         "imu"
       ]
+    },
+    {
+      "name": "image_logger",
+      "executable_name": "image_logger",
+      "args": [
+        "--rotate_every",
+        "30.0",
+        "--direct",
+        "--flush_size=4194304"
+      ],
+      "user": "pi",
+      "nodes": [
+        "imu"
+      ]
+    },
+    {
+      "name": "foxglove_websocket",
+      "user": "pi",
+      "nodes": [
+        "imu"
+      ]
+    },
+    {
+      "name": "foxglove_image_converter0",
+      "executable_name": "foxglove_image_converter",
+      "user": "pi",
+      "args": [
+          "--channel", "/camera0"
+      ],
+      "nodes": [
+        "imu"
+      ]
+    },
+    {
+      "name": "foxglove_image_converter1",
+      "executable_name": "foxglove_image_converter",
+      "user": "pi",
+      "args": [
+          "--channel", "/camera1"
+      ],
+      "nodes": [
+        "imu"
+      ]
+    },
+    {
+      "name": "constants_sender",
+      "autorestart": false,
+      "user": "pi",
+      "nodes": [
+        "imu"
+      ]
+    },
+    {
+      "name": "argus_camera0",
+      "executable_name": "argus_camera",
+      "args": [
+          "--enable_ftrace",
+          "--camera=0",
+          "--channel=/camera0",
+      ],
+      "user": "pi",
+      "nodes": [
+        "imu"
+      ]
+    },
+    {
+      "name": "argus_camera1",
+      "executable_name": "argus_camera",
+      "args": [
+          "--enable_ftrace",
+          "--camera=1",
+          "--channel=/camera1",
+      ],
+      "user": "pi",
+      "nodes": [
+        "imu"
+      ]
+    },
+    {
+      "name": "apriltag_detector0",
+      "executable_name": "apriltag_detector",
+      "args": [
+          "--channel=/camera0",
+      ],
+      "user": "pi",
+      "nodes": [
+        "imu"
+      ]
+    },
+    {
+      "name": "apriltag_detector1",
+      "executable_name": "apriltag_detector",
+      "args": [
+          "--channel=/camera1",
+      ],
+      "user": "pi",
+      "nodes": [
+        "imu"
+      ]
     }
   ],
   "maps": [
@@ -379,17 +543,26 @@
       "rename": {
         "name": "/imu/aos"
       }
+    },
+    {
+      "match": {
+        "name": "/camera*",
+        "source_node": "imu"
+      },
+      "rename": {
+        "name": "/orin2/camera"
+      }
     }
   ],
   "nodes": [
     {
       "name": "imu",
-      "hostname": "orin3",
+      "hostname": "orin2",
       "hostnames": [
-        "orin-971-3",
-        "orin-7971-3",
-        "orin-8971-3",
-        "orin-9971-3"
+        "orin-971-2",
+        "orin-7971-2",
+        "orin-8971-2",
+        "orin-9971-2"
       ],
       "port": 9971
     },
@@ -399,8 +572,5 @@
     {
       "name": "orin1"
     },
-    {
-      "name": "orin2"
-    },
   ]
 }
diff --git a/y2024/y2024_orin_template.json b/y2024/y2024_orin1.json
similarity index 72%
rename from y2024/y2024_orin_template.json
rename to y2024/y2024_orin1.json
index ac7a49f..a9f75d5 100644
--- a/y2024/y2024_orin_template.json
+++ b/y2024/y2024_orin1.json
@@ -1,61 +1,61 @@
 {
   "channels": [
     {
-      "name": "/orin{{ NUM }}/aos",
+      "name": "/orin1/aos",
       "type": "aos.timing.Report",
-      "source_node": "orin{{ NUM }}",
+      "source_node": "orin1",
       "frequency": 50,
       "num_senders": 20,
       "max_size": 8192
     },
     {
-      "name": "/orin{{ NUM }}/aos",
+      "name": "/orin1/aos",
       "type": "aos.logging.LogMessageFbs",
-      "source_node": "orin{{ NUM }}",
+      "source_node": "orin1",
       "frequency": 200,
       "num_senders": 20
     },
     {
-      "name": "/orin{{ NUM }}/aos",
+      "name": "/orin1/aos",
       "type": "aos.starter.Status",
-      "source_node": "orin{{ NUM }}",
+      "source_node": "orin1",
       "frequency": 50,
       "num_senders": 20,
       "max_size": 2000
     },
     {
-      "name": "/orin{{ NUM }}/aos",
+      "name": "/orin1/aos",
       "type": "aos.starter.StarterRpc",
-      "source_node": "orin{{ NUM }}",
+      "source_node": "orin1",
       "frequency": 10,
       "num_senders": 2
     },
     {
-      "name": "/orin{{ NUM }}/aos",
+      "name": "/orin1/aos",
       "type": "aos.message_bridge.ServerStatistics",
-      "source_node": "orin{{ NUM }}",
+      "source_node": "orin1",
       "max_size": 2048,
       "frequency": 10,
       "num_senders": 2
     },
     {
-      "name": "/orin{{ NUM }}/aos",
+      "name": "/orin1/aos",
       "type": "aos.message_bridge.ClientStatistics",
-      "source_node": "orin{{ NUM }}",
+      "source_node": "orin1",
       "frequency": 20,
       "num_senders": 2
     },
     {
-      "name": "/orin{{ NUM }}/aos",
+      "name": "/orin1/aos",
       "type": "aos.logging.DynamicLogCommand",
-      "source_node": "orin{{ NUM }}",
+      "source_node": "orin1",
       "frequency": 10,
       "num_senders": 2
     },
     {
-      "name": "/orin{{ NUM }}/aos",
+      "name": "/orin1/aos",
       "type": "aos.message_bridge.Timestamp",
-      "source_node": "orin{{ NUM }}",
+      "source_node": "orin1",
       "frequency": 15,
       "num_senders": 2,
       "logger": "LOCAL_AND_REMOTE_LOGGER",
@@ -70,16 +70,16 @@
           "time_to_live": 5000000,
           "timestamp_logger": "LOCAL_AND_REMOTE_LOGGER",
           "timestamp_logger_nodes": [
-            "orin{{ NUM }}"
+            "orin1"
           ]
         }
       ]
     },
     {
-      "name": "/orin{{ NUM }}/aos/remote_timestamps/imu/orin{{ NUM }}/aos/aos-message_bridge-Timestamp",
+      "name": "/orin1/aos/remote_timestamps/imu/orin1/aos/aos-message_bridge-Timestamp",
       "type": "aos.message_bridge.RemoteMessage",
       "frequency": 20,
-      "source_node": "orin{{ NUM }}",
+      "source_node": "orin1",
       "max_size": 208
     },
     {
@@ -88,11 +88,11 @@
       "source_node": "imu",
       "logger": "LOCAL_AND_REMOTE_LOGGER",
       "logger_nodes": [
-        "orin{{ NUM }}"
+        "orin1"
       ],
       "destination_nodes": [
         {
-          "name": "orin{{ NUM }}",
+          "name": "orin1",
           "priority": 1,
           "timestamp_logger": "LOCAL_AND_REMOTE_LOGGER",
           "timestamp_logger_nodes": [
@@ -103,16 +103,16 @@
       ]
     },
     {
-      "name": "/imu/aos/remote_timestamps/orin{{ NUM }}/imu/aos/aos-message_bridge-Timestamp",
+      "name": "/imu/aos/remote_timestamps/orin1/imu/aos/aos-message_bridge-Timestamp",
       "type": "aos.message_bridge.RemoteMessage",
       "frequency": 20,
       "source_node": "imu",
       "max_size": 208
     },
     {
-      "name": "/orin{{ NUM }}/camera0",
+      "name": "/orin1/camera0",
       "type": "frc971.vision.CameraImage",
-      "source_node": "orin{{ NUM }}",
+      "source_node": "orin1",
       "channel_storage_duration": 1000000000,
       "frequency": 65,
       "max_size": 4752384,
@@ -121,9 +121,9 @@
       "num_senders": 18
     },
     {
-      "name": "/orin{{ NUM }}/camera1",
+      "name": "/orin1/camera1",
       "type": "frc971.vision.CameraImage",
-      "source_node": "orin{{ NUM }}",
+      "source_node": "orin1",
       "channel_storage_duration": 1000000000,
       "frequency": 65,
       "max_size": 4752384,
@@ -132,53 +132,53 @@
       "num_senders": 18
     },
     {
-      "name": "/orin{{ NUM }}/camera0",
+      "name": "/orin1/camera0",
       "type": "foxglove.CompressedImage",
-      "source_node": "orin{{ NUM }}",
+      "source_node": "orin1",
       "channel_storage_duration": 1000000000,
       "frequency": 65,
       "max_size": 622384
     },
     {
-      "name": "/orin{{ NUM }}/camera1",
+      "name": "/orin1/camera1",
       "type": "foxglove.CompressedImage",
-      "source_node": "orin{{ NUM }}",
+      "source_node": "orin1",
       "channel_storage_duration": 1000000000,
       "frequency": 65,
       "max_size": 622384
     },
     {
-      "name": "/orin{{ NUM }}/camera0",
+      "name": "/orin1/camera0",
       "type": "foxglove.ImageAnnotations",
-      "source_node": "orin{{ NUM }}",
+      "source_node": "orin1",
       "frequency": 65,
       "max_size": 50000
     },
     {
-      "name": "/orin{{ NUM }}/camera1",
+      "name": "/orin1/camera1",
       "type": "foxglove.ImageAnnotations",
-      "source_node": "orin{{ NUM }}",
+      "source_node": "orin1",
       "frequency": 65,
       "max_size": 50000
     },
     {
-      "name": "/orin{{ NUM }}/camera0",
+      "name": "/orin1/camera0",
       "type": "y2024.localizer.Visualization",
       "source_node": "imu",
       "frequency": 65,
       "max_size": 50000
     },
     {
-      "name": "/orin{{ NUM }}/camera1",
+      "name": "/orin1/camera1",
       "type": "y2024.localizer.Visualization",
       "source_node": "imu",
       "frequency": 65,
       "max_size": 50000
     },
     {
-      "name": "/orin{{ NUM }}/camera0",
+      "name": "/orin1/camera0",
       "type": "frc971.vision.TargetMap",
-      "source_node": "orin{{ NUM }}",
+      "source_node": "orin1",
       "frequency": 65,
       "num_senders": 2,
       "max_size": 1024,
@@ -192,16 +192,16 @@
           "priority": 4,
           "timestamp_logger": "LOCAL_AND_REMOTE_LOGGER",
           "timestamp_logger_nodes": [
-            "orin{{ NUM }}"
+            "orin1"
           ],
           "time_to_live": 5000000
         }
       ]
     },
     {
-      "name": "/orin{{ NUM }}/camera1",
+      "name": "/orin1/camera1",
       "type": "frc971.vision.TargetMap",
-      "source_node": "orin{{ NUM }}",
+      "source_node": "orin1",
       "frequency": 65,
       "num_senders": 2,
       "max_size": 1024,
@@ -215,30 +215,30 @@
           "priority": 4,
           "timestamp_logger": "LOCAL_AND_REMOTE_LOGGER",
           "timestamp_logger_nodes": [
-            "orin{{ NUM }}"
+            "orin1"
           ],
           "time_to_live": 5000000
         }
       ]
     },
     {
-      "name": "/orin{{ NUM }}/aos/remote_timestamps/imu/orin{{ NUM }}/camera0/frc971-vision-TargetMap",
+      "name": "/orin1/aos/remote_timestamps/imu/orin1/camera0/frc971-vision-TargetMap",
       "type": "aos.message_bridge.RemoteMessage",
       "frequency": 80,
-      "source_node": "orin{{ NUM }}",
+      "source_node": "orin1",
       "max_size": 208
     },
     {
-      "name": "/orin{{ NUM }}/aos/remote_timestamps/imu/orin{{ NUM }}/camera1/frc971-vision-TargetMap",
+      "name": "/orin1/aos/remote_timestamps/imu/orin1/camera1/frc971-vision-TargetMap",
       "type": "aos.message_bridge.RemoteMessage",
       "frequency": 80,
-      "source_node": "orin{{ NUM }}",
+      "source_node": "orin1",
       "max_size": 208
     },
     {
-      "name": "/orin{{ NUM }}/constants",
+      "name": "/orin1/constants",
       "type": "y2024.Constants",
-      "source_node": "orin{{ NUM }}",
+      "source_node": "orin1",
       "frequency": 1,
       "num_senders": 2,
       "max_size": 65536
@@ -254,7 +254,7 @@
       ],
       "user": "pi",
       "nodes": [
-        "orin{{ NUM }}"
+        "orin1"
       ]
     },
     {
@@ -263,7 +263,7 @@
       "user": "root",
       "args": ["--user=pi"],
       "nodes": [
-          "orin{{ NUM }}"
+          "orin1"
       ]
     },
     {
@@ -274,7 +274,7 @@
        ],
       "user": "pi",
       "nodes": [
-        "orin{{ NUM }}"
+        "orin1"
       ]
     },
     {
@@ -286,7 +286,7 @@
         "--max_ice_port=5810"
       ],
       "nodes": [
-        "orin{{ NUM }}"
+        "orin1"
       ]
     },
     {
@@ -300,14 +300,14 @@
       ],
       "user": "pi",
       "nodes": [
-        "orin{{ NUM }}"
+        "orin1"
       ]
     },
     {
       "name": "foxglove_websocket",
       "user": "pi",
       "nodes": [
-        "orin{{ NUM }}"
+        "orin1"
       ]
     },
     {
@@ -318,7 +318,7 @@
           "--channel", "/camera0"
       ],
       "nodes": [
-        "orin{{ NUM }}"
+        "orin1"
       ]
     },
     {
@@ -329,7 +329,7 @@
           "--channel", "/camera1"
       ],
       "nodes": [
-        "orin{{ NUM }}"
+        "orin1"
       ]
     },
     {
@@ -337,7 +337,7 @@
       "autorestart": false,
       "user": "pi",
       "nodes": [
-        "orin{{ NUM }}"
+        "orin1"
       ]
     },
     {
@@ -350,7 +350,7 @@
       ],
       "user": "pi",
       "nodes": [
-        "orin{{ NUM }}"
+        "orin1"
       ]
     },
     {
@@ -363,7 +363,7 @@
       ],
       "user": "pi",
       "nodes": [
-        "orin{{ NUM }}"
+        "orin1"
       ]
     },
     {
@@ -374,7 +374,7 @@
       ],
       "user": "pi",
       "nodes": [
-        "orin{{ NUM }}"
+        "orin1"
       ]
     },
     {
@@ -385,7 +385,7 @@
       ],
       "user": "pi",
       "nodes": [
-        "orin{{ NUM }}"
+        "orin1"
       ]
     }
   ],
@@ -393,40 +393,40 @@
     {
       "match": {
         "name": "/aos*",
-        "source_node": "orin{{ NUM }}"
+        "source_node": "orin1"
       },
       "rename": {
-        "name": "/orin{{ NUM }}/aos"
+        "name": "/orin1/aos"
       }
     },
     {
       "match": {
         "name": "/constants*",
-        "source_node": "orin{{ NUM }}"
+        "source_node": "orin1"
       },
       "rename": {
-        "name": "/orin{{ NUM }}/constants"
+        "name": "/orin1/constants"
       }
     },
     {
       "match": {
         "name": "/camera*",
-        "source_node": "orin{{ NUM }}"
+        "source_node": "orin1"
       },
       "rename": {
-        "name": "/orin{{ NUM }}/camera"
+        "name": "/orin1/camera"
       }
     }
   ],
   "nodes": [
     {
-      "name": "orin{{ NUM }}",
-      "hostname": "orin{{ NUM }}",
+      "name": "orin1",
+      "hostname": "orin1",
       "hostnames": [
-        "orin-971-{{ NUM }}",
-        "orin-7971-{{ NUM }}",
-        "orin-8971-{{ NUM }}",
-        "orin-9971-{{ NUM }}"
+        "orin-971-1",
+        "orin-7971-1",
+        "orin-8971-1",
+        "orin-9971-1"
       ],
       "port": 9971
     },