blob: a114728f7b90c0b14901aa8feaaa6f342d54f249 [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 = [
Nikolai Sohmers0991b1f2024-10-20 14:24:34 -070030 ":joystick_reader",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070031 "//aos/events/logging:logger_main",
32 "//aos/network:web_proxy_main",
33 "//aos/starter:irq_affinity",
34 ":wpilib_interface",
35 ":swerve_publisher",
Nikolai Sohmers308c8992024-06-22 15:11:05 -070036 "//y2024_swerve/control_loops:swerve_control_loops",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070037 "//frc971/can_logger",
38 "//aos/network:message_bridge_client",
39 "//aos/network:message_bridge_server",
40 ],
41 target_compatible_with = ["@platforms//os:linux"],
42)
43
44robot_downloader(
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070045 name = "orin_download",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070046 binaries = [
Nikolai Sohmers0991b1f2024-10-20 14:24:34 -070047 "//frc971/wpilib:joystick_republish",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070048 "//aos/events:aos_timing_report_streamer",
49 "//aos/events/logging:log_cat",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070050 "//aos:aos_jitter",
51 "//aos/network:web_proxy_main",
52 "//aos/starter:irq_affinity",
53 "//aos/util:foxglove_websocket",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070054 "//frc971/image_streamer:image_streamer",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070055 "//frc971/orin:hardware_monitor",
56 "//frc971/orin:argus_monitor",
57 "//frc971/vision:intrinsics_calibration",
58 "//aos/util:filesystem_monitor",
59 "//y2024_swerve/constants:constants_sender",
60 "//frc971/vision:foxglove_image_converter",
61 ],
62 data = [
63 ":aos_config",
64 "//frc971/orin:orin_irq_config.json",
65 "//y2024/www:www_files",
66 "//y2024_swerve/constants:constants.json",
67 ],
68 dirs = [
69 "//y2024/www:www_files",
70 ],
71 start_binaries = [
72 "//aos/events/logging:logger_main",
73 "//frc971/imu_fdcan:can_translator",
74 "//frc971/imu_fdcan:dual_imu_blender",
James Kuszmaul5e53ab52024-06-22 14:08:42 -070075 "//frc971/orin:localizer_logger",
James Kuszmauld7c028f2024-06-19 19:59:56 -070076 "//frc971/can_logger",
James Kuszmaulcf2cf532024-06-22 14:02:48 -070077 "//frc971/wpilib:joystick_republish",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070078 "//aos/network:message_bridge_client",
79 "//aos/network:message_bridge_server",
80 "//aos/network:web_proxy_main",
81 "//aos/starter:irq_affinity",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070082 "//frc971/orin:argus_camera",
83 "//y2024_swerve/vision:apriltag_detector",
84 "//frc971/vision:image_logger",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070085 ],
86 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
87 target_type = "pi",
88)
89
90filegroup(
James Kuszmauleaba6d92024-07-31 20:42:20 -070091 name = "swerve_publisher_goal_json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070092 srcs = [
James Kuszmauleaba6d92024-07-31 20:42:20 -070093 "swerve_drivetrain_goal.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070094 ],
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -070095 visibility = ["//y2024_swerve:__subpackages__"],
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070096)
97
98cc_library(
99 name = "constants",
100 srcs = ["constants.cc"],
101 hdrs = [
102 "constants.h",
103 ],
104 visibility = ["//visibility:public"],
105 deps = [
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700106 "//aos/mutex",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700107 "//aos/network:team_number",
108 "//frc971:constants",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700109 "//y2024_swerve/constants:constants_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700110 "@com_google_absl//absl/base",
Austin Schuh99f7c6a2024-06-25 22:07:44 -0700111 "@com_google_absl//absl/log",
112 "@com_google_absl//absl/log:check",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700113 ],
114)
115
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700116cc_binary(
117 name = "swerve_publisher",
118 srcs = ["swerve_publisher_main.cc"],
119 deps = [
120 ":swerve_publisher_lib",
121 "//aos/events:shm_event_loop",
Austin Schuh99f7c6a2024-06-25 22:07:44 -0700122 "@com_google_absl//absl/flags:flag",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700123 ],
124)
125
126cc_library(
127 name = "swerve_publisher_lib",
128 srcs = ["swerve_publisher_lib.cc"],
129 hdrs = ["swerve_publisher_lib.h"],
130 deps = [
131 "//aos:init",
132 "//aos/events:event_loop",
James Kuszmauleaba6d92024-07-31 20:42:20 -0700133 "//frc971/control_loops/swerve:swerve_drivetrain_goal_fbs",
Austin Schuh99f7c6a2024-06-25 22:07:44 -0700134 "@com_google_absl//absl/log",
135 "@com_google_absl//absl/log:check",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700136 ],
137)
138
139cc_test(
140 name = "swerve_publisher_lib_test",
141 srcs = [
142 "swerve_publisher_lib_test.cc",
143 ],
144 data = [
145 ":aos_config",
James Kuszmauleaba6d92024-07-31 20:42:20 -0700146 ":swerve_publisher_goal_json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700147 ],
148 deps = [
149 ":swerve_publisher_lib",
150 "//aos/events:simulated_event_loop",
151 "//aos/testing:googletest",
152 ],
153)
154
155cc_binary(
156 name = "wpilib_interface",
157 srcs = ["wpilib_interface.cc"],
158 target_compatible_with = ["//tools/platforms/hardware:roborio"],
159 deps = [
160 ":constants",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700161 "//aos:init",
162 "//aos/events:shm_event_loop",
Nikolai Sohmersce9ee6e2024-07-06 17:16:20 -0700163 "//frc971/constants:constants_sender_lib",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700164 "//frc971/control_loops:control_loops_fbs",
Nikolai Sohmers3f2a5072024-06-08 14:05:59 -0700165 "//frc971/control_loops/swerve:swerve_drivetrain_can_position_fbs",
James Kuszmauld938d332024-05-15 20:47:19 -0700166 "//frc971/control_loops/swerve:swerve_drivetrain_position_fbs",
James Kuszmaul6e445c42024-07-06 13:06:23 -0700167 "//frc971/queues:gyro_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700168 "//frc971/wpilib:can_sensor_reader",
James Kuszmaulf40b6772024-06-22 16:04:03 -0700169 "//frc971/wpilib:joystick_sender",
170 "//frc971/wpilib:pdp_fetcher",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700171 "//frc971/wpilib:sensor_reader",
Maxwell Henderson10ed5c32024-01-09 12:40:54 -0800172 "//frc971/wpilib:talonfx",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700173 "//frc971/wpilib:wpilib_robot_base",
174 "//frc971/wpilib/swerve:swerve_drivetrain_writer",
Nikolai Sohmersce9ee6e2024-07-06 17:16:20 -0700175 "//y2024_swerve/constants:constants_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700176 ],
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 = [
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700203 "//frc971:can_configuration_fbs",
Nikolai Sohmersc4fce5d2024-06-15 19:46:46 -0500204 "//frc971/queues:gyro_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700205 "//aos/network:remote_message_fbs",
206 "//aos/network:message_bridge_client_fbs",
207 "//aos/network:message_bridge_server_fbs",
208 "//aos/network:timestamp_fbs",
Nikolai Sohmersc4fce5d2024-06-15 19:46:46 -0500209 "//frc971/control_loops/swerve:swerve_drivetrain_goal_fbs",
210 "//frc971/control_loops/swerve:swerve_drivetrain_status_fbs",
James Kuszmauld938d332024-05-15 20:47:19 -0700211 "//frc971/control_loops/swerve:swerve_drivetrain_output_fbs",
212 "//frc971/control_loops/swerve:swerve_drivetrain_position_fbs",
Nikolai Sohmersc4fce5d2024-06-15 19:46:46 -0500213 "//y2024_swerve/constants:constants_fbs",
Nikolai Sohmers3f2a5072024-06-08 14:05:59 -0700214 "//frc971/control_loops/swerve:swerve_drivetrain_can_position_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700215 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
216 "//frc971/can_logger:can_logging_fbs",
217 ],
218 target_compatible_with = ["@platforms//os:linux"],
219 deps = [
220 "//aos/events:aos_config",
221 "//frc971/autonomous:aos_config",
222 "//frc971/control_loops/drivetrain:aos_config",
223 "//frc971/input:aos_config",
224 "//frc971/wpilib:aos_config",
225 ],
226)
227
228aos_config(
229 name = "config_imu",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -0700230 src = "y2024_swerve_imu.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700231 flatbuffers = [
232 "//aos/network:message_bridge_client_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700233 "//y2024_swerve/constants:constants_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700234 "//aos/network:message_bridge_server_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700235 "//frc971/imu_fdcan:dual_imu_fbs",
236 "//frc971/imu_fdcan:can_translator_status_fbs",
237 "//frc971/imu_fdcan:dual_imu_blender_status_fbs",
238 "//frc971/can_logger:can_logging_fbs",
239 "//frc971/orin:hardware_stats_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700240 "//aos/network:timestamp_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700241 "//aos/util:filesystem_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700242 "//aos/network:remote_message_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700243 "//frc971/vision:calibration_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700244 "//frc971/vision:target_map_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700245 "//frc971/vision:vision_fbs",
246 "@com_github_foxglove_schemas//:schemas",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700247 ],
248 target_compatible_with = ["@platforms//os:linux"],
249 visibility = ["//visibility:public"],
250 deps = [
251 "//aos/events:aos_config",
252 "//frc971/control_loops/drivetrain:aos_config",
253 ],
254)
255
256aos_config(
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700257 name = "config_orin1",
258 src = "y2024_swerve_orin1.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700259 flatbuffers = [
260 "//aos/network:message_bridge_client_fbs",
261 "//aos/network:message_bridge_server_fbs",
262 "//aos/network:timestamp_fbs",
263 "//aos/network:remote_message_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700264 "//y2024_swerve/constants:constants_fbs",
265 "//frc971/orin:hardware_stats_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700266 "//frc971/vision:calibration_fbs",
267 "//frc971/vision:target_map_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700268 "//frc971/vision:vision_fbs",
269 "//aos/util:filesystem_fbs",
270 "@com_github_foxglove_schemas//:schemas",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700271 ],
272 target_compatible_with = ["@platforms//os:linux"],
273 visibility = ["//visibility:public"],
274 deps = [
275 "//aos/events:aos_config",
276 "//frc971/control_loops/drivetrain:aos_config",
277 "//frc971/input:aos_config",
278 ],
279)
Nikolai Sohmers0991b1f2024-10-20 14:24:34 -0700280
281cc_binary(
282 name = "joystick_reader",
283 srcs = [
284 ":joystick_reader.cc",
285 ],
286 deps = [
287 "//aos:init",
288 "//aos/actions:action_lib",
289 "//aos/events:shm_event_loop",
290 "//aos/logging",
291 "//frc971/input:drivetrain_input",
292 "//frc971/input:joystick_input",
293 "//frc971/input:redundant_joystick_data",
294 "//frc971/input:swerve_joystick_input",
295 "//y2024/control_loops/drivetrain:drivetrain_base",
296 ],
297)