blob: 480ef72b50626753fc54436bab902e46c9ff6283 [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 Kuszmauld7c028f2024-06-19 19:59:56 -070071 "//frc971/can_logger",
James Kuszmaulcf2cf532024-06-22 14:02:48 -070072 "//frc971/wpilib:joystick_republish",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070073 "//aos/network:message_bridge_client",
74 "//aos/network:message_bridge_server",
75 "//aos/network:web_proxy_main",
76 "//aos/starter:irq_affinity",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070077 "//frc971/orin:argus_camera",
78 "//y2024_swerve/vision:apriltag_detector",
79 "//frc971/vision:image_logger",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070080 ],
81 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
82 target_type = "pi",
83)
84
85filegroup(
86 name = "swerve_publisher_output_json",
87 srcs = [
88 "swerve_drivetrain_output.json",
89 ],
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -070090 visibility = ["//y2024_swerve:__subpackages__"],
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070091)
92
93cc_library(
94 name = "constants",
95 srcs = ["constants.cc"],
96 hdrs = [
97 "constants.h",
98 ],
99 visibility = ["//visibility:public"],
100 deps = [
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700101 "//aos/mutex",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700102 "//aos/network:team_number",
103 "//frc971:constants",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700104 "//y2024_swerve/constants:constants_fbs",
105 "@com_github_google_glog//:glog",
106 "@com_google_absl//absl/base",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700107 ],
108)
109
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700110cc_binary(
111 name = "swerve_publisher",
112 srcs = ["swerve_publisher_main.cc"],
113 deps = [
114 ":swerve_publisher_lib",
115 "//aos/events:shm_event_loop",
116 "@com_github_gflags_gflags//:gflags",
117 ],
118)
119
120cc_library(
121 name = "swerve_publisher_lib",
122 srcs = ["swerve_publisher_lib.cc"],
123 hdrs = ["swerve_publisher_lib.h"],
124 deps = [
125 "//aos:init",
126 "//aos/events:event_loop",
James Kuszmauld938d332024-05-15 20:47:19 -0700127 "//frc971/control_loops/swerve:swerve_drivetrain_output_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700128 "@com_github_google_glog//:glog",
129 ],
130)
131
132cc_test(
133 name = "swerve_publisher_lib_test",
134 srcs = [
135 "swerve_publisher_lib_test.cc",
136 ],
137 data = [
138 ":aos_config",
139 ":swerve_publisher_output_json",
140 ],
141 deps = [
142 ":swerve_publisher_lib",
143 "//aos/events:simulated_event_loop",
144 "//aos/testing:googletest",
145 ],
146)
147
148cc_binary(
149 name = "wpilib_interface",
150 srcs = ["wpilib_interface.cc"],
151 target_compatible_with = ["//tools/platforms/hardware:roborio"],
152 deps = [
153 ":constants",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700154 "//aos:init",
155 "//aos/events:shm_event_loop",
156 "//frc971/control_loops:control_loops_fbs",
Nikolai Sohmers3f2a5072024-06-08 14:05:59 -0700157 "//frc971/control_loops/swerve:swerve_drivetrain_can_position_fbs",
James Kuszmauld938d332024-05-15 20:47:19 -0700158 "//frc971/control_loops/swerve:swerve_drivetrain_position_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700159 "//frc971/wpilib:can_sensor_reader",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700160 "//frc971/wpilib:sensor_reader",
Maxwell Henderson10ed5c32024-01-09 12:40:54 -0800161 "//frc971/wpilib:talonfx",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700162 "//frc971/wpilib:wpilib_robot_base",
163 "//frc971/wpilib/swerve:swerve_drivetrain_writer",
164 ],
165)
166
167aos_config(
168 name = "aos_config",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -0700169 src = "y2024_swerve.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700170 flatbuffers = [
171 "//aos/network:message_bridge_client_fbs",
172 "//aos/network:message_bridge_server_fbs",
173 "//aos/network:timestamp_fbs",
174 "//frc971/input:robot_state_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700175 "//frc971/vision:vision_fbs",
176 "//frc971/vision:target_map_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700177 ],
178 target_compatible_with = ["@platforms//os:linux"],
179 visibility = ["//visibility:public"],
180 deps = [
181 ":config_imu",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700182 ":config_orin1",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700183 ":config_roborio",
184 ],
185)
186
187aos_config(
188 name = "config_roborio",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -0700189 src = "y2024_swerve_roborio.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700190 flatbuffers = [
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700191 "//frc971:can_configuration_fbs",
192 "//aos/network:remote_message_fbs",
193 "//aos/network:message_bridge_client_fbs",
194 "//aos/network:message_bridge_server_fbs",
195 "//aos/network:timestamp_fbs",
James Kuszmauld938d332024-05-15 20:47:19 -0700196 "//frc971/control_loops/swerve:swerve_drivetrain_output_fbs",
197 "//frc971/control_loops/swerve:swerve_drivetrain_position_fbs",
Nikolai Sohmers3f2a5072024-06-08 14:05:59 -0700198 "//frc971/control_loops/swerve:swerve_drivetrain_can_position_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700199 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
200 "//frc971/can_logger:can_logging_fbs",
201 ],
202 target_compatible_with = ["@platforms//os:linux"],
203 deps = [
204 "//aos/events:aos_config",
205 "//frc971/autonomous:aos_config",
206 "//frc971/control_loops/drivetrain:aos_config",
207 "//frc971/input:aos_config",
208 "//frc971/wpilib:aos_config",
209 ],
210)
211
212aos_config(
213 name = "config_imu",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -0700214 src = "y2024_swerve_imu.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700215 flatbuffers = [
216 "//aos/network:message_bridge_client_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700217 "//y2024_swerve/constants:constants_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700218 "//aos/network:message_bridge_server_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700219 "//frc971/imu_fdcan:dual_imu_fbs",
220 "//frc971/imu_fdcan:can_translator_status_fbs",
221 "//frc971/imu_fdcan:dual_imu_blender_status_fbs",
222 "//frc971/can_logger:can_logging_fbs",
223 "//frc971/orin:hardware_stats_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700224 "//aos/network:timestamp_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700225 "//aos/util:filesystem_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700226 "//aos/network:remote_message_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700227 "//frc971/vision:calibration_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700228 "//frc971/vision:target_map_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700229 "//frc971/vision:vision_fbs",
230 "@com_github_foxglove_schemas//:schemas",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700231 ],
232 target_compatible_with = ["@platforms//os:linux"],
233 visibility = ["//visibility:public"],
234 deps = [
235 "//aos/events:aos_config",
236 "//frc971/control_loops/drivetrain:aos_config",
237 ],
238)
239
240aos_config(
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700241 name = "config_orin1",
242 src = "y2024_swerve_orin1.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700243 flatbuffers = [
244 "//aos/network:message_bridge_client_fbs",
245 "//aos/network:message_bridge_server_fbs",
246 "//aos/network:timestamp_fbs",
247 "//aos/network:remote_message_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700248 "//y2024_swerve/constants:constants_fbs",
249 "//frc971/orin:hardware_stats_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700250 "//frc971/vision:calibration_fbs",
251 "//frc971/vision:target_map_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700252 "//frc971/vision:vision_fbs",
253 "//aos/util:filesystem_fbs",
254 "@com_github_foxglove_schemas//:schemas",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700255 ],
256 target_compatible_with = ["@platforms//os:linux"],
257 visibility = ["//visibility:public"],
258 deps = [
259 "//aos/events:aos_config",
260 "//frc971/control_loops/drivetrain:aos_config",
261 "//frc971/input:aos_config",
262 ],
263)