blob: b24c469da6a6edb8c19cd5e7e00beb9fcd868d91 [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",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070071 "//aos/network:message_bridge_client",
72 "//aos/network:message_bridge_server",
73 "//aos/network:web_proxy_main",
74 "//aos/starter:irq_affinity",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070075 "//frc971/orin:argus_camera",
76 "//y2024_swerve/vision:apriltag_detector",
77 "//frc971/vision:image_logger",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070078 ],
79 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
80 target_type = "pi",
81)
82
83filegroup(
84 name = "swerve_publisher_output_json",
85 srcs = [
86 "swerve_drivetrain_output.json",
87 ],
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -070088 visibility = ["//y2024_swerve:__subpackages__"],
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070089)
90
91cc_library(
92 name = "constants",
93 srcs = ["constants.cc"],
94 hdrs = [
95 "constants.h",
96 ],
97 visibility = ["//visibility:public"],
98 deps = [
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070099 "//aos/mutex",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700100 "//aos/network:team_number",
101 "//frc971:constants",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700102 "//y2024_swerve/constants:constants_fbs",
103 "@com_github_google_glog//:glog",
104 "@com_google_absl//absl/base",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700105 ],
106)
107
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700108cc_binary(
109 name = "swerve_publisher",
110 srcs = ["swerve_publisher_main.cc"],
111 deps = [
112 ":swerve_publisher_lib",
113 "//aos/events:shm_event_loop",
114 "@com_github_gflags_gflags//:gflags",
115 ],
116)
117
118cc_library(
119 name = "swerve_publisher_lib",
120 srcs = ["swerve_publisher_lib.cc"],
121 hdrs = ["swerve_publisher_lib.h"],
122 deps = [
123 "//aos:init",
124 "//aos/events:event_loop",
James Kuszmauld938d332024-05-15 20:47:19 -0700125 "//frc971/control_loops/swerve:swerve_drivetrain_output_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700126 "@com_github_google_glog//:glog",
127 ],
128)
129
130cc_test(
131 name = "swerve_publisher_lib_test",
132 srcs = [
133 "swerve_publisher_lib_test.cc",
134 ],
135 data = [
136 ":aos_config",
137 ":swerve_publisher_output_json",
138 ],
139 deps = [
140 ":swerve_publisher_lib",
141 "//aos/events:simulated_event_loop",
142 "//aos/testing:googletest",
143 ],
144)
145
146cc_binary(
147 name = "wpilib_interface",
148 srcs = ["wpilib_interface.cc"],
149 target_compatible_with = ["//tools/platforms/hardware:roborio"],
150 deps = [
151 ":constants",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700152 "//aos:init",
153 "//aos/events:shm_event_loop",
154 "//frc971/control_loops:control_loops_fbs",
Nikolai Sohmers3f2a5072024-06-08 14:05:59 -0700155 "//frc971/control_loops/swerve:swerve_drivetrain_can_position_fbs",
James Kuszmauld938d332024-05-15 20:47:19 -0700156 "//frc971/control_loops/swerve:swerve_drivetrain_position_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700157 "//frc971/wpilib:can_sensor_reader",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700158 "//frc971/wpilib:sensor_reader",
Maxwell Henderson10ed5c32024-01-09 12:40:54 -0800159 "//frc971/wpilib:talonfx",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700160 "//frc971/wpilib:wpilib_robot_base",
161 "//frc971/wpilib/swerve:swerve_drivetrain_writer",
162 ],
163)
164
165aos_config(
166 name = "aos_config",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -0700167 src = "y2024_swerve.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700168 flatbuffers = [
169 "//aos/network:message_bridge_client_fbs",
170 "//aos/network:message_bridge_server_fbs",
171 "//aos/network:timestamp_fbs",
172 "//frc971/input:robot_state_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700173 "//frc971/vision:vision_fbs",
174 "//frc971/vision:target_map_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700175 ],
176 target_compatible_with = ["@platforms//os:linux"],
177 visibility = ["//visibility:public"],
178 deps = [
179 ":config_imu",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700180 ":config_orin1",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700181 ":config_roborio",
182 ],
183)
184
185aos_config(
186 name = "config_roborio",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -0700187 src = "y2024_swerve_roborio.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700188 flatbuffers = [
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700189 "//frc971:can_configuration_fbs",
190 "//aos/network:remote_message_fbs",
191 "//aos/network:message_bridge_client_fbs",
192 "//aos/network:message_bridge_server_fbs",
193 "//aos/network:timestamp_fbs",
James Kuszmauld938d332024-05-15 20:47:19 -0700194 "//frc971/control_loops/swerve:swerve_drivetrain_output_fbs",
195 "//frc971/control_loops/swerve:swerve_drivetrain_position_fbs",
Nikolai Sohmers3f2a5072024-06-08 14:05:59 -0700196 "//frc971/control_loops/swerve:swerve_drivetrain_can_position_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700197 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
198 "//frc971/can_logger:can_logging_fbs",
199 ],
200 target_compatible_with = ["@platforms//os:linux"],
201 deps = [
202 "//aos/events:aos_config",
203 "//frc971/autonomous:aos_config",
204 "//frc971/control_loops/drivetrain:aos_config",
205 "//frc971/input:aos_config",
206 "//frc971/wpilib:aos_config",
207 ],
208)
209
210aos_config(
211 name = "config_imu",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -0700212 src = "y2024_swerve_imu.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700213 flatbuffers = [
214 "//aos/network:message_bridge_client_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700215 "//y2024_swerve/constants:constants_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700216 "//aos/network:message_bridge_server_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700217 "//frc971/imu_fdcan:dual_imu_fbs",
218 "//frc971/imu_fdcan:can_translator_status_fbs",
219 "//frc971/imu_fdcan:dual_imu_blender_status_fbs",
220 "//frc971/can_logger:can_logging_fbs",
221 "//frc971/orin:hardware_stats_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700222 "//aos/network:timestamp_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700223 "//aos/util:filesystem_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700224 "//aos/network:remote_message_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700225 "//frc971/vision:calibration_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700226 "//frc971/vision:target_map_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700227 "//frc971/vision:vision_fbs",
228 "@com_github_foxglove_schemas//:schemas",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700229 ],
230 target_compatible_with = ["@platforms//os:linux"],
231 visibility = ["//visibility:public"],
232 deps = [
233 "//aos/events:aos_config",
234 "//frc971/control_loops/drivetrain:aos_config",
235 ],
236)
237
238aos_config(
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700239 name = "config_orin1",
240 src = "y2024_swerve_orin1.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700241 flatbuffers = [
242 "//aos/network:message_bridge_client_fbs",
243 "//aos/network:message_bridge_server_fbs",
244 "//aos/network:timestamp_fbs",
245 "//aos/network:remote_message_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700246 "//y2024_swerve/constants:constants_fbs",
247 "//frc971/orin:hardware_stats_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700248 "//frc971/vision:calibration_fbs",
249 "//frc971/vision:target_map_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700250 "//frc971/vision:vision_fbs",
251 "//aos/util:filesystem_fbs",
252 "@com_github_foxglove_schemas//:schemas",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700253 ],
254 target_compatible_with = ["@platforms//os:linux"],
255 visibility = ["//visibility:public"],
256 deps = [
257 "//aos/events:aos_config",
258 "//frc971/control_loops/drivetrain:aos_config",
259 "//frc971/input:aos_config",
260 ],
261)