James Kuszmaul | f01da39 | 2023-12-14 11:22:14 -0800 | [diff] [blame] | 1 | load("//aos/flatbuffers:generate.bzl", "static_flatbuffer") |
Maxwell Henderson | f63a0d9 | 2023-06-24 14:49:51 -0700 | [diff] [blame] | 2 | load("//frc971:downloader.bzl", "robot_downloader") |
| 3 | load("//aos:config.bzl", "aos_config") |
| 4 | load("//aos/util:config_validator_macro.bzl", "config_validator_test") |
| 5 | |
| 6 | config_validator_test( |
| 7 | name = "config_validator_test", |
Nikolai Sohmers | 3cc1fc2 | 2024-05-04 12:27:58 -0700 | [diff] [blame] | 8 | config = "//y2024_swerve:aos_config", |
Maxwell Henderson | f63a0d9 | 2023-06-24 14:49:51 -0700 | [diff] [blame] | 9 | ) |
| 10 | |
| 11 | robot_downloader( |
| 12 | binaries = [ |
| 13 | "//aos/network:web_proxy_main", |
| 14 | "//aos/events/logging:log_cat", |
| 15 | "//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 | ], |
| 25 | start_binaries = [ |
| 26 | "//aos/events/logging:logger_main", |
| 27 | "//aos/network:web_proxy_main", |
| 28 | "//aos/starter:irq_affinity", |
| 29 | ":wpilib_interface", |
| 30 | ":swerve_publisher", |
| 31 | "//frc971/can_logger", |
| 32 | "//aos/network:message_bridge_client", |
| 33 | "//aos/network:message_bridge_server", |
| 34 | ], |
| 35 | target_compatible_with = ["@platforms//os:linux"], |
| 36 | ) |
| 37 | |
| 38 | robot_downloader( |
| 39 | name = "pi_download", |
| 40 | binaries = [ |
| 41 | "//aos/util:foxglove_websocket", |
| 42 | "//aos/events:aos_timing_report_streamer", |
| 43 | "//aos/events/logging:log_cat", |
| 44 | "//y2023/rockpi:imu_main", |
| 45 | "//frc971/image_streamer:image_streamer", |
| 46 | "//aos/network:message_bridge_client", |
| 47 | "//aos/network:message_bridge_server", |
| 48 | "//aos/network:web_proxy_main", |
| 49 | "//aos/starter:irq_affinity", |
| 50 | "//aos/events/logging:logger_main", |
| 51 | ], |
| 52 | data = [ |
| 53 | ":aos_config", |
| 54 | "//frc971/rockpi:rockpi_config.json", |
| 55 | ], |
| 56 | start_binaries = [ |
| 57 | ], |
| 58 | target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"], |
| 59 | target_type = "pi", |
| 60 | ) |
| 61 | |
| 62 | filegroup( |
| 63 | name = "swerve_publisher_output_json", |
| 64 | srcs = [ |
| 65 | "swerve_drivetrain_output.json", |
| 66 | ], |
Nikolai Sohmers | 3cc1fc2 | 2024-05-04 12:27:58 -0700 | [diff] [blame] | 67 | visibility = ["//y2024_swerve:__subpackages__"], |
Maxwell Henderson | f63a0d9 | 2023-06-24 14:49:51 -0700 | [diff] [blame] | 68 | ) |
| 69 | |
| 70 | cc_library( |
| 71 | name = "constants", |
| 72 | srcs = ["constants.cc"], |
| 73 | hdrs = [ |
| 74 | "constants.h", |
| 75 | ], |
| 76 | visibility = ["//visibility:public"], |
| 77 | deps = [ |
| 78 | "//aos/network:team_number", |
| 79 | "//frc971:constants", |
| 80 | ], |
| 81 | ) |
| 82 | |
James Kuszmaul | f01da39 | 2023-12-14 11:22:14 -0800 | [diff] [blame] | 83 | static_flatbuffer( |
Maxwell Henderson | f63a0d9 | 2023-06-24 14:49:51 -0700 | [diff] [blame] | 84 | name = "drivetrain_position_fbs", |
| 85 | srcs = ["drivetrain_position.fbs"], |
Maxwell Henderson | f63a0d9 | 2023-06-24 14:49:51 -0700 | [diff] [blame] | 86 | deps = ["//frc971/control_loops:control_loops_fbs"], |
| 87 | ) |
| 88 | |
James Kuszmaul | f01da39 | 2023-12-14 11:22:14 -0800 | [diff] [blame] | 89 | static_flatbuffer( |
Maxwell Henderson | f63a0d9 | 2023-06-24 14:49:51 -0700 | [diff] [blame] | 90 | name = "drivetrain_can_position_fbs", |
| 91 | srcs = ["drivetrain_can_position.fbs"], |
Maxwell Henderson | 10ed5c3 | 2024-01-09 12:40:54 -0800 | [diff] [blame] | 92 | deps = ["//frc971/control_loops:can_talonfx_fbs"], |
Maxwell Henderson | f63a0d9 | 2023-06-24 14:49:51 -0700 | [diff] [blame] | 93 | ) |
| 94 | |
| 95 | cc_binary( |
| 96 | name = "swerve_publisher", |
| 97 | srcs = ["swerve_publisher_main.cc"], |
| 98 | deps = [ |
| 99 | ":swerve_publisher_lib", |
| 100 | "//aos/events:shm_event_loop", |
| 101 | "@com_github_gflags_gflags//:gflags", |
| 102 | ], |
| 103 | ) |
| 104 | |
| 105 | cc_library( |
| 106 | name = "swerve_publisher_lib", |
| 107 | srcs = ["swerve_publisher_lib.cc"], |
| 108 | hdrs = ["swerve_publisher_lib.h"], |
| 109 | deps = [ |
| 110 | "//aos:init", |
| 111 | "//aos/events:event_loop", |
| 112 | "//frc971/control_loops/drivetrain/swerve:swerve_drivetrain_output_fbs", |
| 113 | "@com_github_google_glog//:glog", |
| 114 | ], |
| 115 | ) |
| 116 | |
| 117 | cc_test( |
| 118 | name = "swerve_publisher_lib_test", |
| 119 | srcs = [ |
| 120 | "swerve_publisher_lib_test.cc", |
| 121 | ], |
| 122 | data = [ |
| 123 | ":aos_config", |
| 124 | ":swerve_publisher_output_json", |
| 125 | ], |
| 126 | deps = [ |
| 127 | ":swerve_publisher_lib", |
| 128 | "//aos/events:simulated_event_loop", |
| 129 | "//aos/testing:googletest", |
| 130 | ], |
| 131 | ) |
| 132 | |
| 133 | cc_binary( |
| 134 | name = "wpilib_interface", |
| 135 | srcs = ["wpilib_interface.cc"], |
| 136 | target_compatible_with = ["//tools/platforms/hardware:roborio"], |
| 137 | deps = [ |
| 138 | ":constants", |
| 139 | ":drivetrain_can_position_fbs", |
| 140 | ":drivetrain_position_fbs", |
| 141 | "//aos:init", |
| 142 | "//aos/events:shm_event_loop", |
| 143 | "//frc971/control_loops:control_loops_fbs", |
| 144 | "//frc971/wpilib:can_sensor_reader", |
Maxwell Henderson | f63a0d9 | 2023-06-24 14:49:51 -0700 | [diff] [blame] | 145 | "//frc971/wpilib:sensor_reader", |
Maxwell Henderson | 10ed5c3 | 2024-01-09 12:40:54 -0800 | [diff] [blame] | 146 | "//frc971/wpilib:talonfx", |
Maxwell Henderson | f63a0d9 | 2023-06-24 14:49:51 -0700 | [diff] [blame] | 147 | "//frc971/wpilib:wpilib_robot_base", |
| 148 | "//frc971/wpilib/swerve:swerve_drivetrain_writer", |
| 149 | ], |
| 150 | ) |
| 151 | |
| 152 | aos_config( |
| 153 | name = "aos_config", |
Nikolai Sohmers | 3cc1fc2 | 2024-05-04 12:27:58 -0700 | [diff] [blame] | 154 | src = "y2024_swerve.json", |
Maxwell Henderson | f63a0d9 | 2023-06-24 14:49:51 -0700 | [diff] [blame] | 155 | flatbuffers = [ |
| 156 | "//aos/network:message_bridge_client_fbs", |
| 157 | "//aos/network:message_bridge_server_fbs", |
| 158 | "//aos/network:timestamp_fbs", |
| 159 | "//frc971/input:robot_state_fbs", |
| 160 | ], |
| 161 | target_compatible_with = ["@platforms//os:linux"], |
| 162 | visibility = ["//visibility:public"], |
| 163 | deps = [ |
| 164 | ":config_imu", |
| 165 | ":config_logger", |
| 166 | ":config_roborio", |
| 167 | ], |
| 168 | ) |
| 169 | |
| 170 | aos_config( |
| 171 | name = "config_roborio", |
Nikolai Sohmers | 3cc1fc2 | 2024-05-04 12:27:58 -0700 | [diff] [blame] | 172 | src = "y2024_swerve_roborio.json", |
Maxwell Henderson | f63a0d9 | 2023-06-24 14:49:51 -0700 | [diff] [blame] | 173 | flatbuffers = [ |
| 174 | ":drivetrain_position_fbs", |
| 175 | ":drivetrain_can_position_fbs", |
| 176 | "//frc971:can_configuration_fbs", |
| 177 | "//aos/network:remote_message_fbs", |
| 178 | "//aos/network:message_bridge_client_fbs", |
| 179 | "//aos/network:message_bridge_server_fbs", |
| 180 | "//aos/network:timestamp_fbs", |
| 181 | "//frc971/control_loops/drivetrain/swerve:swerve_drivetrain_output_fbs", |
| 182 | "//frc971/control_loops/drivetrain/swerve:swerve_drivetrain_position_fbs", |
| 183 | "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs", |
| 184 | "//frc971/can_logger:can_logging_fbs", |
| 185 | ], |
| 186 | target_compatible_with = ["@platforms//os:linux"], |
| 187 | deps = [ |
| 188 | "//aos/events:aos_config", |
| 189 | "//frc971/autonomous:aos_config", |
| 190 | "//frc971/control_loops/drivetrain:aos_config", |
| 191 | "//frc971/input:aos_config", |
| 192 | "//frc971/wpilib:aos_config", |
| 193 | ], |
| 194 | ) |
| 195 | |
| 196 | aos_config( |
| 197 | name = "config_imu", |
Nikolai Sohmers | 3cc1fc2 | 2024-05-04 12:27:58 -0700 | [diff] [blame] | 198 | src = "y2024_swerve_imu.json", |
Maxwell Henderson | f63a0d9 | 2023-06-24 14:49:51 -0700 | [diff] [blame] | 199 | flatbuffers = [ |
| 200 | "//aos/network:message_bridge_client_fbs", |
| 201 | "//aos/network:message_bridge_server_fbs", |
| 202 | "//aos/network:timestamp_fbs", |
| 203 | "//aos/network:remote_message_fbs", |
| 204 | "//frc971/vision:target_map_fbs", |
| 205 | ], |
| 206 | target_compatible_with = ["@platforms//os:linux"], |
| 207 | visibility = ["//visibility:public"], |
| 208 | deps = [ |
| 209 | "//aos/events:aos_config", |
| 210 | "//frc971/control_loops/drivetrain:aos_config", |
| 211 | ], |
| 212 | ) |
| 213 | |
| 214 | aos_config( |
| 215 | name = "config_logger", |
Nikolai Sohmers | 3cc1fc2 | 2024-05-04 12:27:58 -0700 | [diff] [blame] | 216 | src = "y2024_swerve_logger.json", |
Maxwell Henderson | f63a0d9 | 2023-06-24 14:49:51 -0700 | [diff] [blame] | 217 | flatbuffers = [ |
| 218 | "//aos/network:message_bridge_client_fbs", |
| 219 | "//aos/network:message_bridge_server_fbs", |
| 220 | "//aos/network:timestamp_fbs", |
| 221 | "//aos/network:remote_message_fbs", |
| 222 | "//frc971/vision:calibration_fbs", |
| 223 | "//frc971/vision:target_map_fbs", |
| 224 | ], |
| 225 | target_compatible_with = ["@platforms//os:linux"], |
| 226 | visibility = ["//visibility:public"], |
| 227 | deps = [ |
| 228 | "//aos/events:aos_config", |
| 229 | "//frc971/control_loops/drivetrain:aos_config", |
| 230 | "//frc971/input:aos_config", |
| 231 | ], |
| 232 | ) |