Maxwell Henderson | 249d6e5 | 2024-01-14 12:58:14 -0800 | [diff] [blame] | 1 | load("//aos:config.bzl", "aos_config") |
James Kuszmaul | f01da39 | 2023-12-14 11:22:14 -0800 | [diff] [blame] | 2 | load("//aos/flatbuffers:generate.bzl", "static_flatbuffer") |
Maxwell Henderson | 3424299 | 2024-01-07 12:39:11 -0800 | [diff] [blame] | 3 | load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library") |
| 4 | |
James Kuszmaul | f01da39 | 2023-12-14 11:22:14 -0800 | [diff] [blame] | 5 | static_flatbuffer( |
Maxwell Henderson | 3424299 | 2024-01-07 12:39:11 -0800 | [diff] [blame] | 6 | name = "flywheel_controller_status_fbs", |
| 7 | srcs = [ |
| 8 | "flywheel_controller_status.fbs", |
| 9 | ], |
Maxwell Henderson | 3424299 | 2024-01-07 12:39:11 -0800 | [diff] [blame] | 10 | visibility = ["//visibility:public"], |
| 11 | ) |
| 12 | |
| 13 | flatbuffer_ts_library( |
| 14 | name = "flywheel_controller_status_ts_fbs", |
| 15 | srcs = [ |
| 16 | "flywheel_controller_status.fbs", |
| 17 | ], |
| 18 | visibility = ["//visibility:public"], |
| 19 | ) |
| 20 | |
| 21 | cc_library( |
| 22 | name = "flywheel_test_plant", |
| 23 | hdrs = [ |
| 24 | "flywheel_test_plant.h", |
| 25 | ], |
| 26 | target_compatible_with = ["@platforms//os:linux"], |
| 27 | visibility = ["//visibility:public"], |
| 28 | deps = [ |
| 29 | ":flywheel_controller", |
| 30 | ], |
| 31 | ) |
| 32 | |
| 33 | cc_library( |
| 34 | name = "flywheel_controller", |
| 35 | srcs = [ |
| 36 | "flywheel_controller.cc", |
| 37 | ], |
| 38 | hdrs = [ |
| 39 | "flywheel_controller.h", |
| 40 | ], |
| 41 | target_compatible_with = ["@platforms//os:linux"], |
| 42 | visibility = ["//visibility:public"], |
| 43 | deps = [ |
| 44 | ":flywheel_controller_status_fbs", |
| 45 | "//frc971/control_loops:control_loop", |
| 46 | "//frc971/control_loops:hybrid_state_feedback_loop", |
| 47 | "//frc971/control_loops:profiled_subsystem", |
| 48 | ], |
| 49 | ) |
Maxwell Henderson | 249d6e5 | 2024-01-14 12:58:14 -0800 | [diff] [blame] | 50 | |
| 51 | cc_test( |
| 52 | name = "flywheel_controller_test", |
| 53 | srcs = ["flywheel_controller_test.cc"], |
| 54 | data = [ |
| 55 | ":flywheel_controller_test_config", |
| 56 | ], |
| 57 | target_compatible_with = ["@platforms//os:linux"], |
| 58 | deps = [ |
| 59 | ":flywheel_controller", |
| 60 | ":flywheel_controller_test_plants", |
| 61 | ":flywheel_test_plant", |
| 62 | "//aos/testing:googletest", |
| 63 | "//frc971/control_loops:control_loop_test", |
| 64 | ], |
| 65 | ) |
| 66 | |
| 67 | aos_config( |
| 68 | name = "flywheel_controller_test_config", |
| 69 | src = "flywheel_controller_test_config_source.json", |
| 70 | flatbuffers = [ |
| 71 | "//frc971/input:joystick_state_fbs", |
| 72 | "//frc971/input:robot_state_fbs", |
| 73 | "//aos/logging:log_message_fbs", |
| 74 | "//aos/events:event_loop_fbs", |
| 75 | ":flywheel_controller_status_fbs", |
| 76 | ], |
| 77 | target_compatible_with = ["@platforms//os:linux"], |
| 78 | ) |
| 79 | |
| 80 | genrule( |
| 81 | name = "genrule_flywheel_controller_test", |
| 82 | outs = [ |
| 83 | "flywheel_controller_test_plant.h", |
| 84 | "flywheel_controller_test_plant.cc", |
| 85 | "integral_flywheel_controller_test_plant.h", |
| 86 | "integral_flywheel_controller_test_plant.cc", |
| 87 | ], |
| 88 | cmd = "$(location //frc971/control_loops/python:flywheel_controller_test) $(OUTS)", |
| 89 | target_compatible_with = ["@platforms//os:linux"], |
| 90 | tools = [ |
| 91 | "//frc971/control_loops/python:flywheel_controller_test", |
| 92 | ], |
| 93 | ) |
| 94 | |
| 95 | cc_library( |
| 96 | name = "flywheel_controller_test_plants", |
| 97 | srcs = [ |
| 98 | "flywheel_controller_test_plant.cc", |
| 99 | "integral_flywheel_controller_test_plant.cc", |
| 100 | ], |
| 101 | hdrs = [ |
| 102 | "flywheel_controller_test_plant.h", |
| 103 | "integral_flywheel_controller_test_plant.h", |
| 104 | ], |
| 105 | target_compatible_with = ["@platforms//os:linux"], |
| 106 | visibility = ["//visibility:public"], |
| 107 | deps = [ |
| 108 | "//frc971/control_loops:hybrid_state_feedback_loop", |
| 109 | "//frc971/control_loops:state_feedback_loop", |
| 110 | ], |
| 111 | ) |