Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 1 | load("//frc971:downloader.bzl", "robot_downloader") |
| 2 | load("//aos:config.bzl", "aos_config") |
| 3 | load("@com_google_protobuf//:protobuf.bzl", "cc_proto_library") |
| 4 | load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library") |
Austin Schuh | 3a2f4a4 | 2020-09-16 14:10:39 -0700 | [diff] [blame] | 5 | load("//tools/build_rules:template.bzl", "jinja2_template") |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 6 | |
| 7 | robot_downloader( |
Austin Schuh | d58b290 | 2020-03-01 19:28:04 -0800 | [diff] [blame] | 8 | binaries = [ |
| 9 | ":setpoint_setter", |
| 10 | ], |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 11 | data = [ |
Austin Schuh | 14d7d3d | 2020-09-10 18:14:36 -0700 | [diff] [blame] | 12 | ":config", |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 13 | ], |
Ravago Jones | c2a0802 | 2021-02-06 17:40:54 -0800 | [diff] [blame] | 14 | dirs = [ |
| 15 | "//y2020/actors:splines" |
| 16 | ], |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 17 | start_binaries = [ |
James Kuszmaul | 2d8fa2a | 2020-03-01 13:51:50 -0800 | [diff] [blame] | 18 | "//aos/events/logging:logger_main", |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 19 | ":joystick_reader", |
| 20 | ":wpilib_interface", |
Austin Schuh | 6aa77be | 2020-02-22 21:06:40 -0800 | [diff] [blame] | 21 | "//aos/network:message_bridge_client", |
| 22 | "//aos/network:message_bridge_server", |
| 23 | "//y2020/actors:binaries", |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 24 | "//y2020/control_loops/drivetrain:drivetrain", |
| 25 | "//y2020/control_loops/superstructure:superstructure", |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 26 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 27 | target_compatible_with = ["@platforms//os:linux"], |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 28 | ) |
| 29 | |
James Kuszmaul | 2d8fa2a | 2020-03-01 13:51:50 -0800 | [diff] [blame] | 30 | robot_downloader( |
| 31 | name = "pi_download", |
Jim Ostrowski | baa4369 | 2020-03-08 16:25:10 -0700 | [diff] [blame] | 32 | binaries = [ |
| 33 | "//y2020/vision:viewer", |
| 34 | ], |
James Kuszmaul | 2d8fa2a | 2020-03-01 13:51:50 -0800 | [diff] [blame] | 35 | data = [ |
Austin Schuh | 14d7d3d | 2020-09-10 18:14:36 -0700 | [diff] [blame] | 36 | ":config", |
James Kuszmaul | 2d8fa2a | 2020-03-01 13:51:50 -0800 | [diff] [blame] | 37 | ], |
| 38 | dirs = [ |
| 39 | "//y2020/www:www_files", |
| 40 | ], |
James Kuszmaul | 2d8fa2a | 2020-03-01 13:51:50 -0800 | [diff] [blame] | 41 | start_binaries = [ |
| 42 | "//aos/network:message_bridge_client", |
| 43 | "//aos/network:message_bridge_server", |
James Kuszmaul | 2d8fa2a | 2020-03-01 13:51:50 -0800 | [diff] [blame] | 44 | "//aos/network:web_proxy_main", |
Austin Schuh | 393015b | 2020-04-20 17:24:39 -0700 | [diff] [blame] | 45 | "//y2020/vision:camera_reader", |
James Kuszmaul | 2d8fa2a | 2020-03-01 13:51:50 -0800 | [diff] [blame] | 46 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 47 | target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"], |
James Kuszmaul | 2d8fa2a | 2020-03-01 13:51:50 -0800 | [diff] [blame] | 48 | target_type = "pi", |
| 49 | ) |
| 50 | |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 51 | cc_library( |
| 52 | name = "constants", |
| 53 | srcs = [ |
| 54 | "constants.cc", |
| 55 | ], |
| 56 | hdrs = [ |
| 57 | "constants.h", |
| 58 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 59 | target_compatible_with = ["@platforms//os:linux"], |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 60 | visibility = ["//visibility:public"], |
| 61 | deps = [ |
| 62 | "//aos/logging", |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 63 | "//aos/network:team_number", |
Brian Silverman | 1463c09 | 2020-10-30 17:28:24 -0700 | [diff] [blame] | 64 | "//aos/stl_mutex", |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 65 | "//frc971:constants", |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 66 | "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem", |
| 67 | "//y2020/control_loops/drivetrain:polydrivetrain_plants", |
Austin Schuh | 9dcd520 | 2020-02-20 20:06:04 -0800 | [diff] [blame] | 68 | "//y2020/control_loops/superstructure/accelerator:accelerator_plants", |
| 69 | "//y2020/control_loops/superstructure/control_panel:control_panel_plants", |
| 70 | "//y2020/control_loops/superstructure/finisher:finisher_plants", |
Sabina Davis | a587fbd | 2020-01-31 22:11:15 -0800 | [diff] [blame] | 71 | "//y2020/control_loops/superstructure/hood:hood_plants", |
Sabina Davis | e8d3899 | 2020-02-02 15:00:31 -0800 | [diff] [blame] | 72 | "//y2020/control_loops/superstructure/intake:intake_plants", |
Kai Tinkess | 10943cf | 2020-02-01 15:49:57 -0800 | [diff] [blame] | 73 | "//y2020/control_loops/superstructure/turret:turret_plants", |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 74 | "@com_google_absl//absl/base", |
| 75 | ], |
| 76 | ) |
| 77 | |
| 78 | cc_binary( |
| 79 | name = "wpilib_interface", |
| 80 | srcs = [ |
| 81 | "wpilib_interface.cc", |
| 82 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 83 | target_compatible_with = ["//tools/platforms/hardware:roborio"], |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 84 | deps = [ |
| 85 | ":constants", |
| 86 | "//aos:init", |
| 87 | "//aos:make_unique", |
| 88 | "//aos:math", |
| 89 | "//aos/controls:control_loop", |
| 90 | "//aos/events:shm_event_loop", |
| 91 | "//aos/logging", |
| 92 | "//aos/robot_state:robot_state_fbs", |
| 93 | "//aos/stl_mutex", |
| 94 | "//aos/time", |
| 95 | "//aos/util:log_interval", |
| 96 | "//aos/util:phased_loop", |
| 97 | "//aos/util:wrapping_counter", |
| 98 | "//frc971/autonomous:auto_mode_fbs", |
| 99 | "//frc971/control_loops:control_loops_fbs", |
| 100 | "//frc971/control_loops/drivetrain:drivetrain_position_fbs", |
James Kuszmaul | a244a91 | 2020-01-18 13:50:50 -0800 | [diff] [blame] | 101 | "//frc971/wpilib:ADIS16470", |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 102 | "//frc971/wpilib:buffered_pcm", |
| 103 | "//frc971/wpilib:drivetrain_writer", |
| 104 | "//frc971/wpilib:encoder_and_potentiometer", |
| 105 | "//frc971/wpilib:interrupt_edge_counting", |
| 106 | "//frc971/wpilib:joystick_sender", |
| 107 | "//frc971/wpilib:logging_fbs", |
| 108 | "//frc971/wpilib:loop_output_handler", |
| 109 | "//frc971/wpilib:pdp_fetcher", |
| 110 | "//frc971/wpilib:sensor_reader", |
| 111 | "//frc971/wpilib:wpilib_interface", |
| 112 | "//frc971/wpilib:wpilib_robot_base", |
Alex Perry | c4691f5 | 2020-02-17 19:20:01 -0800 | [diff] [blame] | 113 | "//third_party:phoenix", |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 114 | "//third_party:wpilib", |
| 115 | "//y2020/control_loops/superstructure:superstructure_output_fbs", |
| 116 | "//y2020/control_loops/superstructure:superstructure_position_fbs", |
| 117 | ], |
| 118 | ) |
| 119 | |
| 120 | cc_binary( |
| 121 | name = "joystick_reader", |
| 122 | srcs = [ |
| 123 | ":joystick_reader.cc", |
| 124 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 125 | target_compatible_with = ["@platforms//os:linux"], |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 126 | deps = [ |
Austin Schuh | d58b290 | 2020-03-01 19:28:04 -0800 | [diff] [blame] | 127 | ":setpoint_fbs", |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 128 | "//aos:init", |
| 129 | "//aos/actions:action_lib", |
| 130 | "//aos/input:action_joystick_input", |
| 131 | "//aos/input:drivetrain_input", |
| 132 | "//aos/input:joystick_input", |
| 133 | "//aos/logging", |
| 134 | "//frc971/autonomous:auto_fbs", |
| 135 | "//frc971/autonomous:base_autonomous_actor", |
| 136 | "//frc971/control_loops:profiled_subsystem_fbs", |
Sabina Davis | a8fed3d | 2020-02-22 21:44:57 -0800 | [diff] [blame] | 137 | "//y2020:constants", |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 138 | "//y2020/control_loops/drivetrain:drivetrain_base", |
| 139 | "//y2020/control_loops/superstructure:superstructure_goal_fbs", |
| 140 | "//y2020/control_loops/superstructure:superstructure_status_fbs", |
| 141 | ], |
| 142 | ) |
| 143 | |
| 144 | aos_config( |
| 145 | name = "config", |
| 146 | src = "y2020.json", |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 147 | target_compatible_with = ["@platforms//os:linux"], |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 148 | visibility = ["//visibility:public"], |
| 149 | deps = [ |
Austin Schuh | 196a445 | 2020-03-15 23:12:03 -0700 | [diff] [blame] | 150 | ":config_laptop", |
Austin Schuh | ce3a191 | 2020-03-15 15:14:19 -0700 | [diff] [blame] | 151 | ":config_pi1", |
| 152 | ":config_pi2", |
| 153 | ":config_pi3", |
Austin Schuh | 196a445 | 2020-03-15 23:12:03 -0700 | [diff] [blame] | 154 | ":config_pi4", |
Austin Schuh | ce3a191 | 2020-03-15 15:14:19 -0700 | [diff] [blame] | 155 | ":config_roborio", |
| 156 | ], |
milind upadhyay | 96016ca | 2021-02-20 15:28:50 -0800 | [diff] [blame^] | 157 | flatbuffers = [ |
| 158 | "//aos/network:message_bridge_client_fbs", |
| 159 | "//aos/network:message_bridge_server_fbs", |
| 160 | "//aos/network:timestamp_fbs", |
| 161 | "//y2020/vision/sift:sift_fbs", |
| 162 | "//y2020/vision/sift:sift_training_fbs", |
| 163 | "//y2020/vision:vision_fbs", |
| 164 | ] |
Austin Schuh | ce3a191 | 2020-03-15 15:14:19 -0700 | [diff] [blame] | 165 | ) |
| 166 | |
| 167 | [ |
| 168 | aos_config( |
| 169 | name = "config_" + pi, |
| 170 | src = "y2020_" + pi + ".json", |
| 171 | flatbuffers = [ |
| 172 | "//aos/network:message_bridge_client_fbs", |
| 173 | "//aos/network:message_bridge_server_fbs", |
| 174 | "//aos/network:timestamp_fbs", |
| 175 | "//y2020/vision/sift:sift_fbs", |
| 176 | "//y2020/vision/sift:sift_training_fbs", |
| 177 | "//y2020/vision:vision_fbs", |
Austin Schuh | 0de30f3 | 2020-12-06 12:44:28 -0800 | [diff] [blame] | 178 | "//aos/network:remote_message_fbs", |
milind upadhyay | 96016ca | 2021-02-20 15:28:50 -0800 | [diff] [blame^] | 179 | "//y2020/vision:galactic_search_path_fbs" |
Austin Schuh | ce3a191 | 2020-03-15 15:14:19 -0700 | [diff] [blame] | 180 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 181 | target_compatible_with = ["@platforms//os:linux"], |
Austin Schuh | ce3a191 | 2020-03-15 15:14:19 -0700 | [diff] [blame] | 182 | visibility = ["//visibility:public"], |
| 183 | deps = [ |
| 184 | "//aos/events:config", |
Austin Schuh | 196a445 | 2020-03-15 23:12:03 -0700 | [diff] [blame] | 185 | "//aos/robot_state:config", |
Austin Schuh | ac17fba | 2020-03-28 15:55:33 -0700 | [diff] [blame] | 186 | "//frc971/control_loops/drivetrain:config", |
Austin Schuh | ce3a191 | 2020-03-15 15:14:19 -0700 | [diff] [blame] | 187 | ], |
| 188 | ) |
| 189 | for pi in [ |
| 190 | "pi1", |
| 191 | "pi2", |
| 192 | "pi3", |
Austin Schuh | 196a445 | 2020-03-15 23:12:03 -0700 | [diff] [blame] | 193 | "pi4", |
Austin Schuh | ce3a191 | 2020-03-15 15:14:19 -0700 | [diff] [blame] | 194 | ] |
| 195 | ] |
| 196 | |
| 197 | aos_config( |
Austin Schuh | 3a2f4a4 | 2020-09-16 14:10:39 -0700 | [diff] [blame] | 198 | name = "config_laptop", |
| 199 | src = "y2020_laptop.json", |
| 200 | flatbuffers = [ |
| 201 | "//aos/network:message_bridge_client_fbs", |
| 202 | "//aos/network:message_bridge_server_fbs", |
| 203 | "//aos/network:timestamp_fbs", |
| 204 | "//y2020/vision/sift:sift_fbs", |
| 205 | "//y2020/vision/sift:sift_training_fbs", |
| 206 | "//y2020/vision:vision_fbs", |
Austin Schuh | 0de30f3 | 2020-12-06 12:44:28 -0800 | [diff] [blame] | 207 | "//aos/network:remote_message_fbs", |
Austin Schuh | 3a2f4a4 | 2020-09-16 14:10:39 -0700 | [diff] [blame] | 208 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 209 | target_compatible_with = ["@platforms//os:linux"], |
Austin Schuh | 3a2f4a4 | 2020-09-16 14:10:39 -0700 | [diff] [blame] | 210 | visibility = ["//visibility:public"], |
| 211 | deps = [ |
| 212 | "//aos/events:config", |
| 213 | "//aos/robot_state:config", |
| 214 | "//frc971/control_loops/drivetrain:config", |
| 215 | ], |
| 216 | ) |
| 217 | |
| 218 | aos_config( |
Austin Schuh | ce3a191 | 2020-03-15 15:14:19 -0700 | [diff] [blame] | 219 | name = "config_roborio", |
| 220 | src = "y2020_roborio.json", |
| 221 | flatbuffers = [ |
| 222 | ":setpoint_fbs", |
Austin Schuh | 0de30f3 | 2020-12-06 12:44:28 -0800 | [diff] [blame] | 223 | "//aos/network:remote_message_fbs", |
Austin Schuh | ce3a191 | 2020-03-15 15:14:19 -0700 | [diff] [blame] | 224 | "//aos/network:message_bridge_client_fbs", |
| 225 | "//aos/network:message_bridge_server_fbs", |
| 226 | "//aos/network:timestamp_fbs", |
| 227 | "//y2020/control_loops/superstructure:superstructure_goal_fbs", |
| 228 | "//y2019/control_loops/drivetrain:target_selector_fbs", |
| 229 | "//y2020/control_loops/superstructure:superstructure_output_fbs", |
| 230 | "//y2020/control_loops/superstructure:superstructure_position_fbs", |
| 231 | "//y2020/control_loops/superstructure:superstructure_status_fbs", |
| 232 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 233 | target_compatible_with = ["@platforms//os:linux"], |
Austin Schuh | ce3a191 | 2020-03-15 15:14:19 -0700 | [diff] [blame] | 234 | deps = [ |
| 235 | "//aos/events:config", |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 236 | "//aos/robot_state:config", |
| 237 | "//frc971/autonomous:config", |
| 238 | "//frc971/control_loops/drivetrain:config", |
| 239 | "//frc971/wpilib:config", |
| 240 | ], |
| 241 | ) |
| 242 | |
| 243 | py_library( |
| 244 | name = "python_init", |
| 245 | srcs = ["__init__.py"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 246 | target_compatible_with = ["@platforms//os:linux"], |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 247 | visibility = ["//visibility:public"], |
| 248 | ) |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 249 | |
| 250 | sh_binary( |
| 251 | name = "web_proxy", |
| 252 | srcs = ["web_proxy.sh"], |
| 253 | data = [ |
Austin Schuh | 14d7d3d | 2020-09-10 18:14:36 -0700 | [diff] [blame] | 254 | ":config", |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 255 | "//aos/network:web_proxy_main", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 256 | "//y2020/www:camera_main_bundle.min.js", |
| 257 | "//y2020/www:field_main_bundle.min.js", |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 258 | "//y2020/www:files", |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 259 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 260 | target_compatible_with = ["@platforms//os:linux"], |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 261 | ) |
Austin Schuh | d58b290 | 2020-03-01 19:28:04 -0800 | [diff] [blame] | 262 | |
| 263 | load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library") |
| 264 | |
| 265 | flatbuffer_cc_library( |
| 266 | name = "setpoint_fbs", |
| 267 | srcs = [ |
| 268 | "setpoint.fbs", |
| 269 | ], |
| 270 | gen_reflections = 1, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 271 | target_compatible_with = ["@platforms//os:linux"], |
Austin Schuh | d58b290 | 2020-03-01 19:28:04 -0800 | [diff] [blame] | 272 | ) |
| 273 | |
| 274 | cc_binary( |
| 275 | name = "setpoint_setter", |
| 276 | srcs = ["setpoint_setter.cc"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 277 | target_compatible_with = ["@platforms//os:linux"], |
Austin Schuh | d58b290 | 2020-03-01 19:28:04 -0800 | [diff] [blame] | 278 | deps = [ |
| 279 | ":setpoint_fbs", |
| 280 | "//aos:init", |
| 281 | "//aos/events:shm_event_loop", |
| 282 | ], |
| 283 | ) |
James Kuszmaul | 55d9fc7 | 2020-05-10 18:58:08 -0700 | [diff] [blame] | 284 | |
Austin Schuh | 3a2f4a4 | 2020-09-16 14:10:39 -0700 | [diff] [blame] | 285 | [ |
| 286 | jinja2_template( |
| 287 | name = "y2020_pi" + str(num) + ".json", |
| 288 | src = "y2020_pi_template.json", |
| 289 | parameters = {"NUM": str(num)}, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 290 | target_compatible_with = ["@platforms//os:linux"], |
Austin Schuh | 3a2f4a4 | 2020-09-16 14:10:39 -0700 | [diff] [blame] | 291 | ) |
| 292 | for num in range(1, 5) |
| 293 | ] |