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