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