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