justinT21 | 446e4f6 | 2024-06-16 22:36:10 -0700 | [diff] [blame] | 1 | load("@aspect_bazel_lib//lib:run_binary.bzl", "run_binary") |
Nikolai Sohmers | 8412fe5 | 2024-06-09 18:01:18 -0700 | [diff] [blame] | 2 | load("//aos:config.bzl", "aos_config") |
James Kuszmaul | d938d33 | 2024-05-15 20:47:19 -0700 | [diff] [blame] | 3 | load("//aos/flatbuffers:generate.bzl", "static_flatbuffer") |
| 4 | |
Nikolai Sohmers | 69ecb91 | 2024-06-08 14:06:22 -0700 | [diff] [blame] | 5 | package(default_visibility = ["//visibility:public"]) |
| 6 | |
| 7 | static_flatbuffer( |
James Kuszmaul | df6b168 | 2024-07-06 13:53:10 -0700 | [diff] [blame] | 8 | name = "swerve_zeroing_fbs", |
| 9 | srcs = ["swerve_zeroing.fbs"], |
| 10 | visibility = ["//visibility:public"], |
| 11 | deps = [ |
| 12 | "//frc971/zeroing:constants_fbs", |
| 13 | ], |
| 14 | ) |
| 15 | |
| 16 | static_flatbuffer( |
Nikolai Sohmers | 69ecb91 | 2024-06-08 14:06:22 -0700 | [diff] [blame] | 17 | name = "swerve_drivetrain_goal_fbs", |
| 18 | srcs = ["swerve_drivetrain_goal.fbs"], |
| 19 | ) |
| 20 | |
| 21 | static_flatbuffer( |
| 22 | name = "swerve_drivetrain_status_fbs", |
| 23 | srcs = ["swerve_drivetrain_status.fbs"], |
| 24 | deps = ["//frc971/control_loops:profiled_subsystem_fbs"], |
| 25 | ) |
| 26 | |
James Kuszmaul | d938d33 | 2024-05-15 20:47:19 -0700 | [diff] [blame] | 27 | static_flatbuffer( |
| 28 | name = "swerve_drivetrain_output_fbs", |
| 29 | srcs = ["swerve_drivetrain_output.fbs"], |
James Kuszmaul | d938d33 | 2024-05-15 20:47:19 -0700 | [diff] [blame] | 30 | deps = ["//frc971/control_loops:can_talonfx_fbs"], |
| 31 | ) |
| 32 | |
| 33 | static_flatbuffer( |
Nikolai Sohmers | 3f2a507 | 2024-06-08 14:05:59 -0700 | [diff] [blame] | 34 | name = "swerve_drivetrain_can_position_fbs", |
| 35 | srcs = ["swerve_drivetrain_can_position.fbs"], |
Nikolai Sohmers | 3f2a507 | 2024-06-08 14:05:59 -0700 | [diff] [blame] | 36 | deps = ["//frc971/control_loops:can_talonfx_fbs"], |
| 37 | ) |
| 38 | |
| 39 | static_flatbuffer( |
James Kuszmaul | d938d33 | 2024-05-15 20:47:19 -0700 | [diff] [blame] | 40 | name = "swerve_drivetrain_position_fbs", |
| 41 | srcs = ["swerve_drivetrain_position.fbs"], |
James Kuszmaul | d938d33 | 2024-05-15 20:47:19 -0700 | [diff] [blame] | 42 | deps = ["//frc971/control_loops:control_loops_fbs"], |
| 43 | ) |
| 44 | |
Austin Schuh | 999a19e | 2024-05-04 14:52:39 -0700 | [diff] [blame] | 45 | py_binary( |
| 46 | name = "simulation", |
| 47 | srcs = [ |
| 48 | "simulation.py", |
| 49 | ], |
| 50 | deps = [ |
| 51 | "//frc971/control_loops/python:controls", |
| 52 | "@pip//matplotlib", |
| 53 | "@pip//numpy", |
| 54 | "@pip//pygobject", |
| 55 | "@pip//sympy", |
| 56 | ], |
| 57 | ) |
Nikolai Sohmers | 8412fe5 | 2024-06-09 18:01:18 -0700 | [diff] [blame] | 58 | |
| 59 | cc_library( |
| 60 | name = "swerve_control_loops", |
| 61 | srcs = ["swerve_control_loops.cc"], |
| 62 | hdrs = ["swerve_control_loops.h"], |
| 63 | target_compatible_with = ["@platforms//os:linux"], |
| 64 | deps = [ |
| 65 | ":swerve_drivetrain_can_position_fbs", |
| 66 | ":swerve_drivetrain_goal_fbs", |
| 67 | ":swerve_drivetrain_output_fbs", |
| 68 | ":swerve_drivetrain_position_fbs", |
| 69 | ":swerve_drivetrain_status_fbs", |
Nikolai Sohmers | 308c899 | 2024-06-22 15:11:05 -0700 | [diff] [blame] | 70 | ":swerve_zeroing_fbs", |
Nikolai Sohmers | 8412fe5 | 2024-06-09 18:01:18 -0700 | [diff] [blame] | 71 | "//frc971/control_loops:control_loop", |
Nikolai Sohmers | 308c899 | 2024-06-22 15:11:05 -0700 | [diff] [blame] | 72 | "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem", |
| 73 | "//frc971/zeroing:continuous_absolute_encoder", |
Nikolai Sohmers | 8412fe5 | 2024-06-09 18:01:18 -0700 | [diff] [blame] | 74 | ], |
| 75 | ) |
| 76 | |
| 77 | cc_test( |
| 78 | name = "swerve_control_test", |
| 79 | srcs = ["swerve_control_test.cc"], |
| 80 | data = [ |
| 81 | ":aos_config", |
Nikolai Sohmers | 308c899 | 2024-06-22 15:11:05 -0700 | [diff] [blame] | 82 | "//frc971/control_loops/swerve/test_module:rotation_json", |
Nikolai Sohmers | 8412fe5 | 2024-06-09 18:01:18 -0700 | [diff] [blame] | 83 | ], |
| 84 | target_compatible_with = ["@platforms//os:linux"], |
| 85 | deps = [ |
| 86 | ":swerve_control_loops", |
| 87 | ":swerve_drivetrain_can_position_fbs", |
| 88 | ":swerve_drivetrain_goal_fbs", |
| 89 | ":swerve_drivetrain_output_fbs", |
| 90 | ":swerve_drivetrain_position_fbs", |
| 91 | ":swerve_drivetrain_status_fbs", |
| 92 | "//aos/events:shm_event_loop", |
| 93 | "//aos/testing:googletest", |
| 94 | "//frc971/control_loops:control_loop_test", |
| 95 | "//frc971/control_loops:state_feedback_loop", |
| 96 | "//frc971/control_loops:team_number_test_environment", |
| 97 | ], |
| 98 | ) |
| 99 | |
| 100 | aos_config( |
| 101 | name = "aos_config", |
| 102 | src = "swerve.json", |
| 103 | flatbuffers = [ |
| 104 | ":swerve_drivetrain_goal_fbs", |
| 105 | ":swerve_drivetrain_output_fbs", |
| 106 | ":swerve_drivetrain_position_fbs", |
| 107 | ":swerve_drivetrain_can_position_fbs", |
| 108 | ":swerve_drivetrain_status_fbs", |
| 109 | ], |
| 110 | target_compatible_with = ["@platforms//os:linux"], |
| 111 | deps = ["//frc971/input:aos_config"], |
| 112 | ) |
justinT21 | 446e4f6 | 2024-06-16 22:36:10 -0700 | [diff] [blame] | 113 | |
| 114 | cc_library( |
| 115 | name = "motors", |
| 116 | hdrs = [ |
| 117 | "motors.h", |
| 118 | ], |
| 119 | deps = [ |
| 120 | "@symengine", |
| 121 | ], |
| 122 | ) |
| 123 | |
| 124 | cc_binary( |
| 125 | name = "generate_physics", |
| 126 | srcs = [ |
| 127 | "generate_physics.cc", |
| 128 | ], |
| 129 | deps = [ |
| 130 | ":motors", |
| 131 | "//aos:init", |
| 132 | "//aos/util:file", |
Austin Schuh | 99f7c6a | 2024-06-25 22:07:44 -0700 | [diff] [blame] | 133 | "@com_google_absl//absl/log", |
| 134 | "@com_google_absl//absl/log:check", |
justinT21 | 446e4f6 | 2024-06-16 22:36:10 -0700 | [diff] [blame] | 135 | "@com_google_absl//absl/strings", |
| 136 | "@com_google_absl//absl/strings:str_format", |
| 137 | "@symengine", |
| 138 | ], |
| 139 | ) |
| 140 | |
| 141 | run_binary( |
Austin Schuh | 27694fa | 2024-07-20 16:29:49 -0700 | [diff] [blame] | 142 | name = "dynamics_codegen_cc", |
justinT21 | 446e4f6 | 2024-06-16 22:36:10 -0700 | [diff] [blame] | 143 | outs = [ |
| 144 | "dynamics.cc", |
| 145 | "dynamics.h", |
justinT21 | 942892b | 2024-07-02 22:33:50 -0700 | [diff] [blame] | 146 | "dynamics.py", |
Austin Schuh | a9550c0 | 2024-10-19 13:48:10 -0700 | [diff] [blame] | 147 | "dynamics_constants.py", |
justinT21 | 446e4f6 | 2024-06-16 22:36:10 -0700 | [diff] [blame] | 148 | ], |
| 149 | args = [ |
| 150 | "--output_base=$(BINDIR)/", |
| 151 | "--cc_output_path=$(location :dynamics.cc)", |
| 152 | "--h_output_path=$(location :dynamics.h)", |
Austin Schuh | 0f88109 | 2024-06-28 15:36:48 -0700 | [diff] [blame] | 153 | "--casadi_py_output_path=$(location :dynamics.py)", |
Austin Schuh | a9550c0 | 2024-10-19 13:48:10 -0700 | [diff] [blame] | 154 | "--constants_output_path=$(location :dynamics_constants.py)", |
justinT21 | 446e4f6 | 2024-06-16 22:36:10 -0700 | [diff] [blame] | 155 | ], |
| 156 | tool = ":generate_physics", |
| 157 | ) |
| 158 | |
Austin Schuh | 27694fa | 2024-07-20 16:29:49 -0700 | [diff] [blame] | 159 | run_binary( |
| 160 | name = "dynamics_codegen_nocaster", |
| 161 | outs = [ |
| 162 | "nocaster_dynamics.py", |
| 163 | ], |
| 164 | args = [ |
| 165 | "--caster=0.0", |
| 166 | "--output_base=$(BINDIR)/", |
| 167 | "--casadi_py_output_path=$(location :nocaster_dynamics.py)", |
| 168 | ], |
| 169 | tool = ":generate_physics", |
| 170 | ) |
| 171 | |
| 172 | run_binary( |
| 173 | name = "dynamics_codegen_bigcaster", |
| 174 | outs = [ |
| 175 | "bigcaster_dynamics.py", |
| 176 | ], |
| 177 | args = [ |
| 178 | "--caster=0.05", |
| 179 | "--output_base=$(BINDIR)/", |
| 180 | "--casadi_py_output_path=$(location :bigcaster_dynamics.py)", |
| 181 | ], |
| 182 | tool = ":generate_physics", |
| 183 | ) |
| 184 | |
justinT21 | 446e4f6 | 2024-06-16 22:36:10 -0700 | [diff] [blame] | 185 | cc_library( |
justinT21 | 07d41ed | 2024-07-31 21:12:31 -0700 | [diff] [blame] | 186 | name = "eigen_dynamics", |
justinT21 | 446e4f6 | 2024-06-16 22:36:10 -0700 | [diff] [blame] | 187 | srcs = ["dynamics.cc"], |
| 188 | hdrs = ["dynamics.h"], |
| 189 | deps = [ |
| 190 | "@org_tuxfamily_eigen//:eigen", |
| 191 | ], |
| 192 | ) |
justinT21 | 942892b | 2024-07-02 22:33:50 -0700 | [diff] [blame] | 193 | |
Austin Schuh | 6ea789e | 2024-07-27 13:45:53 -0700 | [diff] [blame] | 194 | py_library( |
| 195 | name = "dynamics", |
justinT21 | 942892b | 2024-07-02 22:33:50 -0700 | [diff] [blame] | 196 | srcs = [ |
Austin Schuh | 6ea789e | 2024-07-27 13:45:53 -0700 | [diff] [blame] | 197 | "bigcaster_dynamics.py", |
| 198 | "dynamics.py", |
| 199 | "nocaster_dynamics.py", |
justinT21 | 942892b | 2024-07-02 22:33:50 -0700 | [diff] [blame] | 200 | ], |
| 201 | deps = [ |
Austin Schuh | 6ea789e | 2024-07-27 13:45:53 -0700 | [diff] [blame] | 202 | "@pip//casadi", |
justinT21 | 942892b | 2024-07-02 22:33:50 -0700 | [diff] [blame] | 203 | ], |
| 204 | ) |
Austin Schuh | 2a1abec | 2024-07-10 20:31:16 -0700 | [diff] [blame] | 205 | |
Austin Schuh | 76534f3 | 2024-09-02 13:52:45 -0700 | [diff] [blame] | 206 | py_library( |
| 207 | name = "jax_dynamics", |
| 208 | srcs = [ |
Austin Schuh | a9550c0 | 2024-10-19 13:48:10 -0700 | [diff] [blame] | 209 | "dynamics_constants.py", |
Austin Schuh | 76534f3 | 2024-09-02 13:52:45 -0700 | [diff] [blame] | 210 | "jax_dynamics.py", |
| 211 | ], |
| 212 | deps = [ |
Austin Schuh | 76534f3 | 2024-09-02 13:52:45 -0700 | [diff] [blame] | 213 | "//frc971/control_loops/python:controls", |
| 214 | "@pip//jax", |
| 215 | ], |
| 216 | ) |
| 217 | |
Austin Schuh | 2a1abec | 2024-07-10 20:31:16 -0700 | [diff] [blame] | 218 | py_test( |
Austin Schuh | 76534f3 | 2024-09-02 13:52:45 -0700 | [diff] [blame] | 219 | name = "physics_test_cpu", |
Austin Schuh | 2a1abec | 2024-07-10 20:31:16 -0700 | [diff] [blame] | 220 | srcs = [ |
Austin Schuh | 2a1abec | 2024-07-10 20:31:16 -0700 | [diff] [blame] | 221 | "physics_test.py", |
| 222 | ], |
James Kuszmaul | ef14ab4 | 2024-09-14 15:05:24 -0700 | [diff] [blame] | 223 | data = [":cpp_dynamics.so"], |
Austin Schuh | 76534f3 | 2024-09-02 13:52:45 -0700 | [diff] [blame] | 224 | env = { |
| 225 | "JAX_PLATFORMS": "cpu", |
| 226 | }, |
| 227 | main = "physics_test.py", |
Austin Schuh | 2a1abec | 2024-07-10 20:31:16 -0700 | [diff] [blame] | 228 | target_compatible_with = ["@platforms//cpu:x86_64"], |
| 229 | deps = [ |
Austin Schuh | 5dac229 | 2024-10-19 13:56:58 -0700 | [diff] [blame] | 230 | ":casadi_velocity_mpc_lib", |
Austin Schuh | 6ea789e | 2024-07-27 13:45:53 -0700 | [diff] [blame] | 231 | ":dynamics", |
Austin Schuh | 76534f3 | 2024-09-02 13:52:45 -0700 | [diff] [blame] | 232 | ":jax_dynamics", |
| 233 | ":physics_test_utils", |
Austin Schuh | 5dac229 | 2024-10-19 13:56:58 -0700 | [diff] [blame] | 234 | "@pip//absl_py", |
Austin Schuh | 76534f3 | 2024-09-02 13:52:45 -0700 | [diff] [blame] | 235 | "@pip//casadi", |
Austin Schuh | 5dac229 | 2024-10-19 13:56:58 -0700 | [diff] [blame] | 236 | "@pip//matplotlib", |
Austin Schuh | 76534f3 | 2024-09-02 13:52:45 -0700 | [diff] [blame] | 237 | "@pip//numpy", |
Austin Schuh | 5dac229 | 2024-10-19 13:56:58 -0700 | [diff] [blame] | 238 | "@pip//pygobject", |
Austin Schuh | 76534f3 | 2024-09-02 13:52:45 -0700 | [diff] [blame] | 239 | "@pip//scipy", |
| 240 | ], |
| 241 | ) |
| 242 | |
| 243 | py_test( |
| 244 | name = "physics_test_gpu", |
| 245 | srcs = [ |
| 246 | "physics_test.py", |
| 247 | ], |
James Kuszmaul | ef14ab4 | 2024-09-14 15:05:24 -0700 | [diff] [blame] | 248 | data = [":cpp_dynamics.so"], |
Austin Schuh | 76534f3 | 2024-09-02 13:52:45 -0700 | [diff] [blame] | 249 | env = { |
| 250 | "JAX_PLATFORMS": "cuda", |
| 251 | }, |
| 252 | main = "physics_test.py", |
| 253 | target_compatible_with = ["@platforms//cpu:x86_64"], |
| 254 | deps = [ |
Austin Schuh | 5dac229 | 2024-10-19 13:56:58 -0700 | [diff] [blame] | 255 | ":casadi_velocity_mpc_lib", |
Austin Schuh | 76534f3 | 2024-09-02 13:52:45 -0700 | [diff] [blame] | 256 | ":dynamics", |
| 257 | ":jax_dynamics", |
justinT21 | 07d41ed | 2024-07-31 21:12:31 -0700 | [diff] [blame] | 258 | ":physics_test_utils", |
Austin Schuh | 5dac229 | 2024-10-19 13:56:58 -0700 | [diff] [blame] | 259 | "@pip//absl_py", |
| 260 | "@pip//casadi", |
| 261 | "@pip//matplotlib", |
| 262 | "@pip//numpy", |
| 263 | "@pip//pygobject", |
| 264 | "@pip//scipy", |
| 265 | ], |
| 266 | ) |
| 267 | |
| 268 | py_binary( |
| 269 | name = "casadi_velocity_mpc_lib", |
| 270 | srcs = [ |
| 271 | "casadi_velocity_mpc_lib.py", |
| 272 | ], |
| 273 | deps = [ |
| 274 | ":dynamics", |
Austin Schuh | 2a1abec | 2024-07-10 20:31:16 -0700 | [diff] [blame] | 275 | "@pip//casadi", |
| 276 | "@pip//numpy", |
| 277 | ], |
| 278 | ) |
justinT21 | 07d41ed | 2024-07-31 21:12:31 -0700 | [diff] [blame] | 279 | |
Austin Schuh | 6ea789e | 2024-07-27 13:45:53 -0700 | [diff] [blame] | 280 | py_binary( |
| 281 | name = "casadi_velocity_mpc", |
justinT21 | 07d41ed | 2024-07-31 21:12:31 -0700 | [diff] [blame] | 282 | srcs = [ |
Austin Schuh | 6ea789e | 2024-07-27 13:45:53 -0700 | [diff] [blame] | 283 | "casadi_velocity_mpc.py", |
justinT21 | 07d41ed | 2024-07-31 21:12:31 -0700 | [diff] [blame] | 284 | ], |
| 285 | deps = [ |
Austin Schuh | 5dac229 | 2024-10-19 13:56:58 -0700 | [diff] [blame] | 286 | ":casadi_velocity_mpc_lib", |
Austin Schuh | 9289e6e | 2024-09-02 13:10:12 -0700 | [diff] [blame] | 287 | "@pip//absl_py", |
Austin Schuh | 6ea789e | 2024-07-27 13:45:53 -0700 | [diff] [blame] | 288 | "@pip//matplotlib", |
| 289 | "@pip//numpy", |
| 290 | "@pip//pygobject", |
| 291 | "@pip//scipy", |
justinT21 | 07d41ed | 2024-07-31 21:12:31 -0700 | [diff] [blame] | 292 | ], |
| 293 | ) |
| 294 | |
Austin Schuh | 9f57e5b | 2024-10-26 17:27:36 -0700 | [diff] [blame] | 295 | py_binary( |
| 296 | name = "experience_collector", |
| 297 | srcs = [ |
| 298 | "experience_collector.py", |
| 299 | ], |
| 300 | deps = [ |
| 301 | ":casadi_velocity_mpc_lib", |
| 302 | ":jax_dynamics", |
| 303 | "//frc971/control_loops/swerve/velocity_controller:physics", |
| 304 | "@pip//absl_py", |
| 305 | "@pip//matplotlib", |
| 306 | "@pip//numpy", |
| 307 | "@pip//pygobject", |
| 308 | "@pip//scipy", |
| 309 | "@pip//tensorflow", |
| 310 | ], |
| 311 | ) |
| 312 | |
| 313 | py_binary( |
| 314 | name = "multi_experience_collector", |
| 315 | srcs = ["multi_experience_collector.py"], |
| 316 | data = [":experience_collector"], |
| 317 | deps = [ |
| 318 | "@pip//absl_py", |
| 319 | ], |
| 320 | ) |
| 321 | |
justinT21 | 07d41ed | 2024-07-31 21:12:31 -0700 | [diff] [blame] | 322 | py_library( |
| 323 | name = "physics_test_utils", |
| 324 | srcs = [ |
| 325 | "physics_test_utils.py", |
| 326 | ], |
| 327 | deps = [ |
| 328 | ":dynamics", |
| 329 | "@pip//casadi", |
| 330 | "@pip//numpy", |
| 331 | ], |
| 332 | ) |
| 333 | |
| 334 | py_binary( |
| 335 | name = "physics_debug", |
| 336 | srcs = [ |
| 337 | "physics_debug.py", |
| 338 | ], |
| 339 | deps = [ |
| 340 | ":physics_test_utils", |
| 341 | "@pip//matplotlib", |
| 342 | "@pip//pygobject", |
| 343 | "@pip//scipy", |
| 344 | ], |
| 345 | ) |
Austin Schuh | 7fa6521 | 2024-08-18 17:20:58 -0700 | [diff] [blame] | 346 | |
| 347 | py_binary( |
| 348 | name = "debug_fatrop", |
| 349 | srcs = [ |
| 350 | "debug_fatrop.py", |
| 351 | ], |
| 352 | deps = [ |
| 353 | "@pip//casadi", |
| 354 | "@pip//matplotlib", |
| 355 | "@pip//numpy", |
| 356 | "@pip//pygobject", |
| 357 | "@pip//scipy", |
| 358 | ], |
| 359 | ) |
justinT21 | cc6eed0 | 2024-08-26 00:15:57 -0700 | [diff] [blame] | 360 | |
| 361 | py_binary( |
| 362 | name = "smooth_function_graph", |
| 363 | srcs = [ |
| 364 | "smooth_function_graph.py", |
| 365 | ], |
| 366 | deps = [ |
| 367 | "@pip//matplotlib", |
| 368 | "@pip//numpy", |
| 369 | "@pip//pygobject", |
| 370 | "@pip//scipy", |
| 371 | ], |
| 372 | ) |
Austin Schuh | 3aa49ab | 2024-09-02 13:14:26 -0700 | [diff] [blame] | 373 | |
| 374 | py_binary( |
| 375 | name = "multi_casadi_velocity_mpc", |
| 376 | srcs = ["multi_casadi_velocity_mpc.py"], |
| 377 | data = [":casadi_velocity_mpc"], |
| 378 | deps = [ |
| 379 | ":dynamics", |
| 380 | "@pip//absl_py", |
| 381 | "@pip//matplotlib", |
| 382 | "@pip//numpy", |
| 383 | "@pip//pygobject", |
| 384 | ], |
| 385 | ) |
James Kuszmaul | ef14ab4 | 2024-09-14 15:05:24 -0700 | [diff] [blame] | 386 | |
| 387 | cc_binary( |
| 388 | name = "cpp_dynamics.so", |
| 389 | # Just use the python dynamics directly if you want them; this is just for testing. |
| 390 | testonly = True, |
| 391 | srcs = ["dynamics_python_bindings.cc"], |
| 392 | linkshared = True, |
| 393 | target_compatible_with = ["@platforms//os:linux"], |
| 394 | deps = [ |
| 395 | ":eigen_dynamics", |
| 396 | "//third_party/python", |
| 397 | "@com_google_absl//absl/log", |
| 398 | "@com_google_absl//absl/log:check", |
| 399 | ], |
| 400 | ) |
James Kuszmaul | 43504bf | 2024-10-08 23:28:11 -0700 | [diff] [blame] | 401 | |
| 402 | cc_library( |
James Kuszmaul | 886675c | 2024-10-09 20:32:00 -0700 | [diff] [blame] | 403 | name = "linearization_utils", |
| 404 | hdrs = ["linearization_utils.h"], |
| 405 | ) |
| 406 | |
| 407 | cc_library( |
| 408 | name = "linearized_controller", |
| 409 | hdrs = ["linearized_controller.h"], |
| 410 | deps = [ |
| 411 | ":eigen_dynamics", |
| 412 | ":linearization_utils", |
| 413 | "//frc971/control_loops:c2d", |
| 414 | "//frc971/control_loops:dlqr", |
| 415 | "//frc971/control_loops:jacobian", |
| 416 | "@com_google_absl//absl/log", |
| 417 | "@com_google_absl//absl/log:check", |
| 418 | ], |
| 419 | ) |
| 420 | |
| 421 | cc_test( |
| 422 | name = "linearized_controller_test", |
| 423 | srcs = ["linearized_controller_test.cc"], |
| 424 | deps = [ |
| 425 | ":linearized_controller", |
| 426 | "//aos/testing:googletest", |
| 427 | ], |
| 428 | ) |
| 429 | |
| 430 | cc_library( |
James Kuszmaul | 43504bf | 2024-10-08 23:28:11 -0700 | [diff] [blame] | 431 | name = "auto_diff_jacobian", |
| 432 | hdrs = ["auto_diff_jacobian.h"], |
| 433 | target_compatible_with = ["@platforms//os:linux"], |
| 434 | deps = [ |
| 435 | "@com_google_ceres_solver//:ceres", |
| 436 | ], |
| 437 | ) |
| 438 | |
| 439 | cc_test( |
| 440 | name = "auto_diff_jacobian_test", |
| 441 | srcs = ["auto_diff_jacobian_test.cc"], |
| 442 | deps = [ |
| 443 | ":auto_diff_jacobian", |
| 444 | "//aos/testing:googletest", |
| 445 | ], |
| 446 | ) |
James Kuszmaul | de44eb5 | 2024-10-08 23:39:24 -0700 | [diff] [blame] | 447 | |
| 448 | cc_library( |
| 449 | name = "simplified_dynamics", |
| 450 | hdrs = ["simplified_dynamics.h"], |
| 451 | deps = [ |
| 452 | ":auto_diff_jacobian", |
| 453 | ":eigen_dynamics", |
| 454 | ":motors", |
| 455 | "//aos/util:math", |
| 456 | "@com_google_absl//absl/log", |
| 457 | "@com_google_absl//absl/log:check", |
| 458 | ], |
| 459 | ) |
| 460 | |
| 461 | cc_test( |
| 462 | name = "simplified_dynamics_test", |
| 463 | srcs = ["simplified_dynamics_test.cc"], |
| 464 | deps = [ |
| 465 | ":simplified_dynamics", |
| 466 | "//aos/testing:googletest", |
| 467 | "//aos/time", |
| 468 | "//frc971/control_loops:jacobian", |
| 469 | "@com_google_absl//absl/log", |
| 470 | ], |
| 471 | ) |