Add y2024 folder

2023 bot specific code was removed.

Signed-off-by: Nathan Leong <100028864@mvla.net>
Change-Id: I88fc4a4b5e6bc883ea327cc306efa4e20035908b
diff --git a/y2024/constants/7971.json b/y2024/constants/7971.json
new file mode 100644
index 0000000..94fc375
--- /dev/null
+++ b/y2024/constants/7971.json
@@ -0,0 +1,5 @@
+{
+  "cameras": [
+  ],
+  {% include 'y2024/constants/common.json' %}
+}
diff --git a/y2024/constants/971.json b/y2024/constants/971.json
new file mode 100644
index 0000000..2e6ffa8
--- /dev/null
+++ b/y2024/constants/971.json
@@ -0,0 +1,8 @@
+{
+  "cameras": [
+  ],
+  "robot": {
+    }
+  },
+  {% include 'y2024/constants/common.json' %}
+}
diff --git a/y2024/constants/9971.json b/y2024/constants/9971.json
new file mode 100644
index 0000000..2e6ffa8
--- /dev/null
+++ b/y2024/constants/9971.json
@@ -0,0 +1,8 @@
+{
+  "cameras": [
+  ],
+  "robot": {
+    }
+  },
+  {% include 'y2024/constants/common.json' %}
+}
diff --git a/y2024/constants/BUILD b/y2024/constants/BUILD
new file mode 100644
index 0000000..1e8faa4
--- /dev/null
+++ b/y2024/constants/BUILD
@@ -0,0 +1,78 @@
+load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
+load("//tools/build_rules:template.bzl", "jinja2_template")
+
+cc_library(
+    name = "simulated_constants_sender",
+    srcs = ["simulated_constants_sender.cc"],
+    hdrs = ["simulated_constants_sender.h"],
+    data = [":test_constants.json"],
+    visibility = ["//y2024:__subpackages__"],
+    deps = [
+        ":constants_fbs",
+        ":constants_list_fbs",
+        "//aos/events:simulated_event_loop",
+        "//aos/testing:path",
+        "//frc971/constants:constants_sender_lib",
+    ],
+)
+
+jinja2_template(
+    name = "test_constants.json",
+    src = "test_constants.jinja2.json",
+    includes = glob(["test_data/*.json"]),
+    parameters = {},
+    visibility = ["//visibility:public"],
+)
+
+jinja2_template(
+    name = "constants.json",
+    src = "constants.jinja2.json",
+    includes = [
+        "7971.json",
+        "971.json",
+        "9971.json",
+        "common.json",
+        ":target_map",
+        "//y2024/vision/maps",
+    ],
+    parameters = {},
+    visibility = ["//visibility:public"],
+)
+
+filegroup(
+    name = "target_map",
+    srcs = [
+        "target_map.json",
+    ],
+    visibility = ["//y2024:__subpackages__"],
+)
+
+static_flatbuffer(
+    name = "constants_fbs",
+    srcs = ["constants.fbs"],
+    visibility = ["//visibility:public"],
+    deps = [
+        "//frc971/vision:target_map_fbs",
+    ],
+)
+
+static_flatbuffer(
+    name = "constants_list_fbs",
+    srcs = ["constants_list.fbs"],
+    visibility = ["//visibility:public"],
+    deps = [":constants_fbs"],
+)
+
+cc_binary(
+    name = "constants_sender",
+    srcs = ["constants_sender.cc"],
+    visibility = ["//visibility:public"],
+    deps = [
+        ":constants_fbs",
+        ":constants_list_fbs",
+        "//aos:init",
+        "//aos/events:shm_event_loop",
+        "//aos/testing:path",
+        "//frc971/constants:constants_sender_lib",
+    ],
+)
diff --git a/y2024/constants/common.json b/y2024/constants/common.json
new file mode 100644
index 0000000..15894ad
--- /dev/null
+++ b/y2024/constants/common.json
@@ -0,0 +1,5 @@
+  "target_map": {% include 'y2024/constants/target_map.json' %},
+  "ignore_targets": {
+    "red": [4],
+    "blue": [5]
+  }
diff --git a/y2024/constants/constants.fbs b/y2024/constants/constants.fbs
new file mode 100644
index 0000000..ad34617
--- /dev/null
+++ b/y2024/constants/constants.fbs
@@ -0,0 +1,15 @@
+include "frc971/vision/target_map.fbs";
+
+namespace y2024;
+
+
+table RobotConstants {
+
+}
+
+table Constants {
+  target_map:frc971.vision.TargetMap (id: 0);
+  robot:RobotConstants (id: 1);
+}
+
+root_type Constants;
diff --git a/y2024/constants/constants.jinja2.json b/y2024/constants/constants.jinja2.json
new file mode 100644
index 0000000..c27e588
--- /dev/null
+++ b/y2024/constants/constants.jinja2.json
@@ -0,0 +1,16 @@
+{
+  "constants": [
+    {
+      "team": 7971,
+      "data": {% include 'y2024/constants/7971.json' %}
+    },
+    {
+      "team": 971,
+      "data": {% include 'y2024/constants/971.json' %}
+    },
+    {
+      "team": 9971,
+      "data": {% include 'y2024/constants/9971.json' %}
+    }
+  ]
+}
diff --git a/y2024/constants/constants_list.fbs b/y2024/constants/constants_list.fbs
new file mode 100644
index 0000000..dbebc19
--- /dev/null
+++ b/y2024/constants/constants_list.fbs
@@ -0,0 +1,14 @@
+include "y2024/constants/constants.fbs";
+
+namespace y2024;
+
+table TeamAndConstants {
+  team:long (id: 0);
+  data:Constants (id: 1);
+}
+
+table ConstantsList {
+  constants:[TeamAndConstants] (id: 0);
+}
+
+root_type ConstantsList;
diff --git a/y2024/constants/constants_sender.cc b/y2024/constants/constants_sender.cc
new file mode 100644
index 0000000..bc442a2
--- /dev/null
+++ b/y2024/constants/constants_sender.cc
@@ -0,0 +1,24 @@
+#include "gflags/gflags.h"
+#include "glog/logging.h"
+
+#include "aos/configuration.h"
+#include "aos/events/shm_event_loop.h"
+#include "aos/init.h"
+#include "aos/json_to_flatbuffer.h"
+#include "frc971/constants/constants_sender_lib.h"
+#include "y2024/constants/constants_generated.h"
+#include "y2024/constants/constants_list_generated.h"
+
+DEFINE_string(config, "aos_config.json", "Path to the AOS config.");
+DEFINE_string(constants_path, "constants.json", "Path to the constant file");
+
+int main(int argc, char **argv) {
+  aos::InitGoogle(&argc, &argv);
+  aos::FlatbufferDetachedBuffer<aos::Configuration> config =
+      aos::configuration::ReadConfig(FLAGS_config);
+  aos::ShmEventLoop event_loop(&config.message());
+  frc971::constants::ConstantSender<y2024::Constants, y2024::ConstantsList>
+      constants_sender(&event_loop, FLAGS_constants_path);
+  // Don't need to call Run().
+  return 0;
+}
diff --git a/y2024/constants/simulated_constants_sender.cc b/y2024/constants/simulated_constants_sender.cc
new file mode 100644
index 0000000..28189f8
--- /dev/null
+++ b/y2024/constants/simulated_constants_sender.cc
@@ -0,0 +1,18 @@
+#include "aos/events/simulated_event_loop.h"
+#include "aos/testing/path.h"
+#include "frc971/constants/constants_sender_lib.h"
+#include "y2024/constants/constants_generated.h"
+#include "y2024/constants/constants_list_generated.h"
+
+namespace y2024 {
+bool SendSimulationConstants(aos::SimulatedEventLoopFactory *factory, int team,
+                             std::string constants_path) {
+  for (const aos::Node *node : factory->nodes()) {
+    std::unique_ptr<aos::EventLoop> event_loop =
+        factory->MakeEventLoop("constants_sender", node);
+    frc971::constants::ConstantSender<Constants, ConstantsList> sender(
+        event_loop.get(), constants_path, team, "/constants");
+  }
+  return true;
+}
+}  // namespace y2024
diff --git a/y2024/constants/simulated_constants_sender.h b/y2024/constants/simulated_constants_sender.h
new file mode 100644
index 0000000..5ecc4da
--- /dev/null
+++ b/y2024/constants/simulated_constants_sender.h
@@ -0,0 +1,16 @@
+#ifndef Y2024_CONSTANTS_SIMULATED_CONFIG_SENDER_H_
+#define Y2024_CONSTANTS_SIMULATED_CONFIG_SENDER_H_
+
+#include "aos/events/simulated_event_loop.h"
+#include "aos/testing/path.h"
+
+namespace y2024 {
+// Returns true, to allow this to be easily called in the initializer list of a
+// constructor.
+bool SendSimulationConstants(
+    aos::SimulatedEventLoopFactory *factory, int team,
+    std::string constants_path =
+        aos::testing::ArtifactPath("y2024/constants/test_constants.json"));
+}  // namespace y2024
+
+#endif  // Y2024_CONSTANTS_SIMULATED_CONFIG_SENDER_H_
diff --git a/y2024/constants/target_map.json b/y2024/constants/target_map.json
new file mode 100644
index 0000000..544b7b4
--- /dev/null
+++ b/y2024/constants/target_map.json
@@ -0,0 +1,3 @@
+{
+    
+}
\ No newline at end of file
diff --git a/y2024/constants/test_constants.jinja2.json b/y2024/constants/test_constants.jinja2.json
new file mode 100644
index 0000000..c6b77dd
--- /dev/null
+++ b/y2024/constants/test_constants.jinja2.json
@@ -0,0 +1,8 @@
+{
+  "constants": [
+    {
+      "team": 7971,
+      "data": {}
+    }
+  ]
+}