blob: 79bd0797290d9e4132567c5066551e1027b04d40 [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",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700164 "//frc971/wpilib:can_sensor_reader",
James Kuszmaulf40b6772024-06-22 16:04:03 -0700165 "//frc971/wpilib:joystick_sender",
166 "//frc971/wpilib:pdp_fetcher",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700167 "//frc971/wpilib:sensor_reader",
Maxwell Henderson10ed5c32024-01-09 12:40:54 -0800168 "//frc971/wpilib:talonfx",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700169 "//frc971/wpilib:wpilib_robot_base",
170 "//frc971/wpilib/swerve:swerve_drivetrain_writer",
Nikolai Sohmersce9ee6e2024-07-06 17:16:20 -0700171 "//y2024_swerve/constants:constants_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700172 ],
173)
174
175aos_config(
176 name = "aos_config",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -0700177 src = "y2024_swerve.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700178 flatbuffers = [
179 "//aos/network:message_bridge_client_fbs",
180 "//aos/network:message_bridge_server_fbs",
181 "//aos/network:timestamp_fbs",
182 "//frc971/input:robot_state_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700183 "//frc971/vision:vision_fbs",
184 "//frc971/vision:target_map_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700185 ],
186 target_compatible_with = ["@platforms//os:linux"],
187 visibility = ["//visibility:public"],
188 deps = [
189 ":config_imu",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700190 ":config_orin1",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700191 ":config_roborio",
192 ],
193)
194
195aos_config(
196 name = "config_roborio",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -0700197 src = "y2024_swerve_roborio.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700198 flatbuffers = [
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700199 "//frc971:can_configuration_fbs",
Nikolai Sohmersc4fce5d2024-06-15 19:46:46 -0500200 "//frc971/queues:gyro_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700201 "//aos/network:remote_message_fbs",
202 "//aos/network:message_bridge_client_fbs",
203 "//aos/network:message_bridge_server_fbs",
204 "//aos/network:timestamp_fbs",
Nikolai Sohmersc4fce5d2024-06-15 19:46:46 -0500205 "//frc971/control_loops/swerve:swerve_drivetrain_goal_fbs",
206 "//frc971/control_loops/swerve:swerve_drivetrain_status_fbs",
James Kuszmauld938d332024-05-15 20:47:19 -0700207 "//frc971/control_loops/swerve:swerve_drivetrain_output_fbs",
208 "//frc971/control_loops/swerve:swerve_drivetrain_position_fbs",
Nikolai Sohmersc4fce5d2024-06-15 19:46:46 -0500209 "//y2024_swerve/constants:constants_fbs",
Nikolai Sohmers3f2a5072024-06-08 14:05:59 -0700210 "//frc971/control_loops/swerve:swerve_drivetrain_can_position_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700211 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
212 "//frc971/can_logger:can_logging_fbs",
213 ],
214 target_compatible_with = ["@platforms//os:linux"],
215 deps = [
216 "//aos/events:aos_config",
217 "//frc971/autonomous:aos_config",
218 "//frc971/control_loops/drivetrain:aos_config",
219 "//frc971/input:aos_config",
220 "//frc971/wpilib:aos_config",
221 ],
222)
223
224aos_config(
225 name = "config_imu",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -0700226 src = "y2024_swerve_imu.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700227 flatbuffers = [
228 "//aos/network:message_bridge_client_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700229 "//y2024_swerve/constants:constants_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700230 "//aos/network:message_bridge_server_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700231 "//frc971/imu_fdcan:dual_imu_fbs",
232 "//frc971/imu_fdcan:can_translator_status_fbs",
233 "//frc971/imu_fdcan:dual_imu_blender_status_fbs",
234 "//frc971/can_logger:can_logging_fbs",
235 "//frc971/orin:hardware_stats_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700236 "//aos/network:timestamp_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700237 "//aos/util:filesystem_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700238 "//aos/network:remote_message_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700239 "//frc971/vision:calibration_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700240 "//frc971/vision:target_map_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700241 "//frc971/vision:vision_fbs",
242 "@com_github_foxglove_schemas//:schemas",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700243 ],
244 target_compatible_with = ["@platforms//os:linux"],
245 visibility = ["//visibility:public"],
246 deps = [
247 "//aos/events:aos_config",
248 "//frc971/control_loops/drivetrain:aos_config",
249 ],
250)
251
252aos_config(
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700253 name = "config_orin1",
254 src = "y2024_swerve_orin1.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700255 flatbuffers = [
256 "//aos/network:message_bridge_client_fbs",
257 "//aos/network:message_bridge_server_fbs",
258 "//aos/network:timestamp_fbs",
259 "//aos/network:remote_message_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700260 "//y2024_swerve/constants:constants_fbs",
261 "//frc971/orin:hardware_stats_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700262 "//frc971/vision:calibration_fbs",
263 "//frc971/vision:target_map_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700264 "//frc971/vision:vision_fbs",
265 "//aos/util:filesystem_fbs",
266 "@com_github_foxglove_schemas//:schemas",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700267 ],
268 target_compatible_with = ["@platforms//os:linux"],
269 visibility = ["//visibility:public"],
270 deps = [
271 "//aos/events:aos_config",
272 "//frc971/control_loops/drivetrain:aos_config",
273 "//frc971/input:aos_config",
274 ],
275)