blob: ee9c3cb38b858b3e9f38bcf23023000b6eb7f67e [file] [log] [blame]
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -07001load("//aos:config.bzl", "aos_config")
Austin Schuh8f99c822024-05-05 22:43:40 -07002load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -07003load("//aos/util:config_validator_macro.bzl", "config_validator_test")
Austin Schuh8f99c822024-05-05 22:43:40 -07004load("//frc971:downloader.bzl", "robot_downloader")
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -07005
6config_validator_test(
7 name = "config_validator_test",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -07008 config = "//y2024_swerve:aos_config",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -07009)
10
11robot_downloader(
12 binaries = [
13 "//aos/network:web_proxy_main",
14 "//aos/events/logging:log_cat",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070015 "//y2024_swerve/constants:constants_sender",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070016 "//aos/events:aos_timing_report_streamer",
17 ],
18 data = [
19 ":aos_config",
20 ":swerve_publisher_output_json",
21 "@ctre_phoenix6_api_cpp_athena//:shared_libraries",
22 "@ctre_phoenix6_tools_athena//:shared_libraries",
23 "@ctre_phoenix_api_cpp_athena//:shared_libraries",
24 "@ctre_phoenix_cci_athena//:shared_libraries",
25 ],
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070026 dirs = [
27 "//y2024/www:www_files",
28 ],
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070029 start_binaries = [
30 "//aos/events/logging:logger_main",
31 "//aos/network:web_proxy_main",
32 "//aos/starter:irq_affinity",
33 ":wpilib_interface",
34 ":swerve_publisher",
35 "//frc971/can_logger",
36 "//aos/network:message_bridge_client",
37 "//aos/network:message_bridge_server",
38 ],
39 target_compatible_with = ["@platforms//os:linux"],
40)
41
42robot_downloader(
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070043 name = "orin_download",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070044 binaries = [
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070045 "//aos/events:aos_timing_report_streamer",
46 "//aos/events/logging:log_cat",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070047 "//aos:aos_jitter",
48 "//aos/network:web_proxy_main",
49 "//aos/starter:irq_affinity",
50 "//aos/util:foxglove_websocket",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070051 "//frc971/image_streamer:image_streamer",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070052 "//frc971/orin:hardware_monitor",
53 "//frc971/orin:argus_monitor",
54 "//frc971/vision:intrinsics_calibration",
55 "//aos/util:filesystem_monitor",
56 "//y2024_swerve/constants:constants_sender",
57 "//frc971/vision:foxglove_image_converter",
58 ],
59 data = [
60 ":aos_config",
61 "//frc971/orin:orin_irq_config.json",
62 "//y2024/www:www_files",
63 "//y2024_swerve/constants:constants.json",
64 ],
65 dirs = [
66 "//y2024/www:www_files",
67 ],
68 start_binaries = [
69 "//aos/events/logging:logger_main",
70 "//frc971/imu_fdcan:can_translator",
71 "//frc971/imu_fdcan:dual_imu_blender",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070072 "//aos/network:message_bridge_client",
73 "//aos/network:message_bridge_server",
74 "//aos/network:web_proxy_main",
75 "//aos/starter:irq_affinity",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070076 "//frc971/orin:argus_camera",
77 "//y2024_swerve/vision:apriltag_detector",
78 "//frc971/vision:image_logger",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070079 ],
80 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
81 target_type = "pi",
82)
83
84filegroup(
85 name = "swerve_publisher_output_json",
86 srcs = [
87 "swerve_drivetrain_output.json",
88 ],
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -070089 visibility = ["//y2024_swerve:__subpackages__"],
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070090)
91
92cc_library(
93 name = "constants",
94 srcs = ["constants.cc"],
95 hdrs = [
96 "constants.h",
97 ],
98 visibility = ["//visibility:public"],
99 deps = [
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700100 "//aos/mutex",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700101 "//aos/network:team_number",
102 "//frc971:constants",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700103 "//y2024_swerve/constants:constants_fbs",
104 "@com_github_google_glog//:glog",
105 "@com_google_absl//absl/base",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700106 ],
107)
108
James Kuszmaulf01da392023-12-14 11:22:14 -0800109static_flatbuffer(
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700110 name = "drivetrain_position_fbs",
111 srcs = ["drivetrain_position.fbs"],
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700112 deps = ["//frc971/control_loops:control_loops_fbs"],
113)
114
James Kuszmaulf01da392023-12-14 11:22:14 -0800115static_flatbuffer(
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700116 name = "drivetrain_can_position_fbs",
117 srcs = ["drivetrain_can_position.fbs"],
Maxwell Henderson10ed5c32024-01-09 12:40:54 -0800118 deps = ["//frc971/control_loops:can_talonfx_fbs"],
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700119)
120
121cc_binary(
122 name = "swerve_publisher",
123 srcs = ["swerve_publisher_main.cc"],
124 deps = [
125 ":swerve_publisher_lib",
126 "//aos/events:shm_event_loop",
127 "@com_github_gflags_gflags//:gflags",
128 ],
129)
130
131cc_library(
132 name = "swerve_publisher_lib",
133 srcs = ["swerve_publisher_lib.cc"],
134 hdrs = ["swerve_publisher_lib.h"],
135 deps = [
136 "//aos:init",
137 "//aos/events:event_loop",
James Kuszmauld938d332024-05-15 20:47:19 -0700138 "//frc971/control_loops/swerve:swerve_drivetrain_output_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700139 "@com_github_google_glog//:glog",
140 ],
141)
142
143cc_test(
144 name = "swerve_publisher_lib_test",
145 srcs = [
146 "swerve_publisher_lib_test.cc",
147 ],
148 data = [
149 ":aos_config",
150 ":swerve_publisher_output_json",
151 ],
152 deps = [
153 ":swerve_publisher_lib",
154 "//aos/events:simulated_event_loop",
155 "//aos/testing:googletest",
156 ],
157)
158
159cc_binary(
160 name = "wpilib_interface",
161 srcs = ["wpilib_interface.cc"],
162 target_compatible_with = ["//tools/platforms/hardware:roborio"],
163 deps = [
164 ":constants",
165 ":drivetrain_can_position_fbs",
166 ":drivetrain_position_fbs",
167 "//aos:init",
168 "//aos/events:shm_event_loop",
169 "//frc971/control_loops:control_loops_fbs",
James Kuszmauld938d332024-05-15 20:47:19 -0700170 "//frc971/control_loops/swerve:swerve_drivetrain_position_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700171 "//frc971/wpilib:can_sensor_reader",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700172 "//frc971/wpilib:sensor_reader",
Maxwell Henderson10ed5c32024-01-09 12:40:54 -0800173 "//frc971/wpilib:talonfx",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700174 "//frc971/wpilib:wpilib_robot_base",
175 "//frc971/wpilib/swerve:swerve_drivetrain_writer",
176 ],
177)
178
179aos_config(
180 name = "aos_config",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -0700181 src = "y2024_swerve.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700182 flatbuffers = [
183 "//aos/network:message_bridge_client_fbs",
184 "//aos/network:message_bridge_server_fbs",
185 "//aos/network:timestamp_fbs",
186 "//frc971/input:robot_state_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700187 "//frc971/vision:vision_fbs",
188 "//frc971/vision:target_map_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700189 ],
190 target_compatible_with = ["@platforms//os:linux"],
191 visibility = ["//visibility:public"],
192 deps = [
193 ":config_imu",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700194 ":config_orin1",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700195 ":config_roborio",
196 ],
197)
198
199aos_config(
200 name = "config_roborio",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -0700201 src = "y2024_swerve_roborio.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700202 flatbuffers = [
203 ":drivetrain_position_fbs",
204 ":drivetrain_can_position_fbs",
205 "//frc971:can_configuration_fbs",
206 "//aos/network:remote_message_fbs",
207 "//aos/network:message_bridge_client_fbs",
208 "//aos/network:message_bridge_server_fbs",
209 "//aos/network:timestamp_fbs",
James Kuszmauld938d332024-05-15 20:47:19 -0700210 "//frc971/control_loops/swerve:swerve_drivetrain_output_fbs",
211 "//frc971/control_loops/swerve:swerve_drivetrain_position_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700212 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
213 "//frc971/can_logger:can_logging_fbs",
214 ],
215 target_compatible_with = ["@platforms//os:linux"],
216 deps = [
217 "//aos/events:aos_config",
218 "//frc971/autonomous:aos_config",
219 "//frc971/control_loops/drivetrain:aos_config",
220 "//frc971/input:aos_config",
221 "//frc971/wpilib:aos_config",
222 ],
223)
224
225aos_config(
226 name = "config_imu",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -0700227 src = "y2024_swerve_imu.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700228 flatbuffers = [
229 "//aos/network:message_bridge_client_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700230 "//y2024_swerve/constants:constants_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700231 "//aos/network:message_bridge_server_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700232 "//frc971/imu_fdcan:dual_imu_fbs",
233 "//frc971/imu_fdcan:can_translator_status_fbs",
234 "//frc971/imu_fdcan:dual_imu_blender_status_fbs",
235 "//frc971/can_logger:can_logging_fbs",
236 "//frc971/orin:hardware_stats_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700237 "//aos/network:timestamp_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700238 "//aos/util:filesystem_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700239 "//aos/network:remote_message_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700240 "//frc971/vision:calibration_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700241 "//frc971/vision:target_map_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700242 "//frc971/vision:vision_fbs",
243 "@com_github_foxglove_schemas//:schemas",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700244 ],
245 target_compatible_with = ["@platforms//os:linux"],
246 visibility = ["//visibility:public"],
247 deps = [
248 "//aos/events:aos_config",
249 "//frc971/control_loops/drivetrain:aos_config",
250 ],
251)
252
253aos_config(
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700254 name = "config_orin1",
255 src = "y2024_swerve_orin1.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700256 flatbuffers = [
257 "//aos/network:message_bridge_client_fbs",
258 "//aos/network:message_bridge_server_fbs",
259 "//aos/network:timestamp_fbs",
260 "//aos/network:remote_message_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700261 "//y2024_swerve/constants:constants_fbs",
262 "//frc971/orin:hardware_stats_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700263 "//frc971/vision:calibration_fbs",
264 "//frc971/vision:target_map_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700265 "//frc971/vision:vision_fbs",
266 "//aos/util:filesystem_fbs",
267 "@com_github_foxglove_schemas//:schemas",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700268 ],
269 target_compatible_with = ["@platforms//os:linux"],
270 visibility = ["//visibility:public"],
271 deps = [
272 "//aos/events:aos_config",
273 "//frc971/control_loops/drivetrain:aos_config",
274 "//frc971/input:aos_config",
275 ],
276)