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