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