blob: 90385e04710b57cea91330063543fd12c2ee375e [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 ],
24 deps = [
25 "//aos/common/controls:control_loop_queues",
26 "//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",
61 "//aos/common:math",
62 "//aos/common/controls:control_loop",
63 "//aos/common/controls:polytope",
64 "//aos/common/logging:matrix_logging",
65 "//aos/common/logging:queue_logging",
66 "//aos/common/messages:robot_state",
67 "//aos/common/util:log_interval",
68 "//aos/common/util:trapezoid_profile",
69 "//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",
87 "//aos/common:math",
88 "//aos/common/controls:polytope",
89 "//aos/common/logging:matrix_logging",
90 "//aos/common/logging:queue_logging",
91 "//aos/common/messages:robot_state",
92 "//aos/common/util:log_interval",
93 "//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",
124 "//aos/common:math",
125 "//aos/common/controls:polytope_uc",
126 "//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",
171 "//aos/common/controls:control_loop",
172 "//aos/common/logging:matrix_logging",
173 "//aos/common/logging:queue_logging",
174 "//aos/common/util:log_interval",
175 "//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",
189 "//aos/common:queues",
190 "//aos/common/controls:control_loop_test",
191 "//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)