blob: b07851e2147fa14963106551f8916e0fe9f91b00 [file] [log] [blame]
Niko Sohmers3860f8a2024-01-12 21:05:19 -08001load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
2load("//tools/build_rules:template.bzl", "jinja2_template")
Maxwell Henderson3d6d5bf2024-02-24 12:49:51 -08003load("//y2024/constants:validator.bzl", "constants_json")
Niko Sohmers3860f8a2024-01-12 21:05:19 -08004
5cc_library(
6 name = "simulated_constants_sender",
7 srcs = ["simulated_constants_sender.cc"],
8 hdrs = ["simulated_constants_sender.h"],
9 data = [":test_constants.json"],
10 visibility = ["//y2024:__subpackages__"],
11 deps = [
12 ":constants_fbs",
13 ":constants_list_fbs",
14 "//aos/events:simulated_event_loop",
15 "//aos/testing:path",
16 "//frc971/constants:constants_sender_lib",
17 ],
18)
19
20jinja2_template(
Maxwell Henderson3d6d5bf2024-02-24 12:49:51 -080021 name = "test_constants_unvalidated.json",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080022 src = "test_constants.jinja2.json",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -080023 includes = glob([
24 "test_data/*.json",
25 ]) + [
Niko Sohmersb21dbdc2024-01-20 20:06:59 -080026 "//y2024/control_loops/superstructure/intake_pivot:intake_pivot_json",
Filip Kujawa37aa0bc2024-01-31 20:59:49 -080027 "//y2024/control_loops/superstructure/climber:climber_json",
Niko Sohmers3bfe3d62024-02-18 16:09:49 -080028 "//y2024/control_loops/superstructure/catapult:catapult_json",
29 "//y2024/control_loops/superstructure/altitude:altitude_json",
Austin Schuh3db875a2024-02-18 20:02:40 -080030 "//y2024/control_loops/superstructure/extend:extend_json",
Niko Sohmers3bfe3d62024-02-18 16:09:49 -080031 "//y2024/control_loops/superstructure/turret:turret_json",
James Kuszmaul2549e752024-01-20 17:42:51 -080032 "//y2024/control_loops/drivetrain:drivetrain_config.json",
Niko Sohmers3bfe3d62024-02-18 16:09:49 -080033 "//y2024/constants/calib_files",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -080034 "common.json",
Maxwell Hendersonde14bbb2024-01-29 13:59:28 -080035 "common.jinja2",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -080036 "//y2024/vision/maps",
37 ],
Niko Sohmers3860f8a2024-01-12 21:05:19 -080038 parameters = {},
39 visibility = ["//visibility:public"],
40)
41
42jinja2_template(
Maxwell Henderson3d6d5bf2024-02-24 12:49:51 -080043 name = "constants_unvalidated.json",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080044 src = "constants.jinja2.json",
45 includes = [
46 "7971.json",
47 "971.json",
48 "9971.json",
Maxwell Hendersonde14bbb2024-01-29 13:59:28 -080049 "common.jinja2",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080050 "common.json",
Jim Ostrowskicb8b4082024-01-21 02:23:46 -080051 "//y2024/constants/calib_files",
James Kuszmaul2549e752024-01-20 17:42:51 -080052 "//y2024/control_loops/drivetrain:drivetrain_config.json",
Niko Sohmers3bfe3d62024-02-18 16:09:49 -080053 "//y2024/control_loops/superstructure/altitude:altitude_json",
54 "//y2024/control_loops/superstructure/catapult:catapult_json",
Filip Kujawa37aa0bc2024-01-31 20:59:49 -080055 "//y2024/control_loops/superstructure/climber:climber_json",
Austin Schuh3db875a2024-02-18 20:02:40 -080056 "//y2024/control_loops/superstructure/extend:extend_json",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -080057 "//y2024/control_loops/superstructure/intake_pivot:intake_pivot_json",
Niko Sohmers3bfe3d62024-02-18 16:09:49 -080058 "//y2024/control_loops/superstructure/turret:turret_json",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080059 "//y2024/vision/maps",
60 ],
61 parameters = {},
62 visibility = ["//visibility:public"],
63)
64
Niko Sohmers3860f8a2024-01-12 21:05:19 -080065static_flatbuffer(
66 name = "constants_fbs",
67 srcs = ["constants.fbs"],
68 visibility = ["//visibility:public"],
69 deps = [
Niko Sohmersb21dbdc2024-01-20 20:06:59 -080070 "//frc971/control_loops:profiled_subsystem_fbs",
James Kuszmaul2549e752024-01-20 17:42:51 -080071 "//frc971/control_loops/drivetrain:drivetrain_config_fbs",
Jim Ostrowskicb8b4082024-01-21 02:23:46 -080072 "//frc971/vision:calibration_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080073 "//frc971/vision:target_map_fbs",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -080074 "//frc971/zeroing:constants_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080075 ],
76)
77
78static_flatbuffer(
79 name = "constants_list_fbs",
80 srcs = ["constants_list.fbs"],
81 visibility = ["//visibility:public"],
82 deps = [":constants_fbs"],
83)
84
85cc_binary(
86 name = "constants_sender",
87 srcs = ["constants_sender.cc"],
88 visibility = ["//visibility:public"],
89 deps = [
90 ":constants_fbs",
91 ":constants_list_fbs",
92 "//aos:init",
93 "//aos/events:shm_event_loop",
94 "//aos/testing:path",
95 "//frc971/constants:constants_sender_lib",
96 ],
97)
Maxwell Henderson6a929ff2024-01-14 20:03:59 -080098
Maxwell Henderson3d6d5bf2024-02-24 12:49:51 -080099cc_binary(
100 name = "constants_formatter",
101 srcs = ["constants_formatter.cc"],
102 data = [":constants_unvalidated.json"],
Maxwell Henderson6a929ff2024-01-14 20:03:59 -0800103 visibility = ["//visibility:public"],
104 deps = [
105 ":constants_list_fbs",
Maxwell Henderson3d6d5bf2024-02-24 12:49:51 -0800106 "//aos:init",
Maxwell Henderson6a929ff2024-01-14 20:03:59 -0800107 "//aos:json_to_flatbuffer",
Maxwell Henderson6a929ff2024-01-14 20:03:59 -0800108 "@com_github_google_glog//:glog",
109 ],
110)
Maxwell Henderson3d6d5bf2024-02-24 12:49:51 -0800111
112constants_json(
113 name = "constants_json",
114 src = ":constants_unvalidated.json",
115 out = "constants.json",
116)
117
118constants_json(
119 name = "test_constants_json",
James Kuszmaul313e9ce2024-02-11 17:47:33 -0800120 src = ":test_constants_unvalidated.json",
Maxwell Henderson3d6d5bf2024-02-24 12:49:51 -0800121 out = "test_constants.json",
122)