Update the downloader for the orins

Signed-off-by: Maxwell Henderson <mxwhenderson@gmail.com>
Change-Id: Ie6e77e22ab6722e79fbfd74a578c6a9b025ac5b8
diff --git a/frc971/orin/BUILD b/frc971/orin/BUILD
index b5666f1..75e9dfc 100644
--- a/frc971/orin/BUILD
+++ b/frc971/orin/BUILD
@@ -112,6 +112,7 @@
         "argus_camera.cc",
     ],
     target_compatible_with = ["@platforms//cpu:arm64"],
+    visibility = ["//visibility:public"],
     deps = [
         "//aos:init",
         "//aos/events:shm_event_loop",
@@ -130,6 +131,7 @@
     name = "gpu_apriltag",
     srcs = ["gpu_apriltag.cc"],
     features = ["cuda"],
+    visibility = ["//visibility:public"],
     deps = [
         ":apriltag",
         "//aos:init",
diff --git a/y2024/BUILD b/y2024/BUILD
index 7e28c19..8e91107 100644
--- a/y2024/BUILD
+++ b/y2024/BUILD
@@ -1,5 +1,6 @@
 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(
@@ -72,6 +73,8 @@
         "//y2024/vision:image_logger",
         "//aos/events/logging:logger_main",
         "//y2024/orin:can_logger",
+        "//frc971/orin:gpu_apriltag",
+        "//frc971/orin:argus_camera",
     ],
     target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
     target_type = "orin",
@@ -92,6 +95,8 @@
     visibility = ["//visibility:public"],
     deps = [
         ":config_imu",
+        ":config_orin1",
+        ":config_orin2",
         ":config_roborio",
     ],
 )
@@ -142,6 +147,46 @@
     ],
 )
 
+[
+    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",
+            "@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)
+]
+
 cc_library(
     name = "constants",
     srcs = [
diff --git a/y2024/y2024.json b/y2024/y2024.json
index c887499..c901ac6 100644
--- a/y2024/y2024.json
+++ b/y2024/y2024.json
@@ -13,6 +13,8 @@
   ],
   "imports": [
     "y2024_roborio.json",
-    "y2024_imu.json"
+    "y2024_imu.json",
+    "y2024_orin1.json",
+    "y2024_orin2.json"
   ]
 }
diff --git a/y2024/y2024_orin_template.json b/y2024/y2024_orin_template.json
new file mode 100644
index 0000000..93c0e27
--- /dev/null
+++ b/y2024/y2024_orin_template.json
@@ -0,0 +1,317 @@
+{
+  "channels": [
+    {
+      "name": "/orin{{ NUM }}/aos",
+      "type": "aos.timing.Report",
+      "source_node": "orin{{ NUM }}",
+      "frequency": 50,
+      "num_senders": 20,
+      "max_size": 4096
+    },
+    {
+      "name": "/orin{{ NUM }}/aos",
+      "type": "aos.logging.LogMessageFbs",
+      "source_node": "orin{{ NUM }}",
+      "frequency": 200,
+      "num_senders": 20
+    },
+    {
+      "name": "/orin{{ NUM }}/aos",
+      "type": "aos.starter.Status",
+      "source_node": "orin{{ NUM }}",
+      "frequency": 50,
+      "num_senders": 20,
+      "max_size": 2000
+    },
+    {
+      "name": "/orin{{ NUM }}/aos",
+      "type": "aos.starter.StarterRpc",
+      "source_node": "orin{{ NUM }}",
+      "frequency": 10,
+      "num_senders": 2
+    },
+    {
+      "name": "/orin{{ NUM }}/aos",
+      "type": "aos.message_bridge.ServerStatistics",
+      "source_node": "orin{{ NUM }}",
+      "max_size": 2048,
+      "frequency": 10,
+      "num_senders": 2
+    },
+    {
+      "name": "/orin{{ NUM }}/aos",
+      "type": "aos.message_bridge.ClientStatistics",
+      "source_node": "orin{{ NUM }}",
+      "frequency": 20,
+      "num_senders": 2
+    },
+    {
+      "name": "/orin{{ NUM }}/aos",
+      "type": "aos.logging.DynamicLogCommand",
+      "source_node": "orin{{ NUM }}",
+      "frequency": 10,
+      "num_senders": 2
+    },
+    {
+      "name": "/orin{{ NUM }}/aos",
+      "type": "aos.message_bridge.Timestamp",
+      "source_node": "orin{{ NUM }}",
+      "frequency": 15,
+      "num_senders": 2,
+      "logger": "LOCAL_AND_REMOTE_LOGGER",
+      "logger_nodes": [
+        "imu"
+      ],
+      "max_size": 200,
+      "destination_nodes": [
+        {
+          "name": "imu",
+          "priority": 1,
+          "time_to_live": 5000000,
+          "timestamp_logger": "LOCAL_AND_REMOTE_LOGGER",
+          "timestamp_logger_nodes": [
+            "orin{{ NUM }}"
+          ]
+        }
+      ]
+    },
+    {
+      "name": "/orin{{ NUM }}/aos/remote_timestamps/imu/orin{{ NUM }}/aos/aos-message_bridge-Timestamp",
+      "type": "aos.message_bridge.RemoteMessage",
+      "frequency": 20,
+      "source_node": "orin{{ NUM }}",
+      "max_size": 208
+    },
+    {
+      "name": "/imu/aos",
+      "type": "aos.message_bridge.Timestamp",
+      "source_node": "imu",
+      "logger": "LOCAL_AND_REMOTE_LOGGER",
+      "logger_nodes": [
+        "orin{{ NUM }}"
+      ],
+      "destination_nodes": [
+        {
+          "name": "orin{{ NUM }}",
+          "priority": 1,
+          "timestamp_logger": "LOCAL_AND_REMOTE_LOGGER",
+          "timestamp_logger_nodes": [
+            "imu"
+          ],
+          "time_to_live": 5000000
+        }
+      ]
+    },
+    {
+      "name": "/imu/aos/remote_timestamps/orin{{ NUM }}/imu/aos/aos-message_bridge-Timestamp",
+      "type": "aos.message_bridge.RemoteMessage",
+      "frequency": 20,
+      "source_node": "imu",
+      "max_size": 208
+    },
+    {
+      "name": "/orin{{ NUM }}/camera",
+      "type": "frc971.vision.CameraImage",
+      "source_node": "orin{{ NUM }}",
+      "frequency": 40,
+      "max_size": 1843456,
+      "num_readers": 6,
+      "read_method": "PIN",
+      "num_senders": 18
+    },
+    {
+      "name": "/orin{{ NUM }}/camera",
+      "type": "foxglove.CompressedImage",
+      "source_node": "orin{{ NUM }}",
+      "frequency": 40,
+      "max_size": 622384
+    },
+    {
+      "name": "/orin{{ NUM }}/camera",
+      "type": "foxglove.ImageAnnotations",
+      "source_node": "orin{{ NUM }}",
+      "frequency": 40,
+      "max_size": 50000
+    },
+    {
+      "name": "/orin{{ NUM }}/camera",
+      "type": "frc971.vision.TargetMap",
+      "source_node": "orin{{ NUM }}",
+      "frequency": 40,
+      "num_senders": 2,
+      "max_size": 1024,
+      "logger": "LOCAL_AND_REMOTE_LOGGER",
+      "logger_nodes": [
+        "imu"
+      ],
+      "destination_nodes": [
+        {
+          "name": "imu",
+          "priority": 4,
+          "timestamp_logger": "LOCAL_AND_REMOTE_LOGGER",
+          "timestamp_logger_nodes": [
+            "orin{{ NUM }}"
+          ],
+          "time_to_live": 5000000
+        }
+      ]
+    },
+    {
+      "name": "/orin{{ NUM }}/aos/remote_timestamps/imu/orin{{ NUM }}/camera/frc971-vision-TargetMap",
+      "type": "aos.message_bridge.RemoteMessage",
+      "frequency": 80,
+      "source_node": "orin{{ NUM }}",
+      "max_size": 208
+    },
+    {
+      "name": "/orin{{ NUM }}/constants",
+      "type": "y2024.Constants",
+      "source_node": "orin{{ NUM }}",
+      "frequency": 1,
+      "num_senders": 2,
+      "max_size": 65536
+    }
+  ],
+  "applications": [
+    {
+      "name": "message_bridge_client",
+      "executable_name": "message_bridge_client",
+      "args": [
+        "--rt_priority=16",
+        "--sinit_max_init_timeout=5000"
+      ],
+      "user": "orin",
+      "nodes": [
+        "orin{{ NUM }}"
+      ]
+    },
+    {
+      "name": "irq_affinity",
+      "executable_name": "irq_affinity",
+      "user": "root",
+      "args": ["--user=orin"],
+      "nodes": [
+          "orin{{ NUM }}"
+      ]
+    },
+    {
+      "name": "message_bridge_server",
+      "executable_name": "message_bridge_server",
+      "user": "orin",
+      "nodes": [
+        "orin{{ NUM }}"
+      ]
+    },
+    {
+      "name": "web_proxy",
+      "executable_name": "web_proxy_main",
+      "user": "orin",
+      "args": [
+        "--min_ice_port=5800",
+        "--max_ice_port=5810"
+      ],
+      "nodes": [
+        "orin{{ NUM }}"
+      ]
+    },
+    {
+      "name": "image_logger",
+      "executable_name": "image_logger",
+      "args": [
+        "--logging_folder",
+        "",
+        "--rotate_every",
+        "30.0",
+        "--direct",
+        "--flush_size=4194304"
+      ],
+      "user": "orin",
+      "nodes": [
+        "orin{{ NUM }}"
+      ]
+    },
+    {
+      "name": "foxglove_websocket",
+      "user": "orin",
+      "nodes": [
+        "orin{{ NUM }}"
+      ]
+    },
+    {
+      "name": "foxglove_image_converter",
+      "user": "orin",
+      "nodes": [
+        "orin{{ NUM }}"
+      ]
+    },
+    {
+      "name": "constants_sender",
+      "autorestart": false,
+      "user": "orin",
+      "nodes": [
+        "orin{{ NUM }}"
+      ]
+    },
+    {
+      "name": "argus_camera",
+      "executable_name": "argus_camera",
+      "user": "orin",
+      "nodes": [
+        "orin{{ NUM }}"
+      ]
+    },
+    {
+      "name": "gpu_apriltag",
+      "executable_name": "gpu_apriltag",
+      "user": "orin",
+      "nodes": [
+        "orin{{ NUM }}"
+      ]
+    }
+  ],
+  "maps": [
+    {
+      "match": {
+        "name": "/aos*",
+        "source_node": "orin{{ NUM }}"
+      },
+      "rename": {
+        "name": "/orin{{ NUM }}/aos"
+      }
+    },
+    {
+      "match": {
+        "name": "/constants*",
+        "source_node": "orin{{ NUM }}"
+      },
+      "rename": {
+        "name": "/orin{{ NUM }}/constants"
+      }
+    },
+    {
+      "match": {
+        "name": "/camera*",
+        "source_node": "orin{{ NUM }}"
+      },
+      "rename": {
+        "name": "/orin{{ NUM }}/camera"
+      }
+    }
+  ],
+  "nodes": [
+    {
+      "name": "orin{{ NUM }}",
+      "hostname": "orin{{ NUM }}",
+      "hostnames": [
+        "orin-971-{{ NUM }}",
+        "orin-7971-{{ NUM }}",
+        "orin-8971-{{ NUM }}",
+        "orin-9971-{{ NUM }}"
+      ],
+      "port": 9971
+    },
+    {
+      "name": "imu"
+    }
+  ]
+}