Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 1 | package(default_visibility = ["//visibility:public"]) |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 2 | |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 3 | load("//aos/build:queues.bzl", "queue_library") |
| 4 | load("//tools:environments.bzl", "mcu_cpus") |
Austin Schuh | 719a33e | 2019-01-07 15:13:34 -0800 | [diff] [blame] | 5 | load("//tools/build_rules:select.bzl", "cpu_select", "compiler_select") |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 6 | |
| 7 | cc_binary( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 8 | name = "replay_drivetrain", |
| 9 | srcs = [ |
| 10 | "replay_drivetrain.cc", |
| 11 | ], |
| 12 | deps = [ |
| 13 | ":drivetrain_queue", |
John Park | 398c74a | 2018-10-20 21:17:39 -0700 | [diff] [blame] | 14 | "//aos:init", |
Austin Schuh | c2b0877 | 2018-12-19 18:05:06 +1100 | [diff] [blame] | 15 | "//aos/controls:replay_control_loop", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 16 | "//frc971/queues:gyro", |
| 17 | ], |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 18 | ) |
| 19 | |
| 20 | queue_library( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 21 | name = "drivetrain_queue", |
| 22 | srcs = [ |
| 23 | "drivetrain.q", |
| 24 | ], |
| 25 | deps = [ |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 26 | "//aos/controls:control_loop_queues", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 27 | "//frc971/control_loops:queues", |
| 28 | ], |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 29 | ) |
| 30 | |
| 31 | cc_library( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 32 | name = "drivetrain_config", |
| 33 | hdrs = [ |
| 34 | "drivetrain_config.h", |
| 35 | ], |
| 36 | deps = [ |
| 37 | "//frc971:shifter_hall_effect", |
Austin Schuh | a062edb | 2019-01-03 13:17:13 -0800 | [diff] [blame] | 38 | "//frc971/control_loops:hybrid_state_feedback_loop", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 39 | "//frc971/control_loops:state_feedback_loop", |
| 40 | ], |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 41 | ) |
| 42 | |
| 43 | cc_library( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 44 | name = "gear", |
| 45 | hdrs = [ |
| 46 | "gear.h", |
| 47 | ], |
| 48 | compatible_with = mcu_cpus, |
Austin Schuh | 093535c | 2016-03-05 23:21:00 -0800 | [diff] [blame] | 49 | ) |
| 50 | |
| 51 | cc_library( |
Alex Perry | 731b460 | 2019-02-02 22:13:01 -0800 | [diff] [blame^] | 52 | name = "splinedrivetrain", |
| 53 | srcs = [ |
| 54 | "splinedrivetrain.cc", |
| 55 | ], |
| 56 | hdrs = [ |
| 57 | "splinedrivetrain.h", |
| 58 | ], |
| 59 | deps = [ |
| 60 | ":drivetrain_config", |
| 61 | ":drivetrain_queue", |
| 62 | ":spline", |
| 63 | ":distance_spline", |
| 64 | ":trajectory", |
| 65 | ] |
| 66 | ) |
| 67 | |
| 68 | cc_library( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 69 | name = "ssdrivetrain", |
| 70 | srcs = [ |
| 71 | "ssdrivetrain.cc", |
| 72 | ], |
| 73 | hdrs = [ |
| 74 | "ssdrivetrain.h", |
| 75 | ], |
| 76 | deps = [ |
| 77 | ":drivetrain_config", |
| 78 | ":drivetrain_queue", |
| 79 | ":gear", |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 80 | "//aos:math", |
| 81 | "//aos/controls:control_loop", |
| 82 | "//aos/controls:polytope", |
| 83 | "//aos/logging:matrix_logging", |
| 84 | "//aos/logging:queue_logging", |
Austin Schuh | c2b0877 | 2018-12-19 18:05:06 +1100 | [diff] [blame] | 85 | "//aos/robot_state", |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 86 | "//aos/util:log_interval", |
| 87 | "//aos/util:trapezoid_profile", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 88 | "//frc971:shifter_hall_effect", |
| 89 | "//frc971/control_loops:coerce_goal", |
| 90 | "//frc971/control_loops:state_feedback_loop", |
| 91 | ], |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 92 | ) |
| 93 | |
| 94 | cc_library( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 95 | name = "polydrivetrain", |
| 96 | srcs = [ |
| 97 | "polydrivetrain.cc", |
| 98 | ], |
| 99 | hdrs = [ |
| 100 | "polydrivetrain.h", |
| 101 | ], |
| 102 | deps = [ |
| 103 | ":drivetrain_config", |
| 104 | ":drivetrain_queue", |
| 105 | ":gear", |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 106 | "//aos:math", |
| 107 | "//aos/controls:polytope", |
| 108 | "//aos/logging:matrix_logging", |
| 109 | "//aos/logging:queue_logging", |
Austin Schuh | c2b0877 | 2018-12-19 18:05:06 +1100 | [diff] [blame] | 110 | "//aos/robot_state", |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 111 | "//aos/util:log_interval", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 112 | "//frc971/control_loops:coerce_goal", |
| 113 | "//frc971/control_loops:state_feedback_loop", |
| 114 | ], |
| 115 | ) |
| 116 | |
| 117 | cc_library( |
| 118 | name = "drivetrain_config_uc", |
| 119 | hdrs = [ |
| 120 | "drivetrain_config.h", |
| 121 | ], |
| 122 | restricted_to = mcu_cpus, |
| 123 | deps = [ |
| 124 | "//frc971:shifter_hall_effect", |
| 125 | "//frc971/control_loops:state_feedback_loop_uc", |
| 126 | ], |
| 127 | ) |
| 128 | |
| 129 | cc_library( |
| 130 | name = "polydrivetrain_uc", |
| 131 | srcs = [ |
| 132 | "drivetrain_uc.q.cc", |
| 133 | "polydrivetrain.cc", |
| 134 | ], |
| 135 | hdrs = [ |
| 136 | "drivetrain_uc.q.h", |
| 137 | "polydrivetrain.h", |
| 138 | ], |
| 139 | restricted_to = mcu_cpus, |
| 140 | deps = [ |
| 141 | ":drivetrain_config_uc", |
| 142 | ":gear", |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 143 | "//aos:math", |
| 144 | "//aos/controls:polytope_uc", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 145 | "//frc971/control_loops:coerce_goal_uc", |
| 146 | "//frc971/control_loops:state_feedback_loop_uc", |
| 147 | ], |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 148 | ) |
| 149 | |
Austin Schuh | 05c5a61 | 2016-04-02 15:10:25 -0700 | [diff] [blame] | 150 | genrule( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 151 | name = "genrule_down_estimator", |
| 152 | outs = [ |
| 153 | "down_estimator.h", |
| 154 | "down_estimator.cc", |
| 155 | ], |
| 156 | cmd = "$(location //frc971/control_loops/python:down_estimator) $(OUTS)", |
| 157 | tools = [ |
| 158 | "//frc971/control_loops/python:down_estimator", |
| 159 | ], |
| 160 | visibility = ["//visibility:private"], |
Austin Schuh | 05c5a61 | 2016-04-02 15:10:25 -0700 | [diff] [blame] | 161 | ) |
| 162 | |
| 163 | cc_library( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 164 | name = "down_estimator", |
| 165 | srcs = [ |
| 166 | "down_estimator.cc", |
| 167 | ], |
| 168 | hdrs = [ |
| 169 | "down_estimator.h", |
| 170 | ], |
| 171 | deps = [ |
| 172 | "//frc971/control_loops:state_feedback_loop", |
| 173 | ], |
Austin Schuh | 05c5a61 | 2016-04-02 15:10:25 -0700 | [diff] [blame] | 174 | ) |
| 175 | |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 176 | cc_library( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 177 | name = "drivetrain_lib", |
| 178 | srcs = [ |
| 179 | "drivetrain.cc", |
| 180 | ], |
| 181 | hdrs = [ |
| 182 | "drivetrain.h", |
| 183 | ], |
| 184 | deps = [ |
| 185 | ":down_estimator", |
| 186 | ":drivetrain_queue", |
| 187 | ":gear", |
| 188 | ":polydrivetrain", |
| 189 | ":ssdrivetrain", |
Alex Perry | 731b460 | 2019-02-02 22:13:01 -0800 | [diff] [blame^] | 190 | ":splinedrivetrain", |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 191 | "//aos/controls:control_loop", |
| 192 | "//aos/logging:matrix_logging", |
| 193 | "//aos/logging:queue_logging", |
| 194 | "//aos/util:log_interval", |
Austin Schuh | 3a37846 | 2019-01-04 21:48:04 -0800 | [diff] [blame] | 195 | "//frc971/control_loops:runge_kutta", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 196 | "//frc971/queues:gyro", |
| 197 | "//frc971/wpilib:imu_queue", |
| 198 | ], |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 199 | ) |
| 200 | |
| 201 | cc_test( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 202 | name = "drivetrain_lib_test", |
| 203 | srcs = [ |
| 204 | "drivetrain_lib_test.cc", |
| 205 | ], |
| 206 | deps = [ |
| 207 | ":drivetrain_config", |
| 208 | ":drivetrain_lib", |
| 209 | ":drivetrain_queue", |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 210 | "//aos:queues", |
| 211 | "//aos/controls:control_loop_test", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 212 | "//aos/testing:googletest", |
| 213 | "//frc971/control_loops:state_feedback_loop", |
| 214 | "//frc971/queues:gyro", |
| 215 | "//y2016:constants", |
| 216 | "//y2016/control_loops/drivetrain:polydrivetrain_plants", |
| 217 | ], |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 218 | ) |
Brian Silverman | 6260c09 | 2018-01-14 15:21:36 -0800 | [diff] [blame] | 219 | |
| 220 | genrule( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 221 | name = "genrule_haptic_wheel", |
| 222 | outs = [ |
| 223 | "haptic_wheel.h", |
| 224 | "haptic_wheel.cc", |
| 225 | "integral_haptic_wheel.h", |
| 226 | "integral_haptic_wheel.cc", |
| 227 | "haptic_trigger.h", |
| 228 | "haptic_trigger.cc", |
| 229 | "integral_haptic_trigger.h", |
| 230 | "integral_haptic_trigger.cc", |
| 231 | ], |
| 232 | cmd = "$(location //frc971/control_loops/python:haptic_wheel) $(OUTS)", |
| 233 | compatible_with = mcu_cpus, |
| 234 | tools = [ |
| 235 | "//frc971/control_loops/python:haptic_wheel", |
| 236 | ], |
| 237 | visibility = ["//visibility:private"], |
Brian Silverman | 6260c09 | 2018-01-14 15:21:36 -0800 | [diff] [blame] | 238 | ) |
| 239 | |
| 240 | cc_library( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 241 | name = "haptic_input_uc", |
| 242 | srcs = [ |
| 243 | "haptic_trigger.cc", |
| 244 | "haptic_wheel.cc", |
| 245 | "integral_haptic_trigger.cc", |
| 246 | "integral_haptic_wheel.cc", |
| 247 | ], |
| 248 | hdrs = [ |
| 249 | "haptic_trigger.h", |
| 250 | "haptic_wheel.h", |
| 251 | "integral_haptic_trigger.h", |
| 252 | "integral_haptic_wheel.h", |
| 253 | ], |
| 254 | restricted_to = mcu_cpus, |
| 255 | deps = [ |
| 256 | "//frc971/control_loops:state_feedback_loop_uc", |
| 257 | ], |
Brian Silverman | 6260c09 | 2018-01-14 15:21:36 -0800 | [diff] [blame] | 258 | ) |
| 259 | |
| 260 | cc_library( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 261 | name = "haptic_wheel", |
| 262 | srcs = [ |
| 263 | "haptic_trigger.cc", |
| 264 | "haptic_wheel.cc", |
| 265 | "integral_haptic_trigger.cc", |
| 266 | "integral_haptic_wheel.cc", |
| 267 | ], |
| 268 | hdrs = [ |
| 269 | "haptic_trigger.h", |
| 270 | "haptic_wheel.h", |
| 271 | "integral_haptic_trigger.h", |
| 272 | "integral_haptic_wheel.h", |
| 273 | ], |
| 274 | deps = [ |
| 275 | "//frc971/control_loops:state_feedback_loop", |
| 276 | ], |
Brian Silverman | 6260c09 | 2018-01-14 15:21:36 -0800 | [diff] [blame] | 277 | ) |
Austin Schuh | c2b0877 | 2018-12-19 18:05:06 +1100 | [diff] [blame] | 278 | |
| 279 | cc_library( |
| 280 | name = "spline", |
| 281 | srcs = ["spline.cc"], |
| 282 | hdrs = ["spline.h"], |
| 283 | deps = [ |
Austin Schuh | f49b4e3 | 2019-01-13 17:26:58 -0800 | [diff] [blame] | 284 | "//frc971/control_loops:binomial", |
Austin Schuh | c2b0877 | 2018-12-19 18:05:06 +1100 | [diff] [blame] | 285 | "//third_party/eigen", |
| 286 | ], |
| 287 | ) |
| 288 | |
Alex Perry | a60da44 | 2019-01-21 19:00:27 -0500 | [diff] [blame] | 289 | cc_binary( |
| 290 | name = "spline.so", |
| 291 | srcs = ["libspline.cc"], |
| 292 | deps = [ |
| 293 | ":distance_spline", |
| 294 | ":spline", |
Alex Perry | 0603b54 | 2019-01-25 20:29:51 -0800 | [diff] [blame] | 295 | ":trajectory", |
| 296 | "//aos/logging:implementations", |
| 297 | "//aos/network:team_number", |
Alex Perry | a60da44 | 2019-01-21 19:00:27 -0500 | [diff] [blame] | 298 | "//third_party/eigen", |
Alex Perry | 0603b54 | 2019-01-25 20:29:51 -0800 | [diff] [blame] | 299 | "//y2019/control_loops/drivetrain:drivetrain_base", |
Alex Perry | a60da44 | 2019-01-21 19:00:27 -0500 | [diff] [blame] | 300 | ], |
| 301 | linkshared=True, |
| 302 | ) |
| 303 | |
Austin Schuh | c2b0877 | 2018-12-19 18:05:06 +1100 | [diff] [blame] | 304 | cc_test( |
| 305 | name = "spline_test", |
| 306 | srcs = [ |
| 307 | "spline_test.cc", |
| 308 | ], |
| 309 | restricted_to = ["//tools:k8"], |
| 310 | deps = [ |
| 311 | ":spline", |
| 312 | "//aos/testing:googletest", |
| 313 | "//third_party/matplotlib-cpp", |
| 314 | "@com_github_gflags_gflags//:gflags", |
| 315 | ], |
| 316 | ) |
Austin Schuh | 941b46d | 2018-12-19 18:06:05 +1100 | [diff] [blame] | 317 | |
| 318 | cc_library( |
| 319 | name = "distance_spline", |
| 320 | srcs = ["distance_spline.cc"], |
| 321 | hdrs = ["distance_spline.h"], |
| 322 | deps = [ |
| 323 | ":spline", |
Austin Schuh | a6e7b21 | 2019-01-20 13:53:01 -0800 | [diff] [blame] | 324 | "//aos/logging", |
Austin Schuh | 941b46d | 2018-12-19 18:06:05 +1100 | [diff] [blame] | 325 | "//frc971/control_loops:fixed_quadrature", |
| 326 | "//third_party/eigen", |
| 327 | ], |
| 328 | ) |
| 329 | |
| 330 | cc_test( |
| 331 | name = "distance_spline_test", |
| 332 | srcs = [ |
| 333 | "distance_spline_test.cc", |
| 334 | ], |
Austin Schuh | 9b0b643 | 2019-01-13 21:15:17 -0800 | [diff] [blame] | 335 | defines = |
| 336 | cpu_select({ |
| 337 | "amd64": [ |
| 338 | "SUPPORT_PLOT=1", |
| 339 | ], |
| 340 | "arm": [], |
| 341 | }), |
| 342 | linkstatic = True, |
Austin Schuh | 941b46d | 2018-12-19 18:06:05 +1100 | [diff] [blame] | 343 | deps = [ |
| 344 | ":distance_spline", |
| 345 | "//aos/testing:googletest", |
Austin Schuh | a6e7b21 | 2019-01-20 13:53:01 -0800 | [diff] [blame] | 346 | "//aos/testing:test_shm", |
Austin Schuh | 941b46d | 2018-12-19 18:06:05 +1100 | [diff] [blame] | 347 | "@com_github_gflags_gflags//:gflags", |
Austin Schuh | 9b0b643 | 2019-01-13 21:15:17 -0800 | [diff] [blame] | 348 | ] + cpu_select({ |
| 349 | "amd64": [ |
| 350 | "//third_party/matplotlib-cpp", |
| 351 | ], |
| 352 | "arm": [], |
| 353 | }), |
Austin Schuh | 941b46d | 2018-12-19 18:06:05 +1100 | [diff] [blame] | 354 | ) |
Austin Schuh | ec7f06d | 2019-01-04 07:47:15 +1100 | [diff] [blame] | 355 | |
| 356 | cc_library( |
| 357 | name = "trajectory", |
| 358 | srcs = ["trajectory.cc"], |
| 359 | hdrs = ["trajectory.h"], |
| 360 | deps = [ |
| 361 | ":distance_spline", |
| 362 | ":drivetrain_config", |
| 363 | "//aos/logging:matrix_logging", |
| 364 | "//frc971/control_loops:c2d", |
| 365 | "//frc971/control_loops:dlqr", |
| 366 | "//frc971/control_loops:hybrid_state_feedback_loop", |
| 367 | "//frc971/control_loops:runge_kutta", |
| 368 | "//frc971/control_loops:state_feedback_loop", |
| 369 | "//third_party/eigen", |
| 370 | ], |
| 371 | ) |
| 372 | |
| 373 | cc_binary( |
| 374 | name = "trajectory_plot", |
| 375 | srcs = [ |
| 376 | "trajectory_plot.cc", |
| 377 | ], |
| 378 | restricted_to = ["//tools:k8"], |
| 379 | deps = [ |
| 380 | ":distance_spline", |
| 381 | ":trajectory", |
| 382 | "//aos/logging:implementations", |
| 383 | "//aos/logging:matrix_logging", |
| 384 | "//aos/network:team_number", |
| 385 | "//third_party/eigen", |
| 386 | "//third_party/matplotlib-cpp", |
| 387 | "//y2016/control_loops/drivetrain:drivetrain_base", |
| 388 | "@com_github_gflags_gflags//:gflags", |
| 389 | ], |
| 390 | ) |
| 391 | |
| 392 | cc_test( |
| 393 | name = "trajectory_test", |
| 394 | srcs = [ |
| 395 | "trajectory_test.cc", |
| 396 | ], |
Austin Schuh | 719a33e | 2019-01-07 15:13:34 -0800 | [diff] [blame] | 397 | defines = |
| 398 | cpu_select({ |
| 399 | "amd64": [ |
| 400 | "SUPPORT_PLOT=1", |
| 401 | ], |
| 402 | "arm": [], |
| 403 | }), |
| 404 | linkstatic = True, |
Austin Schuh | ec7f06d | 2019-01-04 07:47:15 +1100 | [diff] [blame] | 405 | deps = [ |
| 406 | ":trajectory", |
| 407 | "//aos/testing:googletest", |
| 408 | "//aos/testing:test_shm", |
| 409 | "//y2016:constants", |
| 410 | "//y2016/control_loops/drivetrain:polydrivetrain_plants", |
Austin Schuh | 719a33e | 2019-01-07 15:13:34 -0800 | [diff] [blame] | 411 | ] + cpu_select({ |
| 412 | "amd64": [ |
| 413 | "//third_party/matplotlib-cpp", |
| 414 | ], |
| 415 | "arm": [], |
| 416 | }), |
Austin Schuh | ec7f06d | 2019-01-04 07:47:15 +1100 | [diff] [blame] | 417 | ) |