blob: c37f3791c8be65e35930d2184f14c72e4bad567b [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",
37 "//frc971/control_loops:state_feedback_loop",
38 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +000039)
40
41cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -070042 name = "gear",
43 hdrs = [
44 "gear.h",
45 ],
46 compatible_with = mcu_cpus,
Austin Schuh093535c2016-03-05 23:21:00 -080047)
48
49cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -070050 name = "ssdrivetrain",
51 srcs = [
52 "ssdrivetrain.cc",
53 ],
54 hdrs = [
55 "ssdrivetrain.h",
56 ],
57 deps = [
58 ":drivetrain_config",
59 ":drivetrain_queue",
60 ":gear",
John Park33858a32018-09-28 23:05:48 -070061 "//aos:math",
62 "//aos/controls:control_loop",
63 "//aos/controls:polytope",
64 "//aos/logging:matrix_logging",
65 "//aos/logging:queue_logging",
Austin Schuhc2b08772018-12-19 18:05:06 +110066 "//aos/robot_state",
John Park33858a32018-09-28 23:05:48 -070067 "//aos/util:log_interval",
68 "//aos/util:trapezoid_profile",
Austin Schuhbcce26a2018-03-26 23:41:24 -070069 "//frc971:shifter_hall_effect",
70 "//frc971/control_loops:coerce_goal",
71 "//frc971/control_loops:state_feedback_loop",
72 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +000073)
74
75cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -070076 name = "polydrivetrain",
77 srcs = [
78 "polydrivetrain.cc",
79 ],
80 hdrs = [
81 "polydrivetrain.h",
82 ],
83 deps = [
84 ":drivetrain_config",
85 ":drivetrain_queue",
86 ":gear",
John Park33858a32018-09-28 23:05:48 -070087 "//aos:math",
88 "//aos/controls:polytope",
89 "//aos/logging:matrix_logging",
90 "//aos/logging:queue_logging",
Austin Schuhc2b08772018-12-19 18:05:06 +110091 "//aos/robot_state",
John Park33858a32018-09-28 23:05:48 -070092 "//aos/util:log_interval",
Austin Schuhbcce26a2018-03-26 23:41:24 -070093 "//frc971/control_loops:coerce_goal",
94 "//frc971/control_loops:state_feedback_loop",
95 ],
96)
97
98cc_library(
99 name = "drivetrain_config_uc",
100 hdrs = [
101 "drivetrain_config.h",
102 ],
103 restricted_to = mcu_cpus,
104 deps = [
105 "//frc971:shifter_hall_effect",
106 "//frc971/control_loops:state_feedback_loop_uc",
107 ],
108)
109
110cc_library(
111 name = "polydrivetrain_uc",
112 srcs = [
113 "drivetrain_uc.q.cc",
114 "polydrivetrain.cc",
115 ],
116 hdrs = [
117 "drivetrain_uc.q.h",
118 "polydrivetrain.h",
119 ],
120 restricted_to = mcu_cpus,
121 deps = [
122 ":drivetrain_config_uc",
123 ":gear",
John Park33858a32018-09-28 23:05:48 -0700124 "//aos:math",
125 "//aos/controls:polytope_uc",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700126 "//frc971/control_loops:coerce_goal_uc",
127 "//frc971/control_loops:state_feedback_loop_uc",
128 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000129)
130
Austin Schuh05c5a612016-04-02 15:10:25 -0700131genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700132 name = "genrule_down_estimator",
133 outs = [
134 "down_estimator.h",
135 "down_estimator.cc",
136 ],
137 cmd = "$(location //frc971/control_loops/python:down_estimator) $(OUTS)",
138 tools = [
139 "//frc971/control_loops/python:down_estimator",
140 ],
141 visibility = ["//visibility:private"],
Austin Schuh05c5a612016-04-02 15:10:25 -0700142)
143
144cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700145 name = "down_estimator",
146 srcs = [
147 "down_estimator.cc",
148 ],
149 hdrs = [
150 "down_estimator.h",
151 ],
152 deps = [
153 "//frc971/control_loops:state_feedback_loop",
154 ],
Austin Schuh05c5a612016-04-02 15:10:25 -0700155)
156
Comran Morshed5323ecb2015-12-26 20:50:55 +0000157cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700158 name = "drivetrain_lib",
159 srcs = [
160 "drivetrain.cc",
161 ],
162 hdrs = [
163 "drivetrain.h",
164 ],
165 deps = [
166 ":down_estimator",
167 ":drivetrain_queue",
168 ":gear",
169 ":polydrivetrain",
170 ":ssdrivetrain",
John Park33858a32018-09-28 23:05:48 -0700171 "//aos/controls:control_loop",
172 "//aos/logging:matrix_logging",
173 "//aos/logging:queue_logging",
174 "//aos/util:log_interval",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700175 "//frc971/queues:gyro",
176 "//frc971/wpilib:imu_queue",
177 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000178)
179
180cc_test(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700181 name = "drivetrain_lib_test",
182 srcs = [
183 "drivetrain_lib_test.cc",
184 ],
185 deps = [
186 ":drivetrain_config",
187 ":drivetrain_lib",
188 ":drivetrain_queue",
John Park33858a32018-09-28 23:05:48 -0700189 "//aos:queues",
190 "//aos/controls:control_loop_test",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700191 "//aos/testing:googletest",
192 "//frc971/control_loops:state_feedback_loop",
193 "//frc971/queues:gyro",
194 "//y2016:constants",
195 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
196 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000197)
Brian Silverman6260c092018-01-14 15:21:36 -0800198
199genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700200 name = "genrule_haptic_wheel",
201 outs = [
202 "haptic_wheel.h",
203 "haptic_wheel.cc",
204 "integral_haptic_wheel.h",
205 "integral_haptic_wheel.cc",
206 "haptic_trigger.h",
207 "haptic_trigger.cc",
208 "integral_haptic_trigger.h",
209 "integral_haptic_trigger.cc",
210 ],
211 cmd = "$(location //frc971/control_loops/python:haptic_wheel) $(OUTS)",
212 compatible_with = mcu_cpus,
213 tools = [
214 "//frc971/control_loops/python:haptic_wheel",
215 ],
216 visibility = ["//visibility:private"],
Brian Silverman6260c092018-01-14 15:21:36 -0800217)
218
219cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700220 name = "haptic_input_uc",
221 srcs = [
222 "haptic_trigger.cc",
223 "haptic_wheel.cc",
224 "integral_haptic_trigger.cc",
225 "integral_haptic_wheel.cc",
226 ],
227 hdrs = [
228 "haptic_trigger.h",
229 "haptic_wheel.h",
230 "integral_haptic_trigger.h",
231 "integral_haptic_wheel.h",
232 ],
233 restricted_to = mcu_cpus,
234 deps = [
235 "//frc971/control_loops:state_feedback_loop_uc",
236 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800237)
238
239cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700240 name = "haptic_wheel",
241 srcs = [
242 "haptic_trigger.cc",
243 "haptic_wheel.cc",
244 "integral_haptic_trigger.cc",
245 "integral_haptic_wheel.cc",
246 ],
247 hdrs = [
248 "haptic_trigger.h",
249 "haptic_wheel.h",
250 "integral_haptic_trigger.h",
251 "integral_haptic_wheel.h",
252 ],
253 deps = [
254 "//frc971/control_loops:state_feedback_loop",
255 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800256)
Austin Schuhc2b08772018-12-19 18:05:06 +1100257
258cc_library(
259 name = "spline",
260 srcs = ["spline.cc"],
261 hdrs = ["spline.h"],
262 deps = [
263 "//third_party/eigen",
264 ],
265)
266
267cc_test(
268 name = "spline_test",
269 srcs = [
270 "spline_test.cc",
271 ],
272 restricted_to = ["//tools:k8"],
273 deps = [
274 ":spline",
275 "//aos/testing:googletest",
276 "//third_party/matplotlib-cpp",
277 "@com_github_gflags_gflags//:gflags",
278 ],
279)
Austin Schuh941b46d2018-12-19 18:06:05 +1100280
281cc_library(
282 name = "distance_spline",
283 srcs = ["distance_spline.cc"],
284 hdrs = ["distance_spline.h"],
285 deps = [
286 ":spline",
287 "//frc971/control_loops:fixed_quadrature",
288 "//third_party/eigen",
289 ],
290)
291
292cc_test(
293 name = "distance_spline_test",
294 srcs = [
295 "distance_spline_test.cc",
296 ],
297 restricted_to = ["//tools:k8"],
298 deps = [
299 ":distance_spline",
300 "//aos/testing:googletest",
301 "//third_party/matplotlib-cpp",
302 "@com_github_gflags_gflags//:gflags",
303 ],
304)