Add a flywheel controller test
Signed-off-by: Maxwell Henderson <mxwhenderson@gmail.com>
Change-Id: Ifcead97b1abb04e2a5e013ede85571f0283b7ed8
diff --git a/frc971/control_loops/flywheel/BUILD b/frc971/control_loops/flywheel/BUILD
index 0cf5d00..f077682 100644
--- a/frc971/control_loops/flywheel/BUILD
+++ b/frc971/control_loops/flywheel/BUILD
@@ -1,3 +1,4 @@
+load("//aos:config.bzl", "aos_config")
load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
@@ -46,3 +47,65 @@
"//frc971/control_loops:profiled_subsystem",
],
)
+
+cc_test(
+ name = "flywheel_controller_test",
+ srcs = ["flywheel_controller_test.cc"],
+ data = [
+ ":flywheel_controller_test_config",
+ ],
+ target_compatible_with = ["@platforms//os:linux"],
+ deps = [
+ ":flywheel_controller",
+ ":flywheel_controller_test_plants",
+ ":flywheel_test_plant",
+ "//aos/testing:googletest",
+ "//frc971/control_loops:control_loop_test",
+ ],
+)
+
+aos_config(
+ name = "flywheel_controller_test_config",
+ src = "flywheel_controller_test_config_source.json",
+ flatbuffers = [
+ "//frc971/input:joystick_state_fbs",
+ "//frc971/input:robot_state_fbs",
+ "//aos/logging:log_message_fbs",
+ "//aos/events:event_loop_fbs",
+ ":flywheel_controller_status_fbs",
+ ],
+ target_compatible_with = ["@platforms//os:linux"],
+)
+
+genrule(
+ name = "genrule_flywheel_controller_test",
+ outs = [
+ "flywheel_controller_test_plant.h",
+ "flywheel_controller_test_plant.cc",
+ "integral_flywheel_controller_test_plant.h",
+ "integral_flywheel_controller_test_plant.cc",
+ ],
+ cmd = "$(location //frc971/control_loops/python:flywheel_controller_test) $(OUTS)",
+ target_compatible_with = ["@platforms//os:linux"],
+ tools = [
+ "//frc971/control_loops/python:flywheel_controller_test",
+ ],
+)
+
+cc_library(
+ name = "flywheel_controller_test_plants",
+ srcs = [
+ "flywheel_controller_test_plant.cc",
+ "integral_flywheel_controller_test_plant.cc",
+ ],
+ hdrs = [
+ "flywheel_controller_test_plant.h",
+ "integral_flywheel_controller_test_plant.h",
+ ],
+ target_compatible_with = ["@platforms//os:linux"],
+ visibility = ["//visibility:public"],
+ deps = [
+ "//frc971/control_loops:hybrid_state_feedback_loop",
+ "//frc971/control_loops:state_feedback_loop",
+ ],
+)