blob: 7f87cca67d31d7faea22ce55eaccf82981316a03 [file] [log] [blame]
Austin Schuhbcce26a2018-03-26 23:41:24 -07001package(default_visibility = ["//visibility:public"])
Comran Morshed5323ecb2015-12-26 20:50:55 +00002
Austin Schuhbcce26a2018-03-26 23:41:24 -07003load("//aos/build:queues.bzl", "queue_library")
4load("//tools:environments.bzl", "mcu_cpus")
Comran Morshed5323ecb2015-12-26 20:50:55 +00005
6cc_binary(
Austin Schuhbcce26a2018-03-26 23:41:24 -07007 name = "replay_drivetrain",
8 srcs = [
9 "replay_drivetrain.cc",
10 ],
11 deps = [
12 ":drivetrain_queue",
John Park398c74a2018-10-20 21:17:39 -070013 "//aos:init",
Austin Schuhc2b08772018-12-19 18:05:06 +110014 "//aos/controls:replay_control_loop",
Austin Schuhbcce26a2018-03-26 23:41:24 -070015 "//frc971/queues:gyro",
16 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +000017)
18
19queue_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -070020 name = "drivetrain_queue",
21 srcs = [
22 "drivetrain.q",
23 ],
24 deps = [
John Park33858a32018-09-28 23:05:48 -070025 "//aos/controls:control_loop_queues",
Austin Schuhbcce26a2018-03-26 23:41:24 -070026 "//frc971/control_loops:queues",
27 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +000028)
29
30cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -070031 name = "drivetrain_config",
32 hdrs = [
33 "drivetrain_config.h",
34 ],
35 deps = [
36 "//frc971:shifter_hall_effect",
Austin Schuha062edb2019-01-03 13:17:13 -080037 "//frc971/control_loops:hybrid_state_feedback_loop",
Austin Schuhbcce26a2018-03-26 23:41:24 -070038 "//frc971/control_loops:state_feedback_loop",
39 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +000040)
41
42cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -070043 name = "gear",
44 hdrs = [
45 "gear.h",
46 ],
47 compatible_with = mcu_cpus,
Austin Schuh093535c2016-03-05 23:21:00 -080048)
49
50cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -070051 name = "ssdrivetrain",
52 srcs = [
53 "ssdrivetrain.cc",
54 ],
55 hdrs = [
56 "ssdrivetrain.h",
57 ],
58 deps = [
59 ":drivetrain_config",
60 ":drivetrain_queue",
61 ":gear",
John Park33858a32018-09-28 23:05:48 -070062 "//aos:math",
63 "//aos/controls:control_loop",
64 "//aos/controls:polytope",
65 "//aos/logging:matrix_logging",
66 "//aos/logging:queue_logging",
Austin Schuhc2b08772018-12-19 18:05:06 +110067 "//aos/robot_state",
John Park33858a32018-09-28 23:05:48 -070068 "//aos/util:log_interval",
69 "//aos/util:trapezoid_profile",
Austin Schuhbcce26a2018-03-26 23:41:24 -070070 "//frc971:shifter_hall_effect",
71 "//frc971/control_loops:coerce_goal",
72 "//frc971/control_loops:state_feedback_loop",
73 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +000074)
75
76cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -070077 name = "polydrivetrain",
78 srcs = [
79 "polydrivetrain.cc",
80 ],
81 hdrs = [
82 "polydrivetrain.h",
83 ],
84 deps = [
85 ":drivetrain_config",
86 ":drivetrain_queue",
87 ":gear",
John Park33858a32018-09-28 23:05:48 -070088 "//aos:math",
89 "//aos/controls:polytope",
90 "//aos/logging:matrix_logging",
91 "//aos/logging:queue_logging",
Austin Schuhc2b08772018-12-19 18:05:06 +110092 "//aos/robot_state",
John Park33858a32018-09-28 23:05:48 -070093 "//aos/util:log_interval",
Austin Schuhbcce26a2018-03-26 23:41:24 -070094 "//frc971/control_loops:coerce_goal",
95 "//frc971/control_loops:state_feedback_loop",
96 ],
97)
98
99cc_library(
100 name = "drivetrain_config_uc",
101 hdrs = [
102 "drivetrain_config.h",
103 ],
104 restricted_to = mcu_cpus,
105 deps = [
106 "//frc971:shifter_hall_effect",
107 "//frc971/control_loops:state_feedback_loop_uc",
108 ],
109)
110
111cc_library(
112 name = "polydrivetrain_uc",
113 srcs = [
114 "drivetrain_uc.q.cc",
115 "polydrivetrain.cc",
116 ],
117 hdrs = [
118 "drivetrain_uc.q.h",
119 "polydrivetrain.h",
120 ],
121 restricted_to = mcu_cpus,
122 deps = [
123 ":drivetrain_config_uc",
124 ":gear",
John Park33858a32018-09-28 23:05:48 -0700125 "//aos:math",
126 "//aos/controls:polytope_uc",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700127 "//frc971/control_loops:coerce_goal_uc",
128 "//frc971/control_loops:state_feedback_loop_uc",
129 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000130)
131
Austin Schuh05c5a612016-04-02 15:10:25 -0700132genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700133 name = "genrule_down_estimator",
134 outs = [
135 "down_estimator.h",
136 "down_estimator.cc",
137 ],
138 cmd = "$(location //frc971/control_loops/python:down_estimator) $(OUTS)",
139 tools = [
140 "//frc971/control_loops/python:down_estimator",
141 ],
142 visibility = ["//visibility:private"],
Austin Schuh05c5a612016-04-02 15:10:25 -0700143)
144
145cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700146 name = "down_estimator",
147 srcs = [
148 "down_estimator.cc",
149 ],
150 hdrs = [
151 "down_estimator.h",
152 ],
153 deps = [
154 "//frc971/control_loops:state_feedback_loop",
155 ],
Austin Schuh05c5a612016-04-02 15:10:25 -0700156)
157
Comran Morshed5323ecb2015-12-26 20:50:55 +0000158cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700159 name = "drivetrain_lib",
160 srcs = [
161 "drivetrain.cc",
162 ],
163 hdrs = [
164 "drivetrain.h",
165 ],
166 deps = [
167 ":down_estimator",
168 ":drivetrain_queue",
169 ":gear",
170 ":polydrivetrain",
171 ":ssdrivetrain",
John Park33858a32018-09-28 23:05:48 -0700172 "//aos/controls:control_loop",
173 "//aos/logging:matrix_logging",
174 "//aos/logging:queue_logging",
175 "//aos/util:log_interval",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700176 "//frc971/queues:gyro",
177 "//frc971/wpilib:imu_queue",
178 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000179)
180
181cc_test(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700182 name = "drivetrain_lib_test",
183 srcs = [
184 "drivetrain_lib_test.cc",
185 ],
186 deps = [
187 ":drivetrain_config",
188 ":drivetrain_lib",
189 ":drivetrain_queue",
John Park33858a32018-09-28 23:05:48 -0700190 "//aos:queues",
191 "//aos/controls:control_loop_test",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700192 "//aos/testing:googletest",
193 "//frc971/control_loops:state_feedback_loop",
194 "//frc971/queues:gyro",
195 "//y2016:constants",
196 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
197 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000198)
Brian Silverman6260c092018-01-14 15:21:36 -0800199
200genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700201 name = "genrule_haptic_wheel",
202 outs = [
203 "haptic_wheel.h",
204 "haptic_wheel.cc",
205 "integral_haptic_wheel.h",
206 "integral_haptic_wheel.cc",
207 "haptic_trigger.h",
208 "haptic_trigger.cc",
209 "integral_haptic_trigger.h",
210 "integral_haptic_trigger.cc",
211 ],
212 cmd = "$(location //frc971/control_loops/python:haptic_wheel) $(OUTS)",
213 compatible_with = mcu_cpus,
214 tools = [
215 "//frc971/control_loops/python:haptic_wheel",
216 ],
217 visibility = ["//visibility:private"],
Brian Silverman6260c092018-01-14 15:21:36 -0800218)
219
220cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700221 name = "haptic_input_uc",
222 srcs = [
223 "haptic_trigger.cc",
224 "haptic_wheel.cc",
225 "integral_haptic_trigger.cc",
226 "integral_haptic_wheel.cc",
227 ],
228 hdrs = [
229 "haptic_trigger.h",
230 "haptic_wheel.h",
231 "integral_haptic_trigger.h",
232 "integral_haptic_wheel.h",
233 ],
234 restricted_to = mcu_cpus,
235 deps = [
236 "//frc971/control_loops:state_feedback_loop_uc",
237 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800238)
239
240cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700241 name = "haptic_wheel",
242 srcs = [
243 "haptic_trigger.cc",
244 "haptic_wheel.cc",
245 "integral_haptic_trigger.cc",
246 "integral_haptic_wheel.cc",
247 ],
248 hdrs = [
249 "haptic_trigger.h",
250 "haptic_wheel.h",
251 "integral_haptic_trigger.h",
252 "integral_haptic_wheel.h",
253 ],
254 deps = [
255 "//frc971/control_loops:state_feedback_loop",
256 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800257)
Austin Schuhc2b08772018-12-19 18:05:06 +1100258
259cc_library(
260 name = "spline",
261 srcs = ["spline.cc"],
262 hdrs = ["spline.h"],
263 deps = [
264 "//third_party/eigen",
265 ],
266)
267
268cc_test(
269 name = "spline_test",
270 srcs = [
271 "spline_test.cc",
272 ],
273 restricted_to = ["//tools:k8"],
274 deps = [
275 ":spline",
276 "//aos/testing:googletest",
277 "//third_party/matplotlib-cpp",
278 "@com_github_gflags_gflags//:gflags",
279 ],
280)
Austin Schuh941b46d2018-12-19 18:06:05 +1100281
282cc_library(
283 name = "distance_spline",
284 srcs = ["distance_spline.cc"],
285 hdrs = ["distance_spline.h"],
286 deps = [
287 ":spline",
288 "//frc971/control_loops:fixed_quadrature",
289 "//third_party/eigen",
290 ],
291)
292
293cc_test(
294 name = "distance_spline_test",
295 srcs = [
296 "distance_spline_test.cc",
297 ],
298 restricted_to = ["//tools:k8"],
299 deps = [
300 ":distance_spline",
301 "//aos/testing:googletest",
302 "//third_party/matplotlib-cpp",
303 "@com_github_gflags_gflags//:gflags",
304 ],
305)