blob: 2357c6e1890beb64def6a556eaf22facdff89abf [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",
Nikolai Sohmers308c8992024-06-22 15:11:05 -070035 "//y2024_swerve/control_loops:swerve_control_loops",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070036 "//frc971/can_logger",
37 "//aos/network:message_bridge_client",
38 "//aos/network:message_bridge_server",
39 ],
40 target_compatible_with = ["@platforms//os:linux"],
41)
42
43robot_downloader(
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070044 name = "orin_download",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070045 binaries = [
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070046 "//aos/events:aos_timing_report_streamer",
47 "//aos/events/logging:log_cat",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070048 "//aos:aos_jitter",
49 "//aos/network:web_proxy_main",
50 "//aos/starter:irq_affinity",
51 "//aos/util:foxglove_websocket",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070052 "//frc971/image_streamer:image_streamer",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070053 "//frc971/orin:hardware_monitor",
54 "//frc971/orin:argus_monitor",
55 "//frc971/vision:intrinsics_calibration",
56 "//aos/util:filesystem_monitor",
57 "//y2024_swerve/constants:constants_sender",
58 "//frc971/vision:foxglove_image_converter",
59 ],
60 data = [
61 ":aos_config",
62 "//frc971/orin:orin_irq_config.json",
63 "//y2024/www:www_files",
64 "//y2024_swerve/constants:constants.json",
65 ],
66 dirs = [
67 "//y2024/www:www_files",
68 ],
69 start_binaries = [
70 "//aos/events/logging:logger_main",
71 "//frc971/imu_fdcan:can_translator",
72 "//frc971/imu_fdcan:dual_imu_blender",
James Kuszmaul5e53ab52024-06-22 14:08:42 -070073 "//frc971/orin:localizer_logger",
James Kuszmauld7c028f2024-06-19 19:59:56 -070074 "//frc971/can_logger",
James Kuszmaulcf2cf532024-06-22 14:02:48 -070075 "//frc971/wpilib:joystick_republish",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070076 "//aos/network:message_bridge_client",
77 "//aos/network:message_bridge_server",
78 "//aos/network:web_proxy_main",
79 "//aos/starter:irq_affinity",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -070080 "//frc971/orin:argus_camera",
81 "//y2024_swerve/vision:apriltag_detector",
82 "//frc971/vision:image_logger",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070083 ],
84 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
85 target_type = "pi",
86)
87
88filegroup(
James Kuszmauleaba6d92024-07-31 20:42:20 -070089 name = "swerve_publisher_goal_json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070090 srcs = [
James Kuszmauleaba6d92024-07-31 20:42:20 -070091 "swerve_drivetrain_goal.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070092 ],
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -070093 visibility = ["//y2024_swerve:__subpackages__"],
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -070094)
95
96cc_library(
97 name = "constants",
98 srcs = ["constants.cc"],
99 hdrs = [
100 "constants.h",
101 ],
102 visibility = ["//visibility:public"],
103 deps = [
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700104 "//aos/mutex",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700105 "//aos/network:team_number",
106 "//frc971:constants",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700107 "//y2024_swerve/constants:constants_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700108 "@com_google_absl//absl/base",
Austin Schuh99f7c6a2024-06-25 22:07:44 -0700109 "@com_google_absl//absl/log",
110 "@com_google_absl//absl/log:check",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700111 ],
112)
113
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700114cc_binary(
115 name = "swerve_publisher",
116 srcs = ["swerve_publisher_main.cc"],
117 deps = [
118 ":swerve_publisher_lib",
119 "//aos/events:shm_event_loop",
Austin Schuh99f7c6a2024-06-25 22:07:44 -0700120 "@com_google_absl//absl/flags:flag",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700121 ],
122)
123
124cc_library(
125 name = "swerve_publisher_lib",
126 srcs = ["swerve_publisher_lib.cc"],
127 hdrs = ["swerve_publisher_lib.h"],
128 deps = [
129 "//aos:init",
130 "//aos/events:event_loop",
James Kuszmauleaba6d92024-07-31 20:42:20 -0700131 "//frc971/control_loops/swerve:swerve_drivetrain_goal_fbs",
Austin Schuh99f7c6a2024-06-25 22:07:44 -0700132 "@com_google_absl//absl/log",
133 "@com_google_absl//absl/log:check",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700134 ],
135)
136
137cc_test(
138 name = "swerve_publisher_lib_test",
139 srcs = [
140 "swerve_publisher_lib_test.cc",
141 ],
142 data = [
143 ":aos_config",
James Kuszmauleaba6d92024-07-31 20:42:20 -0700144 ":swerve_publisher_goal_json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700145 ],
146 deps = [
147 ":swerve_publisher_lib",
148 "//aos/events:simulated_event_loop",
149 "//aos/testing:googletest",
150 ],
151)
152
153cc_binary(
154 name = "wpilib_interface",
155 srcs = ["wpilib_interface.cc"],
156 target_compatible_with = ["//tools/platforms/hardware:roborio"],
157 deps = [
158 ":constants",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700159 "//aos:init",
160 "//aos/events:shm_event_loop",
Nikolai Sohmersce9ee6e2024-07-06 17:16:20 -0700161 "//frc971/constants:constants_sender_lib",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700162 "//frc971/control_loops:control_loops_fbs",
Nikolai Sohmers3f2a5072024-06-08 14:05:59 -0700163 "//frc971/control_loops/swerve:swerve_drivetrain_can_position_fbs",
James Kuszmauld938d332024-05-15 20:47:19 -0700164 "//frc971/control_loops/swerve:swerve_drivetrain_position_fbs",
James Kuszmaul6e445c42024-07-06 13:06:23 -0700165 "//frc971/queues:gyro_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700166 "//frc971/wpilib:can_sensor_reader",
James Kuszmaulf40b6772024-06-22 16:04:03 -0700167 "//frc971/wpilib:joystick_sender",
168 "//frc971/wpilib:pdp_fetcher",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700169 "//frc971/wpilib:sensor_reader",
Maxwell Henderson10ed5c32024-01-09 12:40:54 -0800170 "//frc971/wpilib:talonfx",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700171 "//frc971/wpilib:wpilib_robot_base",
172 "//frc971/wpilib/swerve:swerve_drivetrain_writer",
Nikolai Sohmersce9ee6e2024-07-06 17:16:20 -0700173 "//y2024_swerve/constants:constants_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700174 ],
175)
176
177aos_config(
178 name = "aos_config",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -0700179 src = "y2024_swerve.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700180 flatbuffers = [
181 "//aos/network:message_bridge_client_fbs",
182 "//aos/network:message_bridge_server_fbs",
183 "//aos/network:timestamp_fbs",
184 "//frc971/input:robot_state_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700185 "//frc971/vision:vision_fbs",
186 "//frc971/vision:target_map_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700187 ],
188 target_compatible_with = ["@platforms//os:linux"],
189 visibility = ["//visibility:public"],
190 deps = [
191 ":config_imu",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700192 ":config_orin1",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700193 ":config_roborio",
194 ],
195)
196
197aos_config(
198 name = "config_roborio",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -0700199 src = "y2024_swerve_roborio.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700200 flatbuffers = [
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700201 "//frc971:can_configuration_fbs",
Nikolai Sohmersc4fce5d2024-06-15 19:46:46 -0500202 "//frc971/queues:gyro_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700203 "//aos/network:remote_message_fbs",
204 "//aos/network:message_bridge_client_fbs",
205 "//aos/network:message_bridge_server_fbs",
206 "//aos/network:timestamp_fbs",
Nikolai Sohmersc4fce5d2024-06-15 19:46:46 -0500207 "//frc971/control_loops/swerve:swerve_drivetrain_goal_fbs",
208 "//frc971/control_loops/swerve:swerve_drivetrain_status_fbs",
James Kuszmauld938d332024-05-15 20:47:19 -0700209 "//frc971/control_loops/swerve:swerve_drivetrain_output_fbs",
210 "//frc971/control_loops/swerve:swerve_drivetrain_position_fbs",
Nikolai Sohmersc4fce5d2024-06-15 19:46:46 -0500211 "//y2024_swerve/constants:constants_fbs",
Nikolai Sohmers3f2a5072024-06-08 14:05:59 -0700212 "//frc971/control_loops/swerve:swerve_drivetrain_can_position_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700213 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
214 "//frc971/can_logger:can_logging_fbs",
215 ],
216 target_compatible_with = ["@platforms//os:linux"],
217 deps = [
218 "//aos/events:aos_config",
219 "//frc971/autonomous:aos_config",
220 "//frc971/control_loops/drivetrain:aos_config",
221 "//frc971/input:aos_config",
222 "//frc971/wpilib:aos_config",
223 ],
224)
225
226aos_config(
227 name = "config_imu",
Nikolai Sohmers3cc1fc22024-05-04 12:27:58 -0700228 src = "y2024_swerve_imu.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700229 flatbuffers = [
230 "//aos/network:message_bridge_client_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700231 "//y2024_swerve/constants:constants_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700232 "//aos/network:message_bridge_server_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700233 "//frc971/imu_fdcan:dual_imu_fbs",
234 "//frc971/imu_fdcan:can_translator_status_fbs",
235 "//frc971/imu_fdcan:dual_imu_blender_status_fbs",
236 "//frc971/can_logger:can_logging_fbs",
237 "//frc971/orin:hardware_stats_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700238 "//aos/network:timestamp_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700239 "//aos/util:filesystem_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700240 "//aos/network:remote_message_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700241 "//frc971/vision:calibration_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700242 "//frc971/vision:target_map_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700243 "//frc971/vision:vision_fbs",
244 "@com_github_foxglove_schemas//:schemas",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700245 ],
246 target_compatible_with = ["@platforms//os:linux"],
247 visibility = ["//visibility:public"],
248 deps = [
249 "//aos/events:aos_config",
250 "//frc971/control_loops/drivetrain:aos_config",
251 ],
252)
253
254aos_config(
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700255 name = "config_orin1",
256 src = "y2024_swerve_orin1.json",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700257 flatbuffers = [
258 "//aos/network:message_bridge_client_fbs",
259 "//aos/network:message_bridge_server_fbs",
260 "//aos/network:timestamp_fbs",
261 "//aos/network:remote_message_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700262 "//y2024_swerve/constants:constants_fbs",
263 "//frc971/orin:hardware_stats_fbs",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700264 "//frc971/vision:calibration_fbs",
265 "//frc971/vision:target_map_fbs",
Nikolai Sohmers74e52ef2024-05-29 10:12:23 -0700266 "//frc971/vision:vision_fbs",
267 "//aos/util:filesystem_fbs",
268 "@com_github_foxglove_schemas//:schemas",
Maxwell Hendersonf63a0d92023-06-24 14:49:51 -0700269 ],
270 target_compatible_with = ["@platforms//os:linux"],
271 visibility = ["//visibility:public"],
272 deps = [
273 "//aos/events:aos_config",
274 "//frc971/control_loops/drivetrain:aos_config",
275 "//frc971/input:aos_config",
276 ],
277)