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