blob: acc300d01e66d82b745d5b282d517bb8a8727e87 [file] [log] [blame]
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -07001load("//aos:config.bzl", "aos_config")
2load("//aos/util:config_validator_macro.bzl", "config_validator_test")
Austin Schuh8f99c822024-05-05 22:43:40 -07003load("//frc971:downloader.bzl", "robot_downloader")
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -07004
5config_validator_test(
6 name = "config_validator_test",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -07007 config = "//y2024_swerve:aos_config",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -07008)
9
10robot_downloader(
11 binaries = [
12 "//aos/network:web_proxy_main",
13 "//aos/events/logging:log_cat",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070014 "//y2024_swerve/constants:constants_sender",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070015 "//aos/events:aos_timing_report_streamer",
16 ],
17 data = [
18 ":aos_config",
19 ":swerve_publisher_output_json",
20 "@ctre_phoenix6_api_cpp_athena//:shared_libraries",
21 "@ctre_phoenix6_tools_athena//:shared_libraries",
22 "@ctre_phoenix_api_cpp_athena//:shared_libraries",
23 "@ctre_phoenix_cci_athena//:shared_libraries",
24 ],
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070025 dirs = [
26 "//y2024/www:www_files",
27 ],
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070028 start_binaries = [
29 "//aos/events/logging:logger_main",
30 "//aos/network:web_proxy_main",
31 "//aos/starter:irq_affinity",
32 ":wpilib_interface",
33 ":swerve_publisher",
34 "//frc971/can_logger",
35 "//aos/network:message_bridge_client",
36 "//aos/network:message_bridge_server",
37 ],
38 target_compatible_with = ["@platforms//os:linux"],
39)
40
41robot_downloader(
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070042 name = "orin_download",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070043 binaries = [
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070044 "//aos/events:aos_timing_report_streamer",
45 "//aos/events/logging:log_cat",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070046 "//aos:aos_jitter",
47 "//aos/network:web_proxy_main",
48 "//aos/starter:irq_affinity",
49 "//aos/util:foxglove_websocket",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070050 "//frc971/image_streamer:image_streamer",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070051 "//frc971/orin:hardware_monitor",
52 "//frc971/orin:argus_monitor",
53 "//frc971/vision:intrinsics_calibration",
54 "//aos/util:filesystem_monitor",
55 "//y2024_swerve/constants:constants_sender",
56 "//frc971/vision:foxglove_image_converter",
57 ],
58 data = [
59 ":aos_config",
60 "//frc971/orin:orin_irq_config.json",
61 "//y2024/www:www_files",
62 "//y2024_swerve/constants:constants.json",
63 ],
64 dirs = [
65 "//y2024/www:www_files",
66 ],
67 start_binaries = [
68 "//aos/events/logging:logger_main",
69 "//frc971/imu_fdcan:can_translator",
70 "//frc971/imu_fdcan:dual_imu_blender",
James Kuszmaul5e53ab52024-06-22 14:08:42 -070071 "//frc971/orin:localizer_logger",
James Kuszmauld7c028f2024-06-19 19:59:56 -070072 "//frc971/can_logger",
James Kuszmaulcf2cf532024-06-22 14:02:48 -070073 "//frc971/wpilib:joystick_republish",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070074 "//aos/network:message_bridge_client",
75 "//aos/network:message_bridge_server",
76 "//aos/network:web_proxy_main",
77 "//aos/starter:irq_affinity",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070078 "//frc971/orin:argus_camera",
79 "//y2024_swerve/vision:apriltag_detector",
80 "//frc971/vision:image_logger",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070081 ],
82 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
83 target_type = "pi",
84)
85
86filegroup(
87 name = "swerve_publisher_output_json",
88 srcs = [
89 "swerve_drivetrain_output.json",
90 ],
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -070091 visibility = ["//y2024_swerve:__subpackages__"],
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070092)
93
94cc_library(
95 name = "constants",
96 srcs = ["constants.cc"],
97 hdrs = [
98 "constants.h",
99 ],
100 visibility = ["//visibility:public"],
101 deps = [
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700102 "//aos/mutex",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700103 "//aos/network:team_number",
104 "//frc971:constants",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700105 "//y2024_swerve/constants:constants_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700106 "@com_google_absl//absl/base",
Austin Schuh99f7c6a2024-06-25 22:07:44 -0700107 "@com_google_absl//absl/log",
108 "@com_google_absl//absl/log:check",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700109 ],
110)
111
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700112cc_binary(
113 name = "swerve_publisher",
114 srcs = ["swerve_publisher_main.cc"],
115 deps = [
116 ":swerve_publisher_lib",
117 "//aos/events:shm_event_loop",
Austin Schuh99f7c6a2024-06-25 22:07:44 -0700118 "@com_google_absl//absl/flags:flag",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700119 ],
120)
121
122cc_library(
123 name = "swerve_publisher_lib",
124 srcs = ["swerve_publisher_lib.cc"],
125 hdrs = ["swerve_publisher_lib.h"],
126 deps = [
127 "//aos:init",
128 "//aos/events:event_loop",
James Kuszmauld938d332024-05-15 20:47:19 -0700129 "//frc971/control_loops/swerve:swerve_drivetrain_output_fbs",
Austin Schuh99f7c6a2024-06-25 22:07:44 -0700130 "@com_google_absl//absl/log",
131 "@com_google_absl//absl/log:check",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700132 ],
133)
134
135cc_test(
136 name = "swerve_publisher_lib_test",
137 srcs = [
138 "swerve_publisher_lib_test.cc",
139 ],
140 data = [
141 ":aos_config",
142 ":swerve_publisher_output_json",
143 ],
144 deps = [
145 ":swerve_publisher_lib",
146 "//aos/events:simulated_event_loop",
147 "//aos/testing:googletest",
148 ],
149)
150
151cc_binary(
152 name = "wpilib_interface",
153 srcs = ["wpilib_interface.cc"],
154 target_compatible_with = ["//tools/platforms/hardware:roborio"],
155 deps = [
156 ":constants",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700157 "//aos:init",
158 "//aos/events:shm_event_loop",
159 "//frc971/control_loops:control_loops_fbs",
Nikolai Sohmers3f2a5072024-06-08 14:05:59 -0700160 "//frc971/control_loops/swerve:swerve_drivetrain_can_position_fbs",
James Kuszmauld938d332024-05-15 20:47:19 -0700161 "//frc971/control_loops/swerve:swerve_drivetrain_position_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700162 "//frc971/wpilib:can_sensor_reader",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700163 "//frc971/wpilib:sensor_reader",
Maxwell Henderson10ed5c32024-01-09 12:40:54 -0800164 "//frc971/wpilib:talonfx",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700165 "//frc971/wpilib:wpilib_robot_base",
166 "//frc971/wpilib/swerve:swerve_drivetrain_writer",
167 ],
168)
169
170aos_config(
171 name = "aos_config",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -0700172 src = "y2024_swerve.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700173 flatbuffers = [
174 "//aos/network:message_bridge_client_fbs",
175 "//aos/network:message_bridge_server_fbs",
176 "//aos/network:timestamp_fbs",
177 "//frc971/input:robot_state_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700178 "//frc971/vision:vision_fbs",
179 "//frc971/vision:target_map_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700180 ],
181 target_compatible_with = ["@platforms//os:linux"],
182 visibility = ["//visibility:public"],
183 deps = [
184 ":config_imu",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700185 ":config_orin1",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700186 ":config_roborio",
187 ],
188)
189
190aos_config(
191 name = "config_roborio",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -0700192 src = "y2024_swerve_roborio.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700193 flatbuffers = [
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700194 "//frc971:can_configuration_fbs",
195 "//aos/network:remote_message_fbs",
196 "//aos/network:message_bridge_client_fbs",
197 "//aos/network:message_bridge_server_fbs",
198 "//aos/network:timestamp_fbs",
James Kuszmauld938d332024-05-15 20:47:19 -0700199 "//frc971/control_loops/swerve:swerve_drivetrain_output_fbs",
200 "//frc971/control_loops/swerve:swerve_drivetrain_position_fbs",
Nikolai Sohmers3f2a5072024-06-08 14:05:59 -0700201 "//frc971/control_loops/swerve:swerve_drivetrain_can_position_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700202 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
203 "//frc971/can_logger:can_logging_fbs",
204 ],
205 target_compatible_with = ["@platforms//os:linux"],
206 deps = [
207 "//aos/events:aos_config",
208 "//frc971/autonomous:aos_config",
209 "//frc971/control_loops/drivetrain:aos_config",
210 "//frc971/input:aos_config",
211 "//frc971/wpilib:aos_config",
212 ],
213)
214
215aos_config(
216 name = "config_imu",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -0700217 src = "y2024_swerve_imu.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700218 flatbuffers = [
219 "//aos/network:message_bridge_client_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700220 "//y2024_swerve/constants:constants_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700221 "//aos/network:message_bridge_server_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700222 "//frc971/imu_fdcan:dual_imu_fbs",
223 "//frc971/imu_fdcan:can_translator_status_fbs",
224 "//frc971/imu_fdcan:dual_imu_blender_status_fbs",
225 "//frc971/can_logger:can_logging_fbs",
226 "//frc971/orin:hardware_stats_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700227 "//aos/network:timestamp_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700228 "//aos/util:filesystem_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700229 "//aos/network:remote_message_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700230 "//frc971/vision:calibration_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700231 "//frc971/vision:target_map_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700232 "//frc971/vision:vision_fbs",
233 "@com_github_foxglove_schemas//:schemas",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700234 ],
235 target_compatible_with = ["@platforms//os:linux"],
236 visibility = ["//visibility:public"],
237 deps = [
238 "//aos/events:aos_config",
239 "//frc971/control_loops/drivetrain:aos_config",
240 ],
241)
242
243aos_config(
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700244 name = "config_orin1",
245 src = "y2024_swerve_orin1.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700246 flatbuffers = [
247 "//aos/network:message_bridge_client_fbs",
248 "//aos/network:message_bridge_server_fbs",
249 "//aos/network:timestamp_fbs",
250 "//aos/network:remote_message_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700251 "//y2024_swerve/constants:constants_fbs",
252 "//frc971/orin:hardware_stats_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700253 "//frc971/vision:calibration_fbs",
254 "//frc971/vision:target_map_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700255 "//frc971/vision:vision_fbs",
256 "//aos/util:filesystem_fbs",
257 "@com_github_foxglove_schemas//:schemas",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700258 ],
259 target_compatible_with = ["@platforms//os:linux"],
260 visibility = ["//visibility:public"],
261 deps = [
262 "//aos/events:aos_config",
263 "//frc971/control_loops/drivetrain:aos_config",
264 "//frc971/input:aos_config",
265 ],
266)