milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 1 | load("//frc971:downloader.bzl", "robot_downloader") |
| 2 | load("//aos:config.bzl", "aos_config") |
Henry Speiser | 0b9b005 | 2022-03-02 23:07:40 -0800 | [diff] [blame] | 3 | load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library") |
milind-u | f2f59aa | 2022-01-23 21:06:12 -0800 | [diff] [blame] | 4 | load("//tools/build_rules:template.bzl", "jinja2_template") |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 5 | |
| 6 | robot_downloader( |
milind-u | f2f59aa | 2022-01-23 21:06:12 -0800 | [diff] [blame] | 7 | binaries = [ |
Henry Speiser | 0b9b005 | 2022-03-02 23:07:40 -0800 | [diff] [blame] | 8 | ":setpoint_setter", |
milind-u | f2f59aa | 2022-01-23 21:06:12 -0800 | [diff] [blame] | 9 | "//aos/network:web_proxy_main", |
| 10 | ], |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 11 | data = [ |
Austin Schuh | c5fa6d9 | 2022-02-25 14:36:28 -0800 | [diff] [blame] | 12 | ":aos_config", |
Austin Schuh | de605f1 | 2022-02-23 23:08:19 -0800 | [diff] [blame] | 13 | "@ctre_phoenix_api_cpp_athena//:shared_libraries", |
| 14 | "@ctre_phoenix_cci_athena//:shared_libraries", |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 15 | ], |
Austin Schuh | 76f227c | 2022-02-23 16:34:08 -0800 | [diff] [blame] | 16 | dirs = [ |
Ravago Jones | 81e5063 | 2022-03-11 16:23:51 -0800 | [diff] [blame] | 17 | "//y2022/actors:splines", |
Austin Schuh | 76f227c | 2022-02-23 16:34:08 -0800 | [diff] [blame] | 18 | "//y2022/www:www_files", |
| 19 | ], |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 20 | start_binaries = [ |
milind-u | f2f59aa | 2022-01-23 21:06:12 -0800 | [diff] [blame] | 21 | "//aos/events/logging:logger_main", |
| 22 | "//aos/network:web_proxy_main", |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 23 | ":joystick_reader", |
| 24 | ":wpilib_interface", |
milind-u | f2f59aa | 2022-01-23 21:06:12 -0800 | [diff] [blame] | 25 | "//aos/network:message_bridge_client", |
| 26 | "//aos/network:message_bridge_server", |
| 27 | "//y2022/actors:binaries", |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 28 | "//y2022/control_loops/drivetrain:drivetrain", |
Milind Upadhyay | b8abf02 | 2022-02-22 21:07:44 -0800 | [diff] [blame] | 29 | "//y2022/control_loops/drivetrain:trajectory_generator", |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 30 | "//y2022/control_loops/superstructure:superstructure", |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 31 | ], |
milind-u | f2f59aa | 2022-01-23 21:06:12 -0800 | [diff] [blame] | 32 | target_compatible_with = ["@platforms//os:linux"], |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 33 | ) |
| 34 | |
milind-u | 6b6e100 | 2022-01-22 13:26:42 -0800 | [diff] [blame] | 35 | robot_downloader( |
| 36 | name = "pi_download", |
| 37 | binaries = [ |
Jim Ostrowski | b9135a9 | 2022-02-06 22:49:11 -0800 | [diff] [blame] | 38 | "//y2020/vision:calibration", |
milind-u | 6b6e100 | 2022-01-22 13:26:42 -0800 | [diff] [blame] | 39 | "//y2022/vision:viewer", |
Ravago Jones | e12b790 | 2022-02-04 22:50:44 -0800 | [diff] [blame] | 40 | "//y2022/localizer:imu_main", |
James Kuszmaul | 51fa1ae | 2022-02-26 00:49:57 -0800 | [diff] [blame] | 41 | "//y2022/localizer:localizer_main", |
James Kuszmaul | 3eb753d | 2022-03-12 15:21:12 -0800 | [diff] [blame] | 42 | "//y2022/vision:image_decimator", |
milind-u | 6b6e100 | 2022-01-22 13:26:42 -0800 | [diff] [blame] | 43 | ], |
| 44 | data = [ |
Austin Schuh | c5fa6d9 | 2022-02-25 14:36:28 -0800 | [diff] [blame] | 45 | ":aos_config", |
milind-u | 6b6e100 | 2022-01-22 13:26:42 -0800 | [diff] [blame] | 46 | ], |
James Kuszmaul | b35e234 | 2022-03-06 15:44:00 -0800 | [diff] [blame] | 47 | dirs = [ |
| 48 | "//y2022/www:www_files", |
| 49 | ], |
milind-u | 6b6e100 | 2022-01-22 13:26:42 -0800 | [diff] [blame] | 50 | start_binaries = [ |
| 51 | "//aos/events/logging:logger_main", |
| 52 | "//aos/network:message_bridge_client", |
| 53 | "//aos/network:message_bridge_server", |
| 54 | "//aos/network:web_proxy_main", |
| 55 | "//y2022/vision:camera_reader", |
| 56 | ], |
| 57 | target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"], |
| 58 | target_type = "pi", |
| 59 | ) |
| 60 | |
milind-u | f2f59aa | 2022-01-23 21:06:12 -0800 | [diff] [blame] | 61 | aos_config( |
Austin Schuh | c5fa6d9 | 2022-02-25 14:36:28 -0800 | [diff] [blame] | 62 | name = "aos_config", |
milind-u | f2f59aa | 2022-01-23 21:06:12 -0800 | [diff] [blame] | 63 | src = "y2022.json", |
| 64 | flatbuffers = [ |
| 65 | "//aos/network:message_bridge_client_fbs", |
| 66 | "//aos/network:message_bridge_server_fbs", |
| 67 | "//aos/network:timestamp_fbs", |
| 68 | "//frc971/input:robot_state_fbs", |
| 69 | "//frc971/vision:vision_fbs", |
Jim Ostrowski | 007e2ea | 2022-01-30 13:13:26 -0800 | [diff] [blame] | 70 | "//y2022/vision:calibration_fbs", |
milind-u | f2f59aa | 2022-01-23 21:06:12 -0800 | [diff] [blame] | 71 | ], |
| 72 | target_compatible_with = ["@platforms//os:linux"], |
| 73 | visibility = ["//visibility:public"], |
| 74 | deps = [ |
James Kuszmaul | ef35d73 | 2022-02-12 16:37:32 -0800 | [diff] [blame] | 75 | ":config_imu", |
milind-u | f2f59aa | 2022-01-23 21:06:12 -0800 | [diff] [blame] | 76 | ":config_logger", |
| 77 | ":config_pi1", |
| 78 | ":config_pi2", |
| 79 | ":config_pi3", |
| 80 | ":config_pi4", |
milind-u | f2f59aa | 2022-01-23 21:06:12 -0800 | [diff] [blame] | 81 | ":config_roborio", |
| 82 | ], |
| 83 | ) |
| 84 | |
| 85 | [ |
| 86 | aos_config( |
| 87 | name = "config_" + pi, |
| 88 | src = "y2022_" + pi + ".json", |
| 89 | flatbuffers = [ |
| 90 | "//aos/network:message_bridge_client_fbs", |
| 91 | "//aos/network:message_bridge_server_fbs", |
| 92 | "//aos/network:timestamp_fbs", |
| 93 | "//aos/network:remote_message_fbs", |
| 94 | "//frc971/vision:vision_fbs", |
Jim Ostrowski | 007e2ea | 2022-01-30 13:13:26 -0800 | [diff] [blame] | 95 | "//y2022/vision:calibration_fbs", |
milind-u | f2f59aa | 2022-01-23 21:06:12 -0800 | [diff] [blame] | 96 | "//y2022/vision:target_estimate_fbs", |
| 97 | ], |
| 98 | target_compatible_with = ["@platforms//os:linux"], |
| 99 | visibility = ["//visibility:public"], |
| 100 | deps = [ |
Austin Schuh | c5fa6d9 | 2022-02-25 14:36:28 -0800 | [diff] [blame] | 101 | "//aos/events:aos_config", |
| 102 | "//frc971/control_loops/drivetrain:aos_config", |
| 103 | "//frc971/input:aos_config", |
milind-u | f2f59aa | 2022-01-23 21:06:12 -0800 | [diff] [blame] | 104 | ], |
| 105 | ) |
| 106 | for pi in [ |
| 107 | "pi1", |
| 108 | "pi2", |
| 109 | "pi3", |
| 110 | "pi4", |
milind-u | f2f59aa | 2022-01-23 21:06:12 -0800 | [diff] [blame] | 111 | ] |
| 112 | ] |
| 113 | |
| 114 | aos_config( |
James Kuszmaul | ef35d73 | 2022-02-12 16:37:32 -0800 | [diff] [blame] | 115 | name = "config_imu", |
| 116 | src = "y2022_imu.json", |
| 117 | flatbuffers = [ |
| 118 | "//aos/network:message_bridge_client_fbs", |
| 119 | "//aos/network:message_bridge_server_fbs", |
| 120 | "//aos/network:timestamp_fbs", |
| 121 | "//aos/network:remote_message_fbs", |
James Kuszmaul | 51fa1ae | 2022-02-26 00:49:57 -0800 | [diff] [blame] | 122 | "//y2022/localizer:localizer_status_fbs", |
| 123 | "//y2022/localizer:localizer_output_fbs", |
James Kuszmaul | 0dedb5e | 2022-03-05 16:02:20 -0800 | [diff] [blame] | 124 | "//y2022/localizer:localizer_visualization_fbs", |
James Kuszmaul | ef35d73 | 2022-02-12 16:37:32 -0800 | [diff] [blame] | 125 | ], |
| 126 | target_compatible_with = ["@platforms//os:linux"], |
| 127 | visibility = ["//visibility:public"], |
| 128 | deps = [ |
Austin Schuh | c5fa6d9 | 2022-02-25 14:36:28 -0800 | [diff] [blame] | 129 | "//aos/events:aos_config", |
| 130 | "//frc971/control_loops/drivetrain:aos_config", |
James Kuszmaul | ef35d73 | 2022-02-12 16:37:32 -0800 | [diff] [blame] | 131 | ], |
| 132 | ) |
| 133 | |
| 134 | aos_config( |
milind-u | f2f59aa | 2022-01-23 21:06:12 -0800 | [diff] [blame] | 135 | name = "config_logger", |
| 136 | src = "y2022_logger.json", |
| 137 | flatbuffers = [ |
| 138 | "//aos/network:message_bridge_client_fbs", |
| 139 | "//aos/network:message_bridge_server_fbs", |
| 140 | "//aos/network:timestamp_fbs", |
| 141 | "//aos/network:remote_message_fbs", |
| 142 | "//frc971/vision:vision_fbs", |
Jim Ostrowski | 007e2ea | 2022-01-30 13:13:26 -0800 | [diff] [blame] | 143 | "//y2022/vision:calibration_fbs", |
milind-u | f2f59aa | 2022-01-23 21:06:12 -0800 | [diff] [blame] | 144 | ], |
| 145 | target_compatible_with = ["@platforms//os:linux"], |
| 146 | visibility = ["//visibility:public"], |
| 147 | deps = [ |
Austin Schuh | c5fa6d9 | 2022-02-25 14:36:28 -0800 | [diff] [blame] | 148 | "//aos/events:aos_config", |
| 149 | "//frc971/control_loops/drivetrain:aos_config", |
| 150 | "//frc971/input:aos_config", |
milind-u | f2f59aa | 2022-01-23 21:06:12 -0800 | [diff] [blame] | 151 | ], |
| 152 | ) |
| 153 | |
| 154 | aos_config( |
| 155 | name = "config_roborio", |
| 156 | src = "y2022_roborio.json", |
| 157 | flatbuffers = [ |
Henry Speiser | 0b9b005 | 2022-03-02 23:07:40 -0800 | [diff] [blame] | 158 | ":setpoint_fbs", |
milind-u | f2f59aa | 2022-01-23 21:06:12 -0800 | [diff] [blame] | 159 | "//aos/network:remote_message_fbs", |
| 160 | "//aos/network:message_bridge_client_fbs", |
| 161 | "//aos/network:message_bridge_server_fbs", |
| 162 | "//aos/network:timestamp_fbs", |
| 163 | "//y2019/control_loops/drivetrain:target_selector_fbs", |
| 164 | "//y2022/control_loops/superstructure:superstructure_goal_fbs", |
| 165 | "//y2022/control_loops/superstructure:superstructure_output_fbs", |
| 166 | "//y2022/control_loops/superstructure:superstructure_position_fbs", |
Milind Upadhyay | 482b0ba | 2022-02-26 21:51:59 -0800 | [diff] [blame] | 167 | "//y2022/control_loops/superstructure:superstructure_can_position_fbs", |
milind-u | f2f59aa | 2022-01-23 21:06:12 -0800 | [diff] [blame] | 168 | "//y2022/control_loops/superstructure:superstructure_status_fbs", |
| 169 | ], |
| 170 | target_compatible_with = ["@platforms//os:linux"], |
| 171 | deps = [ |
Austin Schuh | c5fa6d9 | 2022-02-25 14:36:28 -0800 | [diff] [blame] | 172 | "//aos/events:aos_config", |
| 173 | "//frc971/autonomous:aos_config", |
| 174 | "//frc971/control_loops/drivetrain:aos_config", |
| 175 | "//frc971/input:aos_config", |
| 176 | "//frc971/wpilib:aos_config", |
milind-u | f2f59aa | 2022-01-23 21:06:12 -0800 | [diff] [blame] | 177 | ], |
| 178 | ) |
| 179 | |
| 180 | [ |
| 181 | jinja2_template( |
| 182 | name = "y2022_pi" + str(num) + ".json", |
| 183 | src = "y2022_pi_template.json", |
| 184 | parameters = {"NUM": str(num)}, |
| 185 | target_compatible_with = ["@platforms//os:linux"], |
| 186 | ) |
| 187 | for num in range(1, 6) |
| 188 | ] |
| 189 | |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 190 | cc_library( |
| 191 | name = "constants", |
| 192 | srcs = [ |
| 193 | "constants.cc", |
| 194 | ], |
| 195 | hdrs = [ |
| 196 | "constants.h", |
| 197 | ], |
| 198 | visibility = ["//visibility:public"], |
| 199 | deps = [ |
| 200 | "//aos/mutex", |
| 201 | "//aos/network:team_number", |
| 202 | "//frc971:constants", |
| 203 | "//frc971/control_loops:pose", |
| 204 | "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem", |
| 205 | "//y2022/control_loops/drivetrain:polydrivetrain_plants", |
Austin Schuh | 39f26f6 | 2022-02-24 21:34:46 -0800 | [diff] [blame] | 206 | "//y2022/control_loops/superstructure/catapult:catapult_plants", |
Siddhant Kanwar | 0e37f59 | 2022-02-21 19:26:50 -0800 | [diff] [blame] | 207 | "//y2022/control_loops/superstructure/climber:climber_plants", |
Yash Chainani | 997a749 | 2022-01-29 15:48:56 -0800 | [diff] [blame] | 208 | "//y2022/control_loops/superstructure/intake:intake_plants", |
Henry Speiser | 55aa3ba | 2022-02-21 23:21:12 -0800 | [diff] [blame] | 209 | "//y2022/control_loops/superstructure/turret:turret_plants", |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 210 | "@com_github_google_glog//:glog", |
| 211 | "@com_google_absl//absl/base", |
| 212 | ], |
| 213 | ) |
| 214 | |
| 215 | cc_binary( |
| 216 | name = "wpilib_interface", |
| 217 | srcs = [ |
| 218 | "wpilib_interface.cc", |
| 219 | ], |
| 220 | target_compatible_with = ["//tools/platforms/hardware:roborio"], |
| 221 | deps = [ |
| 222 | ":constants", |
| 223 | "//aos:init", |
| 224 | "//aos:math", |
| 225 | "//aos/events:shm_event_loop", |
| 226 | "//aos/logging", |
| 227 | "//aos/stl_mutex", |
| 228 | "//aos/time", |
| 229 | "//aos/util:log_interval", |
| 230 | "//aos/util:phased_loop", |
| 231 | "//aos/util:wrapping_counter", |
| 232 | "//frc971/autonomous:auto_mode_fbs", |
| 233 | "//frc971/control_loops:control_loop", |
| 234 | "//frc971/control_loops:control_loops_fbs", |
| 235 | "//frc971/control_loops/drivetrain:drivetrain_position_fbs", |
| 236 | "//frc971/input:robot_state_fbs", |
Ravago Jones | 0e86e24 | 2022-02-12 18:38:14 -0800 | [diff] [blame] | 237 | "//frc971/queues:gyro_fbs", |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 238 | "//frc971/wpilib:ADIS16448", |
| 239 | "//frc971/wpilib:buffered_pcm", |
| 240 | "//frc971/wpilib:drivetrain_writer", |
| 241 | "//frc971/wpilib:encoder_and_potentiometer", |
| 242 | "//frc971/wpilib:interrupt_edge_counting", |
| 243 | "//frc971/wpilib:joystick_sender", |
| 244 | "//frc971/wpilib:logging_fbs", |
| 245 | "//frc971/wpilib:loop_output_handler", |
| 246 | "//frc971/wpilib:pdp_fetcher", |
| 247 | "//frc971/wpilib:sensor_reader", |
| 248 | "//frc971/wpilib:wpilib_interface", |
| 249 | "//frc971/wpilib:wpilib_robot_base", |
| 250 | "//third_party:phoenix", |
| 251 | "//third_party:wpilib", |
Milind Upadhyay | 482b0ba | 2022-02-26 21:51:59 -0800 | [diff] [blame] | 252 | "//y2022/control_loops/superstructure:superstructure_can_position_fbs", |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 253 | "//y2022/control_loops/superstructure:superstructure_output_fbs", |
| 254 | "//y2022/control_loops/superstructure:superstructure_position_fbs", |
| 255 | ], |
| 256 | ) |
| 257 | |
| 258 | cc_binary( |
| 259 | name = "joystick_reader", |
| 260 | srcs = [ |
| 261 | ":joystick_reader.cc", |
| 262 | ], |
| 263 | deps = [ |
Henry Speiser | 0b9b005 | 2022-03-02 23:07:40 -0800 | [diff] [blame] | 264 | ":constants", |
| 265 | ":setpoint_fbs", |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 266 | "//aos:init", |
| 267 | "//aos/actions:action_lib", |
| 268 | "//aos/logging", |
| 269 | "//frc971/autonomous:auto_fbs", |
| 270 | "//frc971/autonomous:base_autonomous_actor", |
| 271 | "//frc971/control_loops:profiled_subsystem_fbs", |
| 272 | "//frc971/input:action_joystick_input", |
| 273 | "//frc971/input:drivetrain_input", |
| 274 | "//frc971/input:joystick_input", |
| 275 | "//y2022/control_loops/drivetrain:drivetrain_base", |
| 276 | "//y2022/control_loops/superstructure:superstructure_goal_fbs", |
| 277 | "//y2022/control_loops/superstructure:superstructure_status_fbs", |
| 278 | ], |
| 279 | ) |
Milo Lin | 5d49af0 | 2022-02-05 12:50:32 -0800 | [diff] [blame] | 280 | |
Henry Speiser | 0b9b005 | 2022-03-02 23:07:40 -0800 | [diff] [blame] | 281 | flatbuffer_cc_library( |
| 282 | name = "setpoint_fbs", |
| 283 | srcs = [ |
| 284 | "setpoint.fbs", |
| 285 | ], |
| 286 | gen_reflections = 1, |
| 287 | target_compatible_with = ["@platforms//os:linux"], |
| 288 | ) |
| 289 | |
| 290 | cc_binary( |
| 291 | name = "setpoint_setter", |
| 292 | srcs = ["setpoint_setter.cc"], |
| 293 | target_compatible_with = ["@platforms//os:linux"], |
| 294 | deps = [ |
| 295 | ":constants", |
| 296 | ":setpoint_fbs", |
| 297 | "//aos:init", |
| 298 | "//aos/events:shm_event_loop", |
| 299 | ], |
| 300 | ) |
| 301 | |
Milo Lin | 5d49af0 | 2022-02-05 12:50:32 -0800 | [diff] [blame] | 302 | py_library( |
| 303 | name = "python_init", |
| 304 | srcs = ["__init__.py"], |
| 305 | target_compatible_with = ["@platforms//os:linux"], |
| 306 | visibility = ["//visibility:public"], |
| 307 | ) |
James Kuszmaul | f3ef9e1 | 2022-03-05 17:13:00 -0800 | [diff] [blame] | 308 | |
| 309 | sh_binary( |
| 310 | name = "log_web_proxy", |
| 311 | srcs = ["log_web_proxy.sh"], |
| 312 | data = [ |
| 313 | ":aos_config", |
| 314 | "//aos/network:log_web_proxy_main", |
| 315 | "//y2022/www:field_main_bundle.min.js", |
| 316 | "//y2022/www:files", |
| 317 | ], |
| 318 | target_compatible_with = ["@platforms//os:linux"], |
| 319 | ) |