blob: 5f1840514c2dcddff335a6d37e3d215f3748cb9f [file] [log] [blame]
Alex Perrycb7da4b2019-08-28 19:35:56 -07001load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
Comran Morshed25f81a02016-01-23 13:40:10 +00002
Philipp Schradercc016b32021-12-30 08:59:58 -08003package(default_visibility = ["//visibility:public"])
4
Alex Perrycb7da4b2019-08-28 19:35:56 -07005flatbuffer_cc_library(
6 name = "superstructure_goal_fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -08007 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -07008 "superstructure_goal.fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -08009 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -070010 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -080011 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -070012)
13
14flatbuffer_cc_library(
15 name = "superstructure_position_fbs",
16 srcs = [
17 "superstructure_position.fbs",
18 ],
19 gen_reflections = 1,
20 includes = [
21 "//frc971/control_loops:control_loops_fbs_includes",
22 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080023 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -070024)
25
26flatbuffer_cc_library(
27 name = "superstructure_output_fbs",
28 srcs = [
29 "superstructure_output.fbs",
30 ],
31 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -080032 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -070033)
34
35flatbuffer_cc_library(
36 name = "superstructure_status_fbs",
37 srcs = [
38 "superstructure_status.fbs",
39 ],
40 gen_reflections = 1,
41 includes = [
42 "//frc971/control_loops:control_loops_fbs_includes",
Austin Schuh55a13dc2019-01-27 22:39:03 -080043 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080044 target_compatible_with = ["@platforms//os:linux"],
Comran Morshed25f81a02016-01-23 13:40:10 +000045)
46
Comran Morshed2ae094e2016-01-23 20:43:20 +000047genrule(
Austin Schuh55a13dc2019-01-27 22:39:03 -080048 name = "genrule_intake",
49 outs = [
50 "intake_plant.h",
51 "intake_plant.cc",
52 "integral_intake_plant.h",
53 "integral_intake_plant.cc",
54 ],
55 cmd = "$(location //y2016/control_loops/python:intake) $(OUTS)",
Philipp Schraderdada1072020-11-24 11:34:46 -080056 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh55a13dc2019-01-27 22:39:03 -080057 tools = [
58 "//y2016/control_loops/python:intake",
59 ],
60 visibility = ["//visibility:private"],
Comran Morshed2ae094e2016-01-23 20:43:20 +000061)
62
63genrule(
Austin Schuh55a13dc2019-01-27 22:39:03 -080064 name = "genrule_arm",
65 outs = [
66 "arm_plant.h",
67 "arm_plant.cc",
68 "integral_arm_plant.h",
69 "integral_arm_plant.cc",
70 ],
71 cmd = "$(location //y2016/control_loops/python:arm) $(OUTS)",
Philipp Schraderdada1072020-11-24 11:34:46 -080072 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh55a13dc2019-01-27 22:39:03 -080073 tools = [
74 "//y2016/control_loops/python:arm",
75 ],
76 visibility = ["//visibility:private"],
Comran Morshed2ae094e2016-01-23 20:43:20 +000077)
78
79cc_library(
Austin Schuh55a13dc2019-01-27 22:39:03 -080080 name = "superstructure_plants",
81 srcs = [
82 "arm_plant.cc",
83 "intake_plant.cc",
84 "integral_arm_plant.cc",
85 "integral_intake_plant.cc",
86 ],
87 hdrs = [
88 "arm_plant.h",
89 "intake_plant.h",
90 "integral_arm_plant.h",
91 "integral_intake_plant.h",
92 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080093 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh55a13dc2019-01-27 22:39:03 -080094 deps = [
95 "//frc971/control_loops:state_feedback_loop",
96 ],
Comran Morshed2ae094e2016-01-23 20:43:20 +000097)
98
Comran Morshed25f81a02016-01-23 13:40:10 +000099cc_library(
Austin Schuh55a13dc2019-01-27 22:39:03 -0800100 name = "superstructure_lib",
101 srcs = [
102 "superstructure.cc",
103 "superstructure_controls.cc",
104 ],
105 hdrs = [
106 "superstructure.h",
107 "superstructure_controls.h",
108 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800109 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh55a13dc2019-01-27 22:39:03 -0800110 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700111 ":superstructure_goal_fbs",
112 ":superstructure_output_fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -0800113 ":superstructure_plants",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700114 ":superstructure_position_fbs",
115 ":superstructure_status_fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -0800116 "//aos:math",
Austin Schuh55a13dc2019-01-27 22:39:03 -0800117 "//aos/util:trapezoid_profile",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700118 "//frc971/control_loops:control_loop",
Austin Schuh55a13dc2019-01-27 22:39:03 -0800119 "//frc971/control_loops:profiled_subsystem",
120 "//frc971/control_loops:simple_capped_state_feedback_loop",
121 "//frc971/control_loops:state_feedback_loop",
122 "//frc971/zeroing",
123 "//y2016:constants",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700124 "//y2016/queues:ball_detector_fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -0800125 ],
Comran Morshed25f81a02016-01-23 13:40:10 +0000126)
127
128cc_test(
Austin Schuh55a13dc2019-01-27 22:39:03 -0800129 name = "superstructure_lib_test",
130 srcs = [
131 "superstructure_lib_test.cc",
132 ],
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700133 data = ["//y2016:config"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800134 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh55a13dc2019-01-27 22:39:03 -0800135 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700136 ":superstructure_goal_fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -0800137 ":superstructure_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700138 ":superstructure_output_fbs",
139 ":superstructure_position_fbs",
140 ":superstructure_status_fbs",
Austin Schuh55a13dc2019-01-27 22:39:03 -0800141 "//aos:math",
Austin Schuh55a13dc2019-01-27 22:39:03 -0800142 "//aos/testing:googletest",
143 "//aos/time",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700144 "//frc971/control_loops:control_loop_test",
Austin Schuh55a13dc2019-01-27 22:39:03 -0800145 "//frc971/control_loops:position_sensor_sim",
146 "//frc971/control_loops:team_number_test_environment",
147 ],
Comran Morshed25f81a02016-01-23 13:40:10 +0000148)
149
150cc_binary(
Austin Schuh55a13dc2019-01-27 22:39:03 -0800151 name = "superstructure",
152 srcs = [
153 "superstructure_main.cc",
154 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800155 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh55a13dc2019-01-27 22:39:03 -0800156 deps = [
157 ":superstructure_lib",
Austin Schuh55a13dc2019-01-27 22:39:03 -0800158 "//aos:init",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700159 "//aos/events:shm_event_loop",
Austin Schuh55a13dc2019-01-27 22:39:03 -0800160 ],
Comran Morshed25f81a02016-01-23 13:40:10 +0000161)