blob: 64d1d9d4754b9a8c1fd302caa1e377699ae87fdf [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",
13 "//aos/common/controls:replay_control_loop",
14 "//aos/linux_code:init",
15 "//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 = [
28 "//aos/common/controls:control_loop_queues",
29 "//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",
64 "//aos/common:math",
65 "//aos/common/controls:control_loop",
66 "//aos/common/controls:polytope",
67 "//aos/common/logging:matrix_logging",
68 "//aos/common/logging:queue_logging",
69 "//aos/common/messages:robot_state",
70 "//aos/common/util:log_interval",
71 "//aos/common/util:trapezoid_profile",
72 "//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",
90 "//aos/common:math",
91 "//aos/common/controls:polytope",
92 "//aos/common/logging:matrix_logging",
93 "//aos/common/logging:queue_logging",
94 "//aos/common/messages:robot_state",
95 "//aos/common/util:log_interval",
96 "//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",
127 "//aos/common:math",
128 "//aos/common/controls:polytope_uc",
129 "//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",
174 "//aos/common/controls:control_loop",
175 "//aos/common/logging:matrix_logging",
176 "//aos/common/logging:queue_logging",
177 "//aos/common/util:log_interval",
178 "//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",
192 "//aos/common:queues",
193 "//aos/common/controls:control_loop_test",
194 "//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)