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 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 3 | load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library") |
| 4 | load("//aos:config.bzl", "aos_config") |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 5 | load("//tools:environments.bzl", "mcu_cpus") |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 6 | load("//tools/build_rules:select.bzl", "compiler_select", "cpu_select") |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 7 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 8 | flatbuffer_cc_library( |
| 9 | name = "drivetrain_goal_fbs", |
| 10 | srcs = ["drivetrain_goal.fbs"], |
| 11 | compatible_with = mcu_cpus, |
| 12 | gen_reflections = 1, |
| 13 | includes = ["//frc971/control_loops:control_loops_fbs_includes"], |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 14 | ) |
| 15 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 16 | flatbuffer_cc_library( |
| 17 | name = "drivetrain_output_fbs", |
| 18 | srcs = ["drivetrain_output.fbs"], |
| 19 | compatible_with = mcu_cpus, |
| 20 | gen_reflections = 1, |
| 21 | ) |
| 22 | |
| 23 | flatbuffer_cc_library( |
| 24 | name = "drivetrain_position_fbs", |
| 25 | srcs = ["drivetrain_position.fbs"], |
| 26 | compatible_with = mcu_cpus, |
| 27 | gen_reflections = 1, |
| 28 | ) |
| 29 | |
| 30 | flatbuffer_cc_library( |
| 31 | name = "drivetrain_status_fbs", |
| 32 | srcs = ["drivetrain_status.fbs"], |
| 33 | compatible_with = mcu_cpus, |
| 34 | gen_reflections = 1, |
| 35 | includes = ["//frc971/control_loops:control_loops_fbs_includes"], |
| 36 | ) |
| 37 | |
| 38 | genrule( |
| 39 | name = "drivetrain_goal_float_fbs_generated", |
| 40 | srcs = ["drivetrain_goal.fbs"], |
| 41 | outs = ["drivetrain_goal_float.fbs"], |
| 42 | cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)", |
| 43 | compatible_with = mcu_cpus, |
| 44 | ) |
| 45 | |
| 46 | genrule( |
| 47 | name = "drivetrain_position_float_fbs_generated", |
| 48 | srcs = ["drivetrain_position.fbs"], |
| 49 | outs = ["drivetrain_position_float.fbs"], |
| 50 | cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)", |
| 51 | compatible_with = mcu_cpus, |
| 52 | ) |
| 53 | |
| 54 | genrule( |
| 55 | name = "drivetrain_output_float_fbs_generated", |
| 56 | srcs = ["drivetrain_output.fbs"], |
| 57 | outs = ["drivetrain_output_float.fbs"], |
| 58 | cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)", |
| 59 | compatible_with = mcu_cpus, |
| 60 | ) |
| 61 | |
| 62 | genrule( |
| 63 | name = "drivetrain_status_float_fbs_generated", |
| 64 | srcs = ["drivetrain_status.fbs"], |
| 65 | outs = ["drivetrain_status_float.fbs"], |
| 66 | cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)", |
| 67 | compatible_with = mcu_cpus, |
| 68 | ) |
| 69 | |
| 70 | flatbuffer_cc_library( |
| 71 | name = "drivetrain_goal_float_fbs", |
| 72 | srcs = ["drivetrain_goal_float.fbs"], |
| 73 | compatible_with = mcu_cpus, |
| 74 | gen_reflections = 1, |
| 75 | includes = ["//frc971/control_loops:control_loops_fbs_includes"], |
| 76 | ) |
| 77 | |
| 78 | flatbuffer_cc_library( |
| 79 | name = "drivetrain_output_float_fbs", |
| 80 | srcs = ["drivetrain_output_float.fbs"], |
| 81 | compatible_with = mcu_cpus, |
| 82 | gen_reflections = 1, |
| 83 | ) |
| 84 | |
| 85 | flatbuffer_cc_library( |
| 86 | name = "drivetrain_position_float_fbs", |
| 87 | srcs = ["drivetrain_position_float.fbs"], |
| 88 | compatible_with = mcu_cpus, |
| 89 | gen_reflections = 1, |
| 90 | ) |
| 91 | |
| 92 | flatbuffer_cc_library( |
| 93 | name = "drivetrain_status_float_fbs", |
| 94 | srcs = ["drivetrain_status_float.fbs"], |
| 95 | compatible_with = mcu_cpus, |
| 96 | gen_reflections = 1, |
| 97 | includes = ["//frc971/control_loops:control_loops_fbs_includes"], |
| 98 | ) |
| 99 | |
| 100 | aos_config( |
| 101 | name = "config", |
| 102 | src = "drivetrain_config.json", |
| 103 | flatbuffers = [ |
| 104 | ":drivetrain_goal_fbs", |
| 105 | ":drivetrain_output_fbs", |
| 106 | ":drivetrain_status_fbs", |
| 107 | ":drivetrain_position_fbs", |
| 108 | ":localizer_fbs", |
| 109 | "//frc971/queues:gyro", |
| 110 | "//frc971/wpilib:imu_fbs", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 111 | ], |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 112 | visibility = ["//visibility:public"], |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 113 | deps = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 114 | "//aos/robot_state:config", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 115 | ], |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 116 | ) |
| 117 | |
| 118 | cc_library( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 119 | name = "drivetrain_config", |
| 120 | hdrs = [ |
| 121 | "drivetrain_config.h", |
| 122 | ], |
| 123 | deps = [ |
| 124 | "//frc971:shifter_hall_effect", |
Austin Schuh | a062edb | 2019-01-03 13:17:13 -0800 | [diff] [blame] | 125 | "//frc971/control_loops:hybrid_state_feedback_loop", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 126 | "//frc971/control_loops:state_feedback_loop", |
| 127 | ], |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 128 | ) |
| 129 | |
| 130 | cc_library( |
James Kuszmaul | 2ed7b3c | 2019-02-09 18:26:19 -0800 | [diff] [blame] | 131 | name = "hybrid_ekf", |
| 132 | hdrs = ["hybrid_ekf.h"], |
| 133 | deps = [ |
| 134 | ":drivetrain_config", |
| 135 | "//aos/containers:priority_queue", |
James Kuszmaul | fedc461 | 2019-03-10 11:24:51 -0700 | [diff] [blame] | 136 | "//aos/util:math", |
James Kuszmaul | 2ed7b3c | 2019-02-09 18:26:19 -0800 | [diff] [blame] | 137 | "//frc971/control_loops:c2d", |
| 138 | "//frc971/control_loops:runge_kutta", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 139 | "@org_tuxfamily_eigen//:eigen", |
James Kuszmaul | 2ed7b3c | 2019-02-09 18:26:19 -0800 | [diff] [blame] | 140 | ], |
| 141 | ) |
| 142 | |
| 143 | cc_test( |
| 144 | name = "hybrid_ekf_test", |
| 145 | srcs = ["hybrid_ekf_test.cc"], |
| 146 | deps = [ |
| 147 | ":drivetrain_test_lib", |
| 148 | ":hybrid_ekf", |
| 149 | ":trajectory", |
| 150 | "//aos/testing:googletest", |
| 151 | "//aos/testing:random_seed", |
| 152 | "//aos/testing:test_shm", |
| 153 | ], |
| 154 | ) |
| 155 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 156 | flatbuffer_cc_library( |
| 157 | name = "localizer_fbs", |
| 158 | srcs = ["localizer.fbs"], |
| 159 | gen_reflections = 1, |
James Kuszmaul | ef428a0 | 2019-03-02 22:19:41 -0800 | [diff] [blame] | 160 | ) |
| 161 | |
James Kuszmaul | 2ed7b3c | 2019-02-09 18:26:19 -0800 | [diff] [blame] | 162 | cc_library( |
James Kuszmaul | 3431d62 | 2019-02-17 17:07:44 -0800 | [diff] [blame] | 163 | name = "localizer", |
| 164 | hdrs = ["localizer.h"], |
| 165 | deps = [ |
| 166 | ":drivetrain_config", |
| 167 | ":hybrid_ekf", |
James Kuszmaul | 5bc6fc9 | 2019-03-01 21:50:06 -0800 | [diff] [blame] | 168 | "//frc971/control_loops:pose", |
James Kuszmaul | 3431d62 | 2019-02-17 17:07:44 -0800 | [diff] [blame] | 169 | ], |
| 170 | ) |
| 171 | |
| 172 | cc_library( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 173 | name = "gear", |
| 174 | hdrs = [ |
| 175 | "gear.h", |
| 176 | ], |
| 177 | compatible_with = mcu_cpus, |
Austin Schuh | 093535c | 2016-03-05 23:21:00 -0800 | [diff] [blame] | 178 | ) |
| 179 | |
| 180 | cc_library( |
Alex Perry | 731b460 | 2019-02-02 22:13:01 -0800 | [diff] [blame] | 181 | name = "splinedrivetrain", |
| 182 | srcs = [ |
| 183 | "splinedrivetrain.cc", |
| 184 | ], |
| 185 | hdrs = [ |
| 186 | "splinedrivetrain.h", |
| 187 | ], |
| 188 | deps = [ |
James Kuszmaul | 2ed7b3c | 2019-02-09 18:26:19 -0800 | [diff] [blame] | 189 | ":distance_spline", |
Alex Perry | 731b460 | 2019-02-02 22:13:01 -0800 | [diff] [blame] | 190 | ":drivetrain_config", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 191 | ":drivetrain_goal_fbs", |
| 192 | ":drivetrain_output_fbs", |
| 193 | ":drivetrain_status_fbs", |
Alex Perry | 731b460 | 2019-02-02 22:13:01 -0800 | [diff] [blame] | 194 | ":spline", |
Alex Perry | 731b460 | 2019-02-02 22:13:01 -0800 | [diff] [blame] | 195 | ":trajectory", |
Alex Perry | 1ec3452 | 2019-02-17 22:44:10 -0800 | [diff] [blame] | 196 | "//aos:init", |
James Kuszmaul | c73bb22 | 2019-04-07 12:15:35 -0700 | [diff] [blame] | 197 | "//aos/util:math", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 198 | "//frc971/control_loops:control_loops_fbs", |
James Kuszmaul | 2ed7b3c | 2019-02-09 18:26:19 -0800 | [diff] [blame] | 199 | ], |
Alex Perry | 731b460 | 2019-02-02 22:13:01 -0800 | [diff] [blame] | 200 | ) |
| 201 | |
| 202 | cc_library( |
James Kuszmaul | e39cbcf | 2019-02-27 20:48:34 -0800 | [diff] [blame] | 203 | name = "line_follow_drivetrain", |
| 204 | srcs = [ |
| 205 | "line_follow_drivetrain.cc", |
| 206 | ], |
| 207 | hdrs = [ |
| 208 | "line_follow_drivetrain.h", |
| 209 | ], |
| 210 | deps = [ |
| 211 | ":drivetrain_config", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 212 | ":drivetrain_goal_fbs", |
| 213 | ":drivetrain_output_fbs", |
| 214 | ":drivetrain_status_fbs", |
James Kuszmaul | 5bc6fc9 | 2019-03-01 21:50:06 -0800 | [diff] [blame] | 215 | ":localizer", |
James Kuszmaul | e39cbcf | 2019-02-27 20:48:34 -0800 | [diff] [blame] | 216 | "//aos:math", |
| 217 | "//aos/util:math", |
| 218 | "//frc971/control_loops:c2d", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 219 | "//frc971/control_loops:control_loops_fbs", |
James Kuszmaul | e39cbcf | 2019-02-27 20:48:34 -0800 | [diff] [blame] | 220 | "//frc971/control_loops:dlqr", |
| 221 | "//frc971/control_loops:pose", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 222 | "//frc971/control_loops:profiled_subsystem_fbs", |
| 223 | "//y2019/control_loops/superstructure:superstructure_goal_fbs", |
| 224 | "@org_tuxfamily_eigen//:eigen", |
James Kuszmaul | e39cbcf | 2019-02-27 20:48:34 -0800 | [diff] [blame] | 225 | ], |
| 226 | ) |
| 227 | |
| 228 | cc_test( |
| 229 | name = "line_follow_drivetrain_test", |
| 230 | srcs = ["line_follow_drivetrain_test.cc"], |
| 231 | linkstatic = True, |
| 232 | restricted_to = ["//tools:k8"], |
| 233 | deps = [ |
| 234 | ":drivetrain_config", |
| 235 | ":drivetrain_test_lib", |
| 236 | ":line_follow_drivetrain", |
| 237 | ":trajectory", |
| 238 | "//aos/testing:googletest", |
| 239 | "//aos/testing:test_shm", |
| 240 | "//third_party/matplotlib-cpp", |
| 241 | "@com_github_gflags_gflags//:gflags", |
| 242 | ], |
| 243 | ) |
| 244 | |
| 245 | cc_library( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 246 | name = "ssdrivetrain", |
| 247 | srcs = [ |
| 248 | "ssdrivetrain.cc", |
| 249 | ], |
| 250 | hdrs = [ |
| 251 | "ssdrivetrain.h", |
| 252 | ], |
| 253 | deps = [ |
| 254 | ":drivetrain_config", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 255 | ":drivetrain_goal_fbs", |
| 256 | ":drivetrain_output_fbs", |
| 257 | ":drivetrain_status_fbs", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 258 | ":gear", |
James Kuszmaul | 3431d62 | 2019-02-17 17:07:44 -0800 | [diff] [blame] | 259 | ":localizer", |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 260 | "//aos:math", |
| 261 | "//aos/controls:control_loop", |
| 262 | "//aos/controls:polytope", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 263 | "//aos/robot_state:robot_state_fbs", |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 264 | "//aos/util:log_interval", |
| 265 | "//aos/util:trapezoid_profile", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 266 | "//frc971:shifter_hall_effect", |
| 267 | "//frc971/control_loops:coerce_goal", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 268 | "//frc971/control_loops:control_loops_fbs", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 269 | "//frc971/control_loops:state_feedback_loop", |
| 270 | ], |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 271 | ) |
| 272 | |
| 273 | cc_library( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 274 | name = "polydrivetrain", |
| 275 | srcs = [ |
| 276 | "polydrivetrain.cc", |
| 277 | ], |
| 278 | hdrs = [ |
| 279 | "polydrivetrain.h", |
| 280 | ], |
| 281 | deps = [ |
| 282 | ":drivetrain_config", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 283 | ":drivetrain_goal_fbs", |
| 284 | ":drivetrain_output_fbs", |
| 285 | ":drivetrain_position_fbs", |
| 286 | ":drivetrain_status_fbs", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 287 | ":gear", |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 288 | "//aos:math", |
| 289 | "//aos/controls:polytope", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 290 | "//aos/robot_state:robot_state_fbs", |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 291 | "//aos/util:log_interval", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 292 | "//frc971/control_loops:coerce_goal", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 293 | "//frc971/control_loops:control_loops_fbs", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 294 | "//frc971/control_loops:state_feedback_loop", |
| 295 | ], |
| 296 | ) |
| 297 | |
| 298 | cc_library( |
| 299 | name = "drivetrain_config_uc", |
| 300 | hdrs = [ |
| 301 | "drivetrain_config.h", |
| 302 | ], |
| 303 | restricted_to = mcu_cpus, |
| 304 | deps = [ |
| 305 | "//frc971:shifter_hall_effect", |
| 306 | "//frc971/control_loops:state_feedback_loop_uc", |
| 307 | ], |
| 308 | ) |
| 309 | |
| 310 | cc_library( |
| 311 | name = "polydrivetrain_uc", |
| 312 | srcs = [ |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 313 | "polydrivetrain.cc", |
| 314 | ], |
| 315 | hdrs = [ |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 316 | "polydrivetrain.h", |
| 317 | ], |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 318 | copts = ["-Wno-type-limits"], |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 319 | restricted_to = mcu_cpus, |
| 320 | deps = [ |
| 321 | ":drivetrain_config_uc", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 322 | ":drivetrain_goal_float_fbs", |
| 323 | ":drivetrain_output_float_fbs", |
| 324 | ":drivetrain_position_float_fbs", |
| 325 | ":drivetrain_status_float_fbs", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 326 | ":gear", |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 327 | "//aos:math", |
| 328 | "//aos/controls:polytope_uc", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 329 | "//frc971/control_loops:coerce_goal_uc", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 330 | "//frc971/control_loops:control_loops_fbs", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 331 | "//frc971/control_loops:state_feedback_loop_uc", |
| 332 | ], |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 333 | ) |
| 334 | |
Austin Schuh | 05c5a61 | 2016-04-02 15:10:25 -0700 | [diff] [blame] | 335 | genrule( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 336 | name = "genrule_down_estimator", |
| 337 | outs = [ |
| 338 | "down_estimator.h", |
| 339 | "down_estimator.cc", |
| 340 | ], |
| 341 | cmd = "$(location //frc971/control_loops/python:down_estimator) $(OUTS)", |
| 342 | tools = [ |
| 343 | "//frc971/control_loops/python:down_estimator", |
| 344 | ], |
| 345 | visibility = ["//visibility:private"], |
Austin Schuh | 05c5a61 | 2016-04-02 15:10:25 -0700 | [diff] [blame] | 346 | ) |
| 347 | |
| 348 | cc_library( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 349 | name = "down_estimator", |
| 350 | srcs = [ |
| 351 | "down_estimator.cc", |
| 352 | ], |
| 353 | hdrs = [ |
| 354 | "down_estimator.h", |
| 355 | ], |
| 356 | deps = [ |
| 357 | "//frc971/control_loops:state_feedback_loop", |
| 358 | ], |
Austin Schuh | 05c5a61 | 2016-04-02 15:10:25 -0700 | [diff] [blame] | 359 | ) |
| 360 | |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 361 | cc_library( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 362 | name = "drivetrain_lib", |
| 363 | srcs = [ |
| 364 | "drivetrain.cc", |
| 365 | ], |
| 366 | hdrs = [ |
| 367 | "drivetrain.h", |
| 368 | ], |
| 369 | deps = [ |
| 370 | ":down_estimator", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 371 | ":drivetrain_goal_fbs", |
| 372 | ":drivetrain_output_fbs", |
| 373 | ":drivetrain_position_fbs", |
| 374 | ":drivetrain_status_fbs", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 375 | ":gear", |
James Kuszmaul | e39cbcf | 2019-02-27 20:48:34 -0800 | [diff] [blame] | 376 | ":line_follow_drivetrain", |
James Kuszmaul | 3431d62 | 2019-02-17 17:07:44 -0800 | [diff] [blame] | 377 | ":localizer", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 378 | ":localizer_fbs", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 379 | ":polydrivetrain", |
Alex Perry | 731b460 | 2019-02-02 22:13:01 -0800 | [diff] [blame] | 380 | ":splinedrivetrain", |
James Kuszmaul | 2ed7b3c | 2019-02-09 18:26:19 -0800 | [diff] [blame] | 381 | ":ssdrivetrain", |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 382 | "//aos/controls:control_loop", |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 383 | "//aos/util:log_interval", |
Austin Schuh | 3a37846 | 2019-01-04 21:48:04 -0800 | [diff] [blame] | 384 | "//frc971/control_loops:runge_kutta", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 385 | "//frc971/queues:gyro", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 386 | "//frc971/wpilib:imu_fbs", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 387 | ], |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 388 | ) |
| 389 | |
James Kuszmaul | 109ed8d | 2019-02-17 21:41:04 -0800 | [diff] [blame] | 390 | cc_library( |
| 391 | name = "drivetrain_test_lib", |
| 392 | testonly = True, |
| 393 | srcs = ["drivetrain_test_lib.cc"], |
| 394 | hdrs = ["drivetrain_test_lib.h"], |
| 395 | deps = [ |
| 396 | ":drivetrain_config", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 397 | ":drivetrain_goal_fbs", |
| 398 | ":drivetrain_output_fbs", |
| 399 | ":drivetrain_position_fbs", |
| 400 | ":drivetrain_status_fbs", |
James Kuszmaul | 109ed8d | 2019-02-17 21:41:04 -0800 | [diff] [blame] | 401 | ":trajectory", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 402 | "//aos/events:event_loop", |
James Kuszmaul | 109ed8d | 2019-02-17 21:41:04 -0800 | [diff] [blame] | 403 | "//aos/testing:googletest", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 404 | "//frc971/control_loops:control_loops_fbs", |
James Kuszmaul | 109ed8d | 2019-02-17 21:41:04 -0800 | [diff] [blame] | 405 | "//frc971/control_loops:state_feedback_loop", |
| 406 | "//frc971/queues:gyro", |
| 407 | "//y2016:constants", |
| 408 | "//y2016/control_loops/drivetrain:polydrivetrain_plants", |
| 409 | ], |
| 410 | ) |
| 411 | |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 412 | cc_test( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 413 | name = "drivetrain_lib_test", |
| 414 | srcs = [ |
| 415 | "drivetrain_lib_test.cc", |
| 416 | ], |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 417 | data = ["config.json"], |
Alex Perry | 04300d6 | 2019-02-17 14:37:04 -0800 | [diff] [blame] | 418 | defines = |
| 419 | cpu_select({ |
| 420 | "amd64": [ |
| 421 | "SUPPORT_PLOT=1", |
| 422 | ], |
| 423 | "arm": [], |
| 424 | }), |
| 425 | linkstatic = True, |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 426 | deps = [ |
| 427 | ":drivetrain_config", |
| 428 | ":drivetrain_lib", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 429 | ":localizer_fbs", |
| 430 | ":drivetrain_goal_fbs", |
| 431 | ":drivetrain_status_fbs", |
| 432 | ":drivetrain_position_fbs", |
| 433 | ":drivetrain_output_fbs", |
James Kuszmaul | 109ed8d | 2019-02-17 21:41:04 -0800 | [diff] [blame] | 434 | ":drivetrain_test_lib", |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 435 | "//aos/controls:control_loop_test", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 436 | "//aos/testing:googletest", |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 437 | "//frc971/queues:gyro", |
Alex Perry | 04300d6 | 2019-02-17 14:37:04 -0800 | [diff] [blame] | 438 | ] + cpu_select({ |
| 439 | "amd64": [ |
| 440 | "//third_party/matplotlib-cpp", |
| 441 | ], |
| 442 | "arm": [], |
| 443 | }), |
Comran Morshed | 5323ecb | 2015-12-26 20:50:55 +0000 | [diff] [blame] | 444 | ) |
Brian Silverman | 6260c09 | 2018-01-14 15:21:36 -0800 | [diff] [blame] | 445 | |
| 446 | genrule( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 447 | name = "genrule_haptic_wheel", |
| 448 | outs = [ |
| 449 | "haptic_wheel.h", |
| 450 | "haptic_wheel.cc", |
| 451 | "integral_haptic_wheel.h", |
| 452 | "integral_haptic_wheel.cc", |
| 453 | "haptic_trigger.h", |
| 454 | "haptic_trigger.cc", |
| 455 | "integral_haptic_trigger.h", |
| 456 | "integral_haptic_trigger.cc", |
| 457 | ], |
| 458 | cmd = "$(location //frc971/control_loops/python:haptic_wheel) $(OUTS)", |
| 459 | compatible_with = mcu_cpus, |
| 460 | tools = [ |
| 461 | "//frc971/control_loops/python:haptic_wheel", |
| 462 | ], |
| 463 | visibility = ["//visibility:private"], |
Brian Silverman | 6260c09 | 2018-01-14 15:21:36 -0800 | [diff] [blame] | 464 | ) |
| 465 | |
| 466 | cc_library( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 467 | name = "haptic_input_uc", |
| 468 | srcs = [ |
| 469 | "haptic_trigger.cc", |
| 470 | "haptic_wheel.cc", |
| 471 | "integral_haptic_trigger.cc", |
| 472 | "integral_haptic_wheel.cc", |
| 473 | ], |
| 474 | hdrs = [ |
| 475 | "haptic_trigger.h", |
| 476 | "haptic_wheel.h", |
| 477 | "integral_haptic_trigger.h", |
| 478 | "integral_haptic_wheel.h", |
| 479 | ], |
| 480 | restricted_to = mcu_cpus, |
| 481 | deps = [ |
| 482 | "//frc971/control_loops:state_feedback_loop_uc", |
| 483 | ], |
Brian Silverman | 6260c09 | 2018-01-14 15:21:36 -0800 | [diff] [blame] | 484 | ) |
| 485 | |
| 486 | cc_library( |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 487 | name = "haptic_wheel", |
| 488 | srcs = [ |
| 489 | "haptic_trigger.cc", |
| 490 | "haptic_wheel.cc", |
| 491 | "integral_haptic_trigger.cc", |
| 492 | "integral_haptic_wheel.cc", |
| 493 | ], |
| 494 | hdrs = [ |
| 495 | "haptic_trigger.h", |
| 496 | "haptic_wheel.h", |
| 497 | "integral_haptic_trigger.h", |
| 498 | "integral_haptic_wheel.h", |
| 499 | ], |
| 500 | deps = [ |
| 501 | "//frc971/control_loops:state_feedback_loop", |
| 502 | ], |
Brian Silverman | 6260c09 | 2018-01-14 15:21:36 -0800 | [diff] [blame] | 503 | ) |
Austin Schuh | c2b0877 | 2018-12-19 18:05:06 +1100 | [diff] [blame] | 504 | |
| 505 | cc_library( |
| 506 | name = "spline", |
| 507 | srcs = ["spline.cc"], |
| 508 | hdrs = ["spline.h"], |
| 509 | deps = [ |
Austin Schuh | f49b4e3 | 2019-01-13 17:26:58 -0800 | [diff] [blame] | 510 | "//frc971/control_loops:binomial", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 511 | "@org_tuxfamily_eigen//:eigen", |
Austin Schuh | c2b0877 | 2018-12-19 18:05:06 +1100 | [diff] [blame] | 512 | ], |
| 513 | ) |
| 514 | |
Alex Perry | a60da44 | 2019-01-21 19:00:27 -0500 | [diff] [blame] | 515 | cc_binary( |
| 516 | name = "spline.so", |
| 517 | srcs = ["libspline.cc"], |
James Kuszmaul | 2ed7b3c | 2019-02-09 18:26:19 -0800 | [diff] [blame] | 518 | linkshared = True, |
Alex Perry | a60da44 | 2019-01-21 19:00:27 -0500 | [diff] [blame] | 519 | deps = [ |
| 520 | ":distance_spline", |
| 521 | ":spline", |
Alex Perry | 0603b54 | 2019-01-25 20:29:51 -0800 | [diff] [blame] | 522 | ":trajectory", |
| 523 | "//aos/logging:implementations", |
| 524 | "//aos/network:team_number", |
Alex Perry | 0603b54 | 2019-01-25 20:29:51 -0800 | [diff] [blame] | 525 | "//y2019/control_loops/drivetrain:drivetrain_base", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 526 | "@org_tuxfamily_eigen//:eigen", |
Alex Perry | a60da44 | 2019-01-21 19:00:27 -0500 | [diff] [blame] | 527 | ], |
Alex Perry | a60da44 | 2019-01-21 19:00:27 -0500 | [diff] [blame] | 528 | ) |
| 529 | |
Austin Schuh | c2b0877 | 2018-12-19 18:05:06 +1100 | [diff] [blame] | 530 | cc_test( |
| 531 | name = "spline_test", |
| 532 | srcs = [ |
| 533 | "spline_test.cc", |
| 534 | ], |
| 535 | restricted_to = ["//tools:k8"], |
| 536 | deps = [ |
| 537 | ":spline", |
| 538 | "//aos/testing:googletest", |
| 539 | "//third_party/matplotlib-cpp", |
| 540 | "@com_github_gflags_gflags//:gflags", |
| 541 | ], |
| 542 | ) |
Austin Schuh | 941b46d | 2018-12-19 18:06:05 +1100 | [diff] [blame] | 543 | |
| 544 | cc_library( |
| 545 | name = "distance_spline", |
| 546 | srcs = ["distance_spline.cc"], |
| 547 | hdrs = ["distance_spline.h"], |
| 548 | deps = [ |
| 549 | ":spline", |
Austin Schuh | a6e7b21 | 2019-01-20 13:53:01 -0800 | [diff] [blame] | 550 | "//aos/logging", |
Austin Schuh | 941b46d | 2018-12-19 18:06:05 +1100 | [diff] [blame] | 551 | "//frc971/control_loops:fixed_quadrature", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 552 | "@org_tuxfamily_eigen//:eigen", |
Austin Schuh | 941b46d | 2018-12-19 18:06:05 +1100 | [diff] [blame] | 553 | ], |
| 554 | ) |
| 555 | |
| 556 | cc_test( |
| 557 | name = "distance_spline_test", |
| 558 | srcs = [ |
| 559 | "distance_spline_test.cc", |
| 560 | ], |
Austin Schuh | 9b0b643 | 2019-01-13 21:15:17 -0800 | [diff] [blame] | 561 | defines = |
| 562 | cpu_select({ |
| 563 | "amd64": [ |
| 564 | "SUPPORT_PLOT=1", |
| 565 | ], |
| 566 | "arm": [], |
| 567 | }), |
| 568 | linkstatic = True, |
Austin Schuh | 941b46d | 2018-12-19 18:06:05 +1100 | [diff] [blame] | 569 | deps = [ |
| 570 | ":distance_spline", |
| 571 | "//aos/testing:googletest", |
Austin Schuh | a6e7b21 | 2019-01-20 13:53:01 -0800 | [diff] [blame] | 572 | "//aos/testing:test_shm", |
Austin Schuh | 941b46d | 2018-12-19 18:06:05 +1100 | [diff] [blame] | 573 | "@com_github_gflags_gflags//:gflags", |
Austin Schuh | 9b0b643 | 2019-01-13 21:15:17 -0800 | [diff] [blame] | 574 | ] + cpu_select({ |
| 575 | "amd64": [ |
| 576 | "//third_party/matplotlib-cpp", |
| 577 | ], |
| 578 | "arm": [], |
| 579 | }), |
Austin Schuh | 941b46d | 2018-12-19 18:06:05 +1100 | [diff] [blame] | 580 | ) |
Austin Schuh | ec7f06d | 2019-01-04 07:47:15 +1100 | [diff] [blame] | 581 | |
| 582 | cc_library( |
| 583 | name = "trajectory", |
| 584 | srcs = ["trajectory.cc"], |
| 585 | hdrs = ["trajectory.h"], |
| 586 | deps = [ |
| 587 | ":distance_spline", |
| 588 | ":drivetrain_config", |
Austin Schuh | ec7f06d | 2019-01-04 07:47:15 +1100 | [diff] [blame] | 589 | "//frc971/control_loops:c2d", |
| 590 | "//frc971/control_loops:dlqr", |
| 591 | "//frc971/control_loops:hybrid_state_feedback_loop", |
| 592 | "//frc971/control_loops:runge_kutta", |
| 593 | "//frc971/control_loops:state_feedback_loop", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 594 | "@org_tuxfamily_eigen//:eigen", |
Austin Schuh | ec7f06d | 2019-01-04 07:47:15 +1100 | [diff] [blame] | 595 | ], |
| 596 | ) |
| 597 | |
| 598 | cc_binary( |
| 599 | name = "trajectory_plot", |
| 600 | srcs = [ |
| 601 | "trajectory_plot.cc", |
| 602 | ], |
| 603 | restricted_to = ["//tools:k8"], |
| 604 | deps = [ |
| 605 | ":distance_spline", |
| 606 | ":trajectory", |
| 607 | "//aos/logging:implementations", |
Austin Schuh | ec7f06d | 2019-01-04 07:47:15 +1100 | [diff] [blame] | 608 | "//aos/network:team_number", |
Austin Schuh | ec7f06d | 2019-01-04 07:47:15 +1100 | [diff] [blame] | 609 | "//third_party/matplotlib-cpp", |
Austin Schuh | 1104318 | 2019-03-23 22:29:12 -0700 | [diff] [blame] | 610 | "//y2019/control_loops/drivetrain:drivetrain_base", |
Austin Schuh | ec7f06d | 2019-01-04 07:47:15 +1100 | [diff] [blame] | 611 | "@com_github_gflags_gflags//:gflags", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame^] | 612 | "@org_tuxfamily_eigen//:eigen", |
Austin Schuh | ec7f06d | 2019-01-04 07:47:15 +1100 | [diff] [blame] | 613 | ], |
| 614 | ) |
| 615 | |
| 616 | cc_test( |
| 617 | name = "trajectory_test", |
| 618 | srcs = [ |
| 619 | "trajectory_test.cc", |
| 620 | ], |
Austin Schuh | 719a33e | 2019-01-07 15:13:34 -0800 | [diff] [blame] | 621 | defines = |
| 622 | cpu_select({ |
| 623 | "amd64": [ |
| 624 | "SUPPORT_PLOT=1", |
| 625 | ], |
| 626 | "arm": [], |
| 627 | }), |
| 628 | linkstatic = True, |
Austin Schuh | ec7f06d | 2019-01-04 07:47:15 +1100 | [diff] [blame] | 629 | deps = [ |
| 630 | ":trajectory", |
| 631 | "//aos/testing:googletest", |
| 632 | "//aos/testing:test_shm", |
| 633 | "//y2016:constants", |
| 634 | "//y2016/control_loops/drivetrain:polydrivetrain_plants", |
Austin Schuh | 719a33e | 2019-01-07 15:13:34 -0800 | [diff] [blame] | 635 | ] + cpu_select({ |
| 636 | "amd64": [ |
| 637 | "//third_party/matplotlib-cpp", |
| 638 | ], |
| 639 | "arm": [], |
| 640 | }), |
Austin Schuh | ec7f06d | 2019-01-04 07:47:15 +1100 | [diff] [blame] | 641 | ) |