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