Swap y2023 wrist over to the constants.json
There are a couple of awkward constants that show up in json_codegen.cc
as still being managed from the C++ end; there are also a couple of
codegen'd constants from the wrist python code that we use in
constants.h. However, this does move *all* of the per-robot
configuration into the constants JSON file and should allow us to remove
the superstructure's dependency on the constants.h (if the arm were also
converted over).
Change-Id: Id9fc1e80830af823d96e5f3c1e469495eba454a4
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/y2023/constants/BUILD b/y2023/constants/BUILD
index 512e400..bbcec56 100644
--- a/y2023/constants/BUILD
+++ b/y2023/constants/BUILD
@@ -1,4 +1,5 @@
load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
+load("@aspect_bazel_lib//lib:run_binary.bzl", "run_binary")
load("//tools/build_rules:template.bzl", "jinja2_template")
cc_library(
@@ -19,7 +20,12 @@
jinja2_template(
name = "test_constants.json",
src = "test_constants.jinja2.json",
- includes = glob(["test_data/*.json"]),
+ includes = glob([
+ "test_data/*.json",
+ ]) + [
+ ":wrist_common_zeroing.json",
+ "//y2023/control_loops/superstructure/wrist:wrist_json",
+ ],
parameters = {},
visibility = ["//visibility:public"],
)
@@ -33,6 +39,8 @@
"9971.json",
"common.json",
":scoring_map",
+ ":wrist_common_zeroing.json",
+ "//y2023/control_loops/superstructure/wrist:wrist_json",
"//y2023/vision/calib_files",
"//y2023/vision/maps",
],
@@ -54,8 +62,11 @@
srcs = ["constants.fbs"],
visibility = ["//visibility:public"],
deps = [
+ "//frc971/control_loops:profiled_subsystem_fbs",
+ "//frc971/control_loops:state_feedback_loop_fbs",
"//frc971/vision:calibration_fbs",
"//frc971/vision:target_map_fbs",
+ "//frc971/zeroing:constants_fbs",
"//y2023/localizer:scoring_map_fbs",
],
)
@@ -80,3 +91,19 @@
"//frc971/constants:constants_sender_lib",
],
)
+
+cc_binary(
+ name = "json_codegen",
+ srcs = ["json_codegen.cc"],
+ deps = [
+ "//aos/util:file",
+ "//y2023:constants",
+ ],
+)
+
+run_binary(
+ name = "wrist_json_codegen",
+ outs = ["wrist_common_zeroing.json"],
+ args = ["$(location :wrist_common_zeroing.json)"],
+ tool = ":json_codegen",
+)