blob: 5c4e8fea5ea9e3c432d9c2069121424d11ba5abe [file] [log] [blame]
James Kuszmaulf01da392023-12-14 11:22:14 -08001load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
Brian Silverman8c374e02015-09-06 23:02:21 -04002
Philipp Schradercc016b32021-12-30 08:59:58 -08003package(default_visibility = ["//visibility:public"])
4
James Kuszmaulf01da392023-12-14 11:22:14 -08005static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -07006 name = "shooter_goal_fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -08007 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -07008 "shooter_goal.fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -08009 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080010 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -070011)
12
James Kuszmaulf01da392023-12-14 11:22:14 -080013static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -070014 name = "shooter_position_fbs",
15 srcs = [
16 "shooter_position.fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -080017 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080018 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf01da392023-12-14 11:22:14 -080019 deps = [
20 "//frc971/control_loops:control_loops_fbs",
21 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -070022)
23
James Kuszmaulf01da392023-12-14 11:22:14 -080024static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -070025 name = "shooter_output_fbs",
26 srcs = [
27 "shooter_output.fbs",
28 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080029 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -070030)
31
James Kuszmaulf01da392023-12-14 11:22:14 -080032static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -070033 name = "shooter_status_fbs",
34 srcs = [
35 "shooter_status.fbs",
36 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080037 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman8c374e02015-09-06 23:02:21 -040038)
39
Austin Schuh9d4aca82015-11-08 14:41:31 -080040genrule(
Austin Schuh55a13dc2019-01-27 22:39:03 -080041 name = "genrule_shooter",
42 outs = [
43 "shooter_motor_plant.cc",
44 "shooter_motor_plant.h",
45 "unaugmented_shooter_motor_plant.cc",
46 "unaugmented_shooter_motor_plant.h",
47 ],
48 cmd = "$(location //y2014/control_loops/python:shooter) $(OUTS)",
Philipp Schraderdada1072020-11-24 11:34:46 -080049 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh55a13dc2019-01-27 22:39:03 -080050 tools = [
51 "//y2014/control_loops/python:shooter",
52 ],
53 visibility = ["//visibility:private"],
Austin Schuh9d4aca82015-11-08 14:41:31 -080054)
55
Brian Silverman8c374e02015-09-06 23:02:21 -040056cc_library(
Austin Schuh55a13dc2019-01-27 22:39:03 -080057 name = "shooter_lib",
58 srcs = [
59 "shooter.cc",
60 "shooter_motor_plant.cc",
61 "unaugmented_shooter_motor_plant.cc",
62 ],
63 hdrs = [
64 "shooter.h",
65 "shooter_motor_plant.h",
66 "unaugmented_shooter_motor_plant.h",
67 ],
68 linkopts = [
69 "-lm",
70 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080071 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh55a13dc2019-01-27 22:39:03 -080072 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -070073 ":shooter_goal_fbs",
74 ":shooter_output_fbs",
75 ":shooter_position_fbs",
76 ":shooter_status_fbs",
James Kuszmaul61750662021-06-21 21:32:33 -070077 "//frc971/control_loops:control_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -070078 "//frc971/control_loops:control_loops_fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -080079 "//frc971/control_loops:state_feedback_loop",
80 "//y2014:constants",
81 ],
Brian Silverman8c374e02015-09-06 23:02:21 -040082)
83
Brian Silverman100534c2015-09-07 15:51:23 -040084cc_test(
Austin Schuh55a13dc2019-01-27 22:39:03 -080085 name = "shooter_lib_test",
86 srcs = [
87 "shooter_lib_test.cc",
88 ],
Austin Schuhc5fa6d92022-02-25 14:36:28 -080089 data = ["//y2014:aos_config"],
Philipp Schraderdada1072020-11-24 11:34:46 -080090 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh55a13dc2019-01-27 22:39:03 -080091 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -070092 ":shooter_goal_fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -080093 ":shooter_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -070094 ":shooter_output_fbs",
95 ":shooter_position_fbs",
96 ":shooter_status_fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -080097 "//aos/testing:googletest",
Austin Schuh0a3c9d42021-07-15 22:36:24 -070098 "//frc971/control_loops:control_loop_test",
Austin Schuh55a13dc2019-01-27 22:39:03 -080099 "//frc971/control_loops:state_feedback_loop",
100 "//frc971/control_loops:team_number_test_environment",
101 ],
Brian Silverman8c374e02015-09-06 23:02:21 -0400102)
103
104cc_binary(
Austin Schuh55a13dc2019-01-27 22:39:03 -0800105 name = "shooter",
106 srcs = [
107 "shooter_main.cc",
108 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800109 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh55a13dc2019-01-27 22:39:03 -0800110 deps = [
111 ":shooter_lib",
112 "//aos:init",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700113 "//aos/events:shm_event_loop",
Austin Schuh55a13dc2019-01-27 22:39:03 -0800114 ],
Brian Silverman8c374e02015-09-06 23:02:21 -0400115)