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