blob: 915f63d53da23e86c766c3be5e5457f58852c3ec [file] [log] [blame]
Comran Morshed5323ecb2015-12-26 20:50:55 +00001package(default_visibility = ['//visibility:public'])
2
Austin Schuh4f857292018-02-15 23:42:04 -08003load('//aos/build:queues.bzl', 'queue_library')
Comran Morshed5323ecb2015-12-26 20:50:55 +00004
5cc_binary(
6 name = 'replay_drivetrain',
7 srcs = [
8 'replay_drivetrain.cc',
9 ],
10 deps = [
11 ':drivetrain_queue',
12 '//aos/common/controls:replay_control_loop',
13 '//aos/linux_code:init',
14 '//frc971/queues:gyro',
15 ],
16)
17
18queue_library(
19 name = 'drivetrain_queue',
20 srcs = [
21 'drivetrain.q',
22 ],
23 deps = [
24 '//aos/common/controls:control_loop_queues',
Austin Schuhedbb64f2016-03-19 01:18:09 -070025 '//frc971/control_loops:queues',
Comran Morshed5323ecb2015-12-26 20:50:55 +000026 ],
27)
28
29cc_library(
30 name = 'drivetrain_config',
31 hdrs = [
32 'drivetrain_config.h',
33 ],
34 deps = [
35 '//frc971/control_loops:state_feedback_loop',
36 '//frc971:shifter_hall_effect',
37 ],
38)
39
40cc_library(
Austin Schuh093535c2016-03-05 23:21:00 -080041 name = 'gear',
42 hdrs = [
43 'gear.h',
44 ],
45)
46
47cc_library(
Comran Morshed5323ecb2015-12-26 20:50:55 +000048 name = 'ssdrivetrain',
49 srcs = [
50 'ssdrivetrain.cc',
51 ],
52 hdrs = [
53 'ssdrivetrain.h',
54 ],
55 deps = [
56 ':drivetrain_queue',
57 ':drivetrain_config',
Austin Schuh093535c2016-03-05 23:21:00 -080058 ':gear',
59 '//aos/common/controls:control_loop',
Comran Morshed5323ecb2015-12-26 20:50:55 +000060 '//aos/common/controls:polytope',
Comran Morshed5323ecb2015-12-26 20:50:55 +000061 '//aos/common/logging:matrix_logging',
Austin Schuh093535c2016-03-05 23:21:00 -080062 '//aos/common/logging:queue_logging',
63 '//aos/common/messages:robot_state',
64 '//aos/common/util:log_interval',
65 '//aos/common/util:trapezoid_profile',
66 '//aos/common:math',
67 '//frc971/control_loops:coerce_goal',
68 '//frc971/control_loops:state_feedback_loop',
69 '//frc971:shifter_hall_effect',
Comran Morshed5323ecb2015-12-26 20:50:55 +000070 ],
71)
72
73cc_library(
74 name = 'polydrivetrain',
75 srcs = [
76 'polydrivetrain.cc',
77 ],
78 hdrs = [
79 'polydrivetrain.h',
80 ],
81 deps = [
82 ':drivetrain_queue',
83 ':drivetrain_config',
Austin Schuh093535c2016-03-05 23:21:00 -080084 ':gear',
Comran Morshed5323ecb2015-12-26 20:50:55 +000085 '//aos/common/controls:polytope',
86 '//aos/common:math',
87 '//aos/common/messages:robot_state',
88 '//frc971/control_loops:state_feedback_loop',
89 '//frc971/control_loops:coerce_goal',
90 '//aos/common/util:log_interval',
91 '//aos/common/logging:queue_logging',
92 '//aos/common/logging:matrix_logging',
93 ],
94)
95
Austin Schuh05c5a612016-04-02 15:10:25 -070096genrule(
97 name = 'genrule_down_estimator',
98 visibility = ['//visibility:private'],
99 cmd = '$(location //frc971/control_loops/python:down_estimator) $(OUTS)',
100 tools = [
101 '//frc971/control_loops/python:down_estimator',
102 ],
103 outs = [
104 'down_estimator.h',
105 'down_estimator.cc',
106 ],
107)
108
109cc_library(
110 name = 'down_estimator',
111 hdrs = [
112 'down_estimator.h',
113 ],
114 srcs = [
115 'down_estimator.cc',
116 ],
117 deps = [
118 '//frc971/control_loops:state_feedback_loop',
119 ],
120)
121
Comran Morshed5323ecb2015-12-26 20:50:55 +0000122cc_library(
123 name = 'drivetrain_lib',
124 srcs = [
125 'drivetrain.cc',
126 ],
127 hdrs = [
128 'drivetrain.h',
129 ],
130 deps = [
Austin Schuh05c5a612016-04-02 15:10:25 -0700131 ':down_estimator',
Comran Morshed5323ecb2015-12-26 20:50:55 +0000132 ':drivetrain_queue',
Austin Schuh093535c2016-03-05 23:21:00 -0800133 ':gear',
Comran Morshed5323ecb2015-12-26 20:50:55 +0000134 ':polydrivetrain',
135 ':ssdrivetrain',
136 '//aos/common/controls:control_loop',
137 '//frc971/queues:gyro',
Austin Schuh05c5a612016-04-02 15:10:25 -0700138 '//frc971/wpilib:imu_queue',
Comran Morshed5323ecb2015-12-26 20:50:55 +0000139 '//aos/common/util:log_interval',
140 '//aos/common/logging:queue_logging',
141 '//aos/common/logging:matrix_logging',
142 ],
143)
144
145cc_test(
146 name = 'drivetrain_lib_test',
147 srcs = [
148 'drivetrain_lib_test.cc',
149 ],
150 deps = [
151 '//aos/testing:googletest',
152 ':drivetrain_queue',
153 ':drivetrain_lib',
154 ':drivetrain_config',
155 '//aos/common/controls:control_loop_test',
156 '//frc971/control_loops:state_feedback_loop',
157 '//frc971/queues:gyro',
158 '//aos/common:queues',
Comran Morshedbaf57842016-02-17 20:58:53 +0000159 '//y2016:constants',
160 '//y2016/control_loops/drivetrain:polydrivetrain_plants',
Comran Morshed5323ecb2015-12-26 20:50:55 +0000161 ],
162)
Brian Silverman6260c092018-01-14 15:21:36 -0800163
164genrule(
165 name = 'genrule_haptic_wheel',
166 visibility = ['//visibility:private'],
167 cmd = '$(location //frc971/control_loops/python:haptic_wheel) $(OUTS)',
168 tools = [
169 '//frc971/control_loops/python:haptic_wheel',
170 ],
171 outs = [
172 'haptic_wheel.h',
173 'haptic_wheel.cc',
174 'integral_haptic_wheel.h',
175 'integral_haptic_wheel.cc',
176 'haptic_trigger.h',
177 'haptic_trigger.cc',
178 'integral_haptic_trigger.h',
179 'integral_haptic_trigger.cc',
180 ],
181 restricted_to = ["//tools:k8", "//tools:roborio", "//tools:armhf-debian", "//tools:cortex-m4f"],
182)
183
184cc_library(
185 name = 'haptic_input_uc',
186 hdrs = [
187 'haptic_wheel.h',
188 'integral_haptic_wheel.h',
189 'haptic_trigger.h',
190 'integral_haptic_trigger.h',
191 ],
192 srcs = [
193 'haptic_wheel.cc',
194 'integral_haptic_wheel.cc',
195 'haptic_trigger.cc',
196 'integral_haptic_trigger.cc',
197 ],
198 deps = [
199 '//frc971/control_loops:state_feedback_loop_uc',
200 ],
201 restricted_to = ["//tools:cortex-m4f"],
202)
203
204cc_library(
205 name = 'haptic_wheel',
206 hdrs = [
207 'haptic_wheel.h',
208 'integral_haptic_wheel.h',
209 'haptic_trigger.h',
210 'integral_haptic_trigger.h',
211 ],
212 srcs = [
213 'haptic_wheel.cc',
214 'integral_haptic_wheel.cc',
215 'haptic_trigger.cc',
216 'integral_haptic_trigger.cc',
217 ],
218 deps = [
219 '//frc971/control_loops:state_feedback_loop',
220 ],
221)