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