blob: 8ef0717fa8172142465cc9947128538f0335a461 [file] [log] [blame]
Niko Sohmers3860f8a2024-01-12 21:05:19 -08001load("//tools/build_rules:js.bzl", "ts_project")
2load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
3load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
4
5package(default_visibility = ["//visibility:public"])
6
7static_flatbuffer(
8 name = "superstructure_goal_fbs",
9 srcs = [
10 "superstructure_goal.fbs",
11 ],
12 deps = [
13 "//frc971/control_loops:control_loops_fbs",
14 "//frc971/control_loops:profiled_subsystem_fbs",
15 ],
16)
17
18static_flatbuffer(
19 name = "superstructure_output_fbs",
20 srcs = [
21 "superstructure_output.fbs",
22 ],
23)
24
25static_flatbuffer(
26 name = "superstructure_status_fbs",
27 srcs = [
28 "superstructure_status.fbs",
29 ],
30 deps = [
31 "//frc971/control_loops:control_loops_fbs",
32 "//frc971/control_loops:profiled_subsystem_fbs",
33 ],
34)
35
36flatbuffer_ts_library(
37 name = "superstructure_status_ts_fbs",
38 srcs = [
39 "superstructure_status.fbs",
40 ],
41 deps = [
42 "//frc971/control_loops:control_loops_ts_fbs",
43 "//frc971/control_loops:profiled_subsystem_ts_fbs",
44 ],
45)
46
47static_flatbuffer(
48 name = "superstructure_position_fbs",
49 srcs = [
50 "superstructure_position.fbs",
51 ],
52 deps = [
53 "//frc971/control_loops:control_loops_fbs",
54 "//frc971/control_loops:profiled_subsystem_fbs",
55 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
56 ],
57)
58
Niko Sohmers58e64c82024-01-14 12:49:54 -080059static_flatbuffer(
60 name = "superstructure_can_position_fbs",
61 srcs = ["superstructure_can_position.fbs"],
62 deps = ["//frc971/control_loops:can_talonfx_fbs"],
63)
64
65flatbuffer_ts_library(
66 name = "superstructure_can_position_ts_fbs",
67 srcs = ["superstructure_can_position.fbs"],
68 target_compatible_with = ["@platforms//os:linux"],
69 deps = ["//frc971/control_loops:can_talonfx_ts_fbs"],
70)
71
Niko Sohmers3860f8a2024-01-12 21:05:19 -080072cc_library(
73 name = "superstructure_lib",
74 srcs = [
75 "superstructure.cc",
76 ],
77 hdrs = [
78 "superstructure.h",
79 ],
80 data = [
81 ],
82 deps = [
83 ":superstructure_goal_fbs",
84 ":superstructure_output_fbs",
85 ":superstructure_position_fbs",
86 ":superstructure_status_fbs",
87 "//aos:flatbuffer_merge",
88 "//aos/events:event_loop",
89 "//frc971/constants:constants_sender_lib",
90 "//frc971/control_loops:control_loop",
91 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
92 "//frc971/control_loops/drivetrain:drivetrain_status_fbs",
93 "//frc971/shooter_interpolation:interpolation",
94 "//frc971/zeroing:absolute_encoder",
95 "//frc971/zeroing:pot_and_absolute_encoder",
96 "//y2024:constants",
97 "//y2024/constants:constants_fbs",
98 "//y2024/constants:simulated_constants_sender",
99 ],
100)
101
102cc_binary(
103 name = "superstructure",
104 srcs = [
105 "superstructure_main.cc",
106 ],
107 deps = [
108 ":superstructure_lib",
109 "//aos:init",
110 "//aos/events:shm_event_loop",
111 ],
112)
113
114cc_test(
115 name = "superstructure_lib_test",
116 srcs = [
117 "superstructure_lib_test.cc",
118 ],
119 data = [
120 "//y2024:aos_config",
121 ],
122 deps = [
123 ":superstructure_goal_fbs",
124 ":superstructure_lib",
125 ":superstructure_output_fbs",
126 ":superstructure_position_fbs",
127 ":superstructure_status_fbs",
128 "//aos:json_to_flatbuffer",
129 "//aos:math",
130 "//aos/events/logging:log_writer",
131 "//aos/testing:googletest",
132 "//aos/time",
133 "//frc971/control_loops:capped_test_plant",
134 "//frc971/control_loops:control_loop_test",
135 "//frc971/control_loops:position_sensor_sim",
136 "//frc971/control_loops:subsystem_simulator",
137 "//frc971/control_loops:team_number_test_environment",
138 "//frc971/control_loops/drivetrain:drivetrain_status_fbs",
139 ],
140)
141
142cc_binary(
143 name = "superstructure_replay",
144 srcs = ["superstructure_replay.cc"],
145 deps = [
146 ":superstructure_lib",
147 "//aos:configuration",
148 "//aos:init",
149 "//aos/events:simulated_event_loop",
150 "//aos/events/logging:log_reader",
151 "//aos/network:team_number",
152 ],
153)
154
155ts_project(
156 name = "superstructure_plotter",
157 srcs = ["superstructure_plotter.ts"],
158 target_compatible_with = ["@platforms//os:linux"],
159 deps = [
160 "//aos/network/www:aos_plotter",
161 "//aos/network/www:colors",
162 "//aos/network/www:proxy",
163 ],
164)