blob: e43235840101cd0b2615a473e69ae402e1fef3a6 [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",
James Kuszmauleaba6d92024-07-31 20:42:20 -070019 ":swerve_publisher_goal_json",
Nikolai Sohmersc4fce5d2024-06-15 19:46:46 -050020 "//y2024_swerve/constants:constants.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070021 "@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",
James Kuszmaul5e53ab52024-06-22 14:08:42 -070072 "//frc971/orin:localizer_logger",
James Kuszmauld7c028f2024-06-19 19:59:56 -070073 "//frc971/can_logger",
James Kuszmaulcf2cf532024-06-22 14:02:48 -070074 "//frc971/wpilib:joystick_republish",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070075 "//aos/network:message_bridge_client",
76 "//aos/network:message_bridge_server",
77 "//aos/network:web_proxy_main",
78 "//aos/starter:irq_affinity",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070079 "//frc971/orin:argus_camera",
80 "//y2024_swerve/vision:apriltag_detector",
81 "//frc971/vision:image_logger",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070082 ],
83 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
84 target_type = "pi",
85)
86
87filegroup(
James Kuszmauleaba6d92024-07-31 20:42:20 -070088 name = "swerve_publisher_goal_json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070089 srcs = [
James Kuszmauleaba6d92024-07-31 20:42:20 -070090 "swerve_drivetrain_goal.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070091 ],
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -070092 visibility = ["//y2024_swerve:__subpackages__"],
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070093)
94
95cc_library(
96 name = "constants",
97 srcs = ["constants.cc"],
98 hdrs = [
99 "constants.h",
100 ],
101 visibility = ["//visibility:public"],
102 deps = [
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700103 "//aos/mutex",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700104 "//aos/network:team_number",
105 "//frc971:constants",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700106 "//y2024_swerve/constants:constants_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700107 "@com_google_absl//absl/base",
Austin Schuh99f7c6a2024-06-25 22:07:44 -0700108 "@com_google_absl//absl/log",
109 "@com_google_absl//absl/log:check",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700110 ],
111)
112
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700113cc_binary(
114 name = "swerve_publisher",
115 srcs = ["swerve_publisher_main.cc"],
116 deps = [
117 ":swerve_publisher_lib",
118 "//aos/events:shm_event_loop",
Austin Schuh99f7c6a2024-06-25 22:07:44 -0700119 "@com_google_absl//absl/flags:flag",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700120 ],
121)
122
123cc_library(
124 name = "swerve_publisher_lib",
125 srcs = ["swerve_publisher_lib.cc"],
126 hdrs = ["swerve_publisher_lib.h"],
127 deps = [
128 "//aos:init",
129 "//aos/events:event_loop",
James Kuszmauleaba6d92024-07-31 20:42:20 -0700130 "//frc971/control_loops/swerve:swerve_drivetrain_goal_fbs",
Austin Schuh99f7c6a2024-06-25 22:07:44 -0700131 "@com_google_absl//absl/log",
132 "@com_google_absl//absl/log:check",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700133 ],
134)
135
136cc_test(
137 name = "swerve_publisher_lib_test",
138 srcs = [
139 "swerve_publisher_lib_test.cc",
140 ],
141 data = [
142 ":aos_config",
James Kuszmauleaba6d92024-07-31 20:42:20 -0700143 ":swerve_publisher_goal_json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700144 ],
145 deps = [
146 ":swerve_publisher_lib",
147 "//aos/events:simulated_event_loop",
148 "//aos/testing:googletest",
149 ],
150)
151
152cc_binary(
153 name = "wpilib_interface",
154 srcs = ["wpilib_interface.cc"],
155 target_compatible_with = ["//tools/platforms/hardware:roborio"],
156 deps = [
157 ":constants",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700158 "//aos:init",
159 "//aos/events:shm_event_loop",
Nikolai Sohmersce9ee6e2024-07-06 17:16:20 -0700160 "//frc971/constants:constants_sender_lib",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700161 "//frc971/control_loops:control_loops_fbs",
Nikolai Sohmers3f2a5072024-06-08 14:05:59 -0700162 "//frc971/control_loops/swerve:swerve_drivetrain_can_position_fbs",
James Kuszmauld938d332024-05-15 20:47:19 -0700163 "//frc971/control_loops/swerve:swerve_drivetrain_position_fbs",
James Kuszmaul6e445c42024-07-06 13:06:23 -0700164 "//frc971/queues:gyro_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700165 "//frc971/wpilib:can_sensor_reader",
James Kuszmaulf40b6772024-06-22 16:04:03 -0700166 "//frc971/wpilib:joystick_sender",
167 "//frc971/wpilib:pdp_fetcher",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700168 "//frc971/wpilib:sensor_reader",
Maxwell Henderson10ed5c32024-01-09 12:40:54 -0800169 "//frc971/wpilib:talonfx",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700170 "//frc971/wpilib:wpilib_robot_base",
171 "//frc971/wpilib/swerve:swerve_drivetrain_writer",
Nikolai Sohmersce9ee6e2024-07-06 17:16:20 -0700172 "//y2024_swerve/constants:constants_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700173 ],
174)
175
176aos_config(
177 name = "aos_config",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -0700178 src = "y2024_swerve.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700179 flatbuffers = [
180 "//aos/network:message_bridge_client_fbs",
181 "//aos/network:message_bridge_server_fbs",
182 "//aos/network:timestamp_fbs",
183 "//frc971/input:robot_state_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700184 "//frc971/vision:vision_fbs",
185 "//frc971/vision:target_map_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700186 ],
187 target_compatible_with = ["@platforms//os:linux"],
188 visibility = ["//visibility:public"],
189 deps = [
190 ":config_imu",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700191 ":config_orin1",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700192 ":config_roborio",
193 ],
194)
195
196aos_config(
197 name = "config_roborio",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -0700198 src = "y2024_swerve_roborio.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700199 flatbuffers = [
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700200 "//frc971:can_configuration_fbs",
Nikolai Sohmersc4fce5d2024-06-15 19:46:46 -0500201 "//frc971/queues:gyro_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700202 "//aos/network:remote_message_fbs",
203 "//aos/network:message_bridge_client_fbs",
204 "//aos/network:message_bridge_server_fbs",
205 "//aos/network:timestamp_fbs",
Nikolai Sohmersc4fce5d2024-06-15 19:46:46 -0500206 "//frc971/control_loops/swerve:swerve_drivetrain_goal_fbs",
207 "//frc971/control_loops/swerve:swerve_drivetrain_status_fbs",
James Kuszmauld938d332024-05-15 20:47:19 -0700208 "//frc971/control_loops/swerve:swerve_drivetrain_output_fbs",
209 "//frc971/control_loops/swerve:swerve_drivetrain_position_fbs",
Nikolai Sohmersc4fce5d2024-06-15 19:46:46 -0500210 "//y2024_swerve/constants:constants_fbs",
Nikolai Sohmers3f2a5072024-06-08 14:05:59 -0700211 "//frc971/control_loops/swerve:swerve_drivetrain_can_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)