blob: 6dbee5253ba4b84629c9cf4bdb192f0a359e5ad2 [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 ],
Brian Silverman7a7c24d2018-09-01 17:49:09 -070024 compatible_with = [
25 "//tools:armhf-debian",
26 ],
Austin Schuhbcce26a2018-03-26 23:41:24 -070027 deps = [
John Park33858a32018-09-28 23:05:48 -070028 "//aos/controls:control_loop_queues",
Austin Schuhbcce26a2018-03-26 23:41:24 -070029 "//frc971/control_loops:queues",
30 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +000031)
32
33cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -070034 name = "drivetrain_config",
35 hdrs = [
36 "drivetrain_config.h",
37 ],
38 deps = [
39 "//frc971:shifter_hall_effect",
40 "//frc971/control_loops:state_feedback_loop",
41 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +000042)
43
44cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -070045 name = "gear",
46 hdrs = [
47 "gear.h",
48 ],
49 compatible_with = mcu_cpus,
Austin Schuh093535c2016-03-05 23:21:00 -080050)
51
52cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -070053 name = "ssdrivetrain",
54 srcs = [
55 "ssdrivetrain.cc",
56 ],
57 hdrs = [
58 "ssdrivetrain.h",
59 ],
60 deps = [
61 ":drivetrain_config",
62 ":drivetrain_queue",
63 ":gear",
John Park33858a32018-09-28 23:05:48 -070064 "//aos:math",
65 "//aos/controls:control_loop",
66 "//aos/controls:polytope",
67 "//aos/logging:matrix_logging",
68 "//aos/logging:queue_logging",
Austin Schuhc2b08772018-12-19 18:05:06 +110069 "//aos/robot_state",
John Park33858a32018-09-28 23:05:48 -070070 "//aos/util:log_interval",
71 "//aos/util:trapezoid_profile",
Austin Schuhbcce26a2018-03-26 23:41:24 -070072 "//frc971:shifter_hall_effect",
73 "//frc971/control_loops:coerce_goal",
74 "//frc971/control_loops:state_feedback_loop",
75 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +000076)
77
78cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -070079 name = "polydrivetrain",
80 srcs = [
81 "polydrivetrain.cc",
82 ],
83 hdrs = [
84 "polydrivetrain.h",
85 ],
86 deps = [
87 ":drivetrain_config",
88 ":drivetrain_queue",
89 ":gear",
John Park33858a32018-09-28 23:05:48 -070090 "//aos:math",
91 "//aos/controls:polytope",
92 "//aos/logging:matrix_logging",
93 "//aos/logging:queue_logging",
Austin Schuhc2b08772018-12-19 18:05:06 +110094 "//aos/robot_state",
John Park33858a32018-09-28 23:05:48 -070095 "//aos/util:log_interval",
Austin Schuhbcce26a2018-03-26 23:41:24 -070096 "//frc971/control_loops:coerce_goal",
97 "//frc971/control_loops:state_feedback_loop",
98 ],
99)
100
101cc_library(
102 name = "drivetrain_config_uc",
103 hdrs = [
104 "drivetrain_config.h",
105 ],
106 restricted_to = mcu_cpus,
107 deps = [
108 "//frc971:shifter_hall_effect",
109 "//frc971/control_loops:state_feedback_loop_uc",
110 ],
111)
112
113cc_library(
114 name = "polydrivetrain_uc",
115 srcs = [
116 "drivetrain_uc.q.cc",
117 "polydrivetrain.cc",
118 ],
119 hdrs = [
120 "drivetrain_uc.q.h",
121 "polydrivetrain.h",
122 ],
123 restricted_to = mcu_cpus,
124 deps = [
125 ":drivetrain_config_uc",
126 ":gear",
John Park33858a32018-09-28 23:05:48 -0700127 "//aos:math",
128 "//aos/controls:polytope_uc",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700129 "//frc971/control_loops:coerce_goal_uc",
130 "//frc971/control_loops:state_feedback_loop_uc",
131 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000132)
133
Austin Schuh05c5a612016-04-02 15:10:25 -0700134genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700135 name = "genrule_down_estimator",
136 outs = [
137 "down_estimator.h",
138 "down_estimator.cc",
139 ],
140 cmd = "$(location //frc971/control_loops/python:down_estimator) $(OUTS)",
141 tools = [
142 "//frc971/control_loops/python:down_estimator",
143 ],
144 visibility = ["//visibility:private"],
Austin Schuh05c5a612016-04-02 15:10:25 -0700145)
146
147cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700148 name = "down_estimator",
149 srcs = [
150 "down_estimator.cc",
151 ],
152 hdrs = [
153 "down_estimator.h",
154 ],
155 deps = [
156 "//frc971/control_loops:state_feedback_loop",
157 ],
Austin Schuh05c5a612016-04-02 15:10:25 -0700158)
159
Comran Morshed5323ecb2015-12-26 20:50:55 +0000160cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700161 name = "drivetrain_lib",
162 srcs = [
163 "drivetrain.cc",
164 ],
165 hdrs = [
166 "drivetrain.h",
167 ],
168 deps = [
169 ":down_estimator",
170 ":drivetrain_queue",
171 ":gear",
172 ":polydrivetrain",
173 ":ssdrivetrain",
John Park33858a32018-09-28 23:05:48 -0700174 "//aos/controls:control_loop",
175 "//aos/logging:matrix_logging",
176 "//aos/logging:queue_logging",
177 "//aos/util:log_interval",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700178 "//frc971/queues:gyro",
179 "//frc971/wpilib:imu_queue",
180 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000181)
182
183cc_test(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700184 name = "drivetrain_lib_test",
185 srcs = [
186 "drivetrain_lib_test.cc",
187 ],
188 deps = [
189 ":drivetrain_config",
190 ":drivetrain_lib",
191 ":drivetrain_queue",
John Park33858a32018-09-28 23:05:48 -0700192 "//aos:queues",
193 "//aos/controls:control_loop_test",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700194 "//aos/testing:googletest",
195 "//frc971/control_loops:state_feedback_loop",
196 "//frc971/queues:gyro",
197 "//y2016:constants",
198 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
199 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000200)
Brian Silverman6260c092018-01-14 15:21:36 -0800201
202genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700203 name = "genrule_haptic_wheel",
204 outs = [
205 "haptic_wheel.h",
206 "haptic_wheel.cc",
207 "integral_haptic_wheel.h",
208 "integral_haptic_wheel.cc",
209 "haptic_trigger.h",
210 "haptic_trigger.cc",
211 "integral_haptic_trigger.h",
212 "integral_haptic_trigger.cc",
213 ],
214 cmd = "$(location //frc971/control_loops/python:haptic_wheel) $(OUTS)",
215 compatible_with = mcu_cpus,
216 tools = [
217 "//frc971/control_loops/python:haptic_wheel",
218 ],
219 visibility = ["//visibility:private"],
Brian Silverman6260c092018-01-14 15:21:36 -0800220)
221
222cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700223 name = "haptic_input_uc",
224 srcs = [
225 "haptic_trigger.cc",
226 "haptic_wheel.cc",
227 "integral_haptic_trigger.cc",
228 "integral_haptic_wheel.cc",
229 ],
230 hdrs = [
231 "haptic_trigger.h",
232 "haptic_wheel.h",
233 "integral_haptic_trigger.h",
234 "integral_haptic_wheel.h",
235 ],
236 restricted_to = mcu_cpus,
237 deps = [
238 "//frc971/control_loops:state_feedback_loop_uc",
239 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800240)
241
242cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700243 name = "haptic_wheel",
244 srcs = [
245 "haptic_trigger.cc",
246 "haptic_wheel.cc",
247 "integral_haptic_trigger.cc",
248 "integral_haptic_wheel.cc",
249 ],
250 hdrs = [
251 "haptic_trigger.h",
252 "haptic_wheel.h",
253 "integral_haptic_trigger.h",
254 "integral_haptic_wheel.h",
255 ],
256 deps = [
257 "//frc971/control_loops:state_feedback_loop",
258 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800259)
Austin Schuhc2b08772018-12-19 18:05:06 +1100260
261cc_library(
262 name = "spline",
263 srcs = ["spline.cc"],
264 hdrs = ["spline.h"],
265 deps = [
266 "//third_party/eigen",
267 ],
268)
269
270cc_test(
271 name = "spline_test",
272 srcs = [
273 "spline_test.cc",
274 ],
275 restricted_to = ["//tools:k8"],
276 deps = [
277 ":spline",
278 "//aos/testing:googletest",
279 "//third_party/matplotlib-cpp",
280 "@com_github_gflags_gflags//:gflags",
281 ],
282)