blob: 8c250e067ff2faed164c317069e078cf5c8d9af9 [file] [log] [blame]
Sabina Davis1b84afa2019-02-09 01:20:21 -08001load("//frc971:downloader.bzl", "robot_downloader")
Alex Perrycb7da4b2019-08-28 19:35:56 -07002load("//aos:config.bzl", "aos_config")
Michael Schuh5a1a7582019-03-01 13:03:47 -08003load("@com_google_protobuf//:protobuf.bzl", "cc_proto_library")
Alex Perrycb7da4b2019-08-28 19:35:56 -07004load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
Sabina Davis1b84afa2019-02-09 01:20:21 -08005
6robot_downloader(
Austin Schuhed5b26d2019-12-05 20:51:59 -08007 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -07008 ":config",
Austin Schuhed5b26d2019-12-05 20:51:59 -08009 ],
Austin Schuh635e8bf2019-03-23 18:53:15 -070010 dirs = [
11 "//y2019/vision/server:www_files",
12 ],
Sabina Davis1b84afa2019-02-09 01:20:21 -080013 start_binaries = [
14 ":joystick_reader",
15 ":wpilib_interface",
16 "//y2019/control_loops/drivetrain:drivetrain",
James Kuszmaul75a18c52021-03-10 22:02:07 -080017 "//y2019/control_loops/drivetrain:trajectory_generator",
Austin Schuh355f3272019-02-15 23:09:29 -080018 "//y2019/control_loops/superstructure:superstructure",
Austin Schuh986091a2019-03-22 20:35:12 -070019 "//y2019/actors:binaries",
Austin Schuh635e8bf2019-03-23 18:53:15 -070020 "//y2019/vision/server",
Sabina Davis1b84afa2019-02-09 01:20:21 -080021 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080022 target_compatible_with = ["@platforms//os:linux"],
Sabina Davis1b84afa2019-02-09 01:20:21 -080023)
24
Tyler Chatow37ecdcd2019-01-26 20:18:42 -080025cc_library(
26 name = "constants",
27 srcs = [
28 "constants.cc",
29 ],
30 hdrs = [
31 "constants.h",
32 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080033 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow37ecdcd2019-01-26 20:18:42 -080034 visibility = ["//visibility:public"],
35 deps = [
Tyler Chatow37ecdcd2019-01-26 20:18:42 -080036 "//aos/network:team_number",
Brian Silverman1463c092020-10-30 17:28:24 -070037 "//aos/stl_mutex",
Tyler Chatow37ecdcd2019-01-26 20:18:42 -080038 "//frc971:constants",
James Kuszmaul22c5ab32019-02-09 14:45:58 -080039 "//frc971/control_loops:pose",
Theo Bafrali00e42272019-02-12 01:07:46 -080040 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
James Kuszmaulf4ede202020-02-14 08:47:40 -080041 "//frc971/control_loops/drivetrain:camera",
Sabina Davis7be49f32019-02-02 00:30:19 -080042 "//y2019/control_loops/drivetrain:polydrivetrain_plants",
Alex Perry5fb5ff22019-02-09 21:53:17 -080043 "//y2019/control_loops/superstructure/elevator:elevator_plants",
44 "//y2019/control_loops/superstructure/intake:intake_plants",
45 "//y2019/control_loops/superstructure/stilts:stilts_plants",
Austin Schuhc1d6f832019-02-15 23:22:17 -080046 "//y2019/control_loops/superstructure/wrist:wrist_plants",
James Kuszmaule2c71ea2019-03-04 08:14:21 -080047 "//y2019/vision:constants",
Brian Silvermanf4d329c2021-11-04 19:32:10 -070048 "@com_github_google_glog//:glog",
Austin Schuhed5b26d2019-12-05 20:51:59 -080049 "@com_google_absl//absl/base",
Tyler Chatow37ecdcd2019-01-26 20:18:42 -080050 ],
51)
52
Sabina Davisabeae332019-02-01 21:12:57 -080053cc_binary(
54 name = "wpilib_interface",
55 srcs = [
56 "wpilib_interface.cc",
57 ],
Brian Silverman7be68ba2020-01-08 22:08:40 -080058 # This library uses some deprecated parts of the SPI API.
59 copts = ["-Wno-deprecated-declarations"],
Philipp Schraderdada1072020-11-24 11:34:46 -080060 target_compatible_with = ["//tools/platforms/hardware:roborio"],
Sabina Davisabeae332019-02-01 21:12:57 -080061 deps = [
Austin Schuhed5b26d2019-12-05 20:51:59 -080062 ":camera_log_fbs",
Sabina Davis7be49f32019-02-02 00:30:19 -080063 ":constants",
Austin Schuhed5b26d2019-12-05 20:51:59 -080064 ":status_light_fbs",
Sabina Davisabeae332019-02-01 21:12:57 -080065 "//aos:init",
Sabina Davisabeae332019-02-01 21:12:57 -080066 "//aos:math",
Alex Perrycb7da4b2019-08-28 19:35:56 -070067 "//aos/events:shm_event_loop",
Sabina Davisabeae332019-02-01 21:12:57 -080068 "//aos/logging",
Sabina Davisabeae332019-02-01 21:12:57 -080069 "//aos/stl_mutex",
70 "//aos/time",
71 "//aos/util:log_interval",
72 "//aos/util:phased_loop",
73 "//aos/util:wrapping_counter",
Austin Schuhed5b26d2019-12-05 20:51:59 -080074 "//frc971/autonomous:auto_mode_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -070075 "//frc971/control_loops:control_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -070076 "//frc971/control_loops:control_loops_fbs",
77 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -070078 "//frc971/input:robot_state_fbs",
Sabina Davisabeae332019-02-01 21:12:57 -080079 "//frc971/wpilib:ADIS16448",
Austin Schuhc1d6f832019-02-15 23:22:17 -080080 "//frc971/wpilib:buffered_pcm",
Sabina Davisd004fd62019-02-02 23:51:46 -080081 "//frc971/wpilib:drivetrain_writer",
Sabina Davisabeae332019-02-01 21:12:57 -080082 "//frc971/wpilib:encoder_and_potentiometer",
83 "//frc971/wpilib:interrupt_edge_counting",
84 "//frc971/wpilib:joystick_sender",
Alex Perrycb7da4b2019-08-28 19:35:56 -070085 "//frc971/wpilib:logging_fbs",
Sabina Davisabeae332019-02-01 21:12:57 -080086 "//frc971/wpilib:loop_output_handler",
87 "//frc971/wpilib:pdp_fetcher",
Sabina Davisadc58542019-02-01 22:23:00 -080088 "//frc971/wpilib:sensor_reader",
Sabina Davisabeae332019-02-01 21:12:57 -080089 "//frc971/wpilib:wpilib_interface",
90 "//frc971/wpilib:wpilib_robot_base",
Austin Schuhf6b94632019-02-02 22:11:27 -080091 "//third_party:phoenix",
Sabina Davisabeae332019-02-01 21:12:57 -080092 "//third_party:wpilib",
Alex Perrycb7da4b2019-08-28 19:35:56 -070093 "//y2019/control_loops/drivetrain:camera_fbs",
94 "//y2019/control_loops/superstructure:superstructure_output_fbs",
95 "//y2019/control_loops/superstructure:superstructure_position_fbs",
Brian Silvermanf8b75252019-02-24 16:13:58 -080096 "//y2019/jevois:spi",
Sabina Davisabeae332019-02-01 21:12:57 -080097 ],
98)
Sabina Davis1b84afa2019-02-09 01:20:21 -080099
Tyler Chatowd28951f2019-02-16 20:12:28 -0800100cc_library(
101 name = "joystick_angle",
102 srcs = [
103 "joystick_angle.cc",
104 ],
105 hdrs = [
106 "joystick_angle.h",
107 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800108 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowd28951f2019-02-16 20:12:28 -0800109 deps = [
James Kuszmaul7077d342021-06-09 20:23:58 -0700110 "//frc971/input:drivetrain_input",
Tyler Chatowc8012ca2019-02-18 22:33:01 -0800111 "//frc971/zeroing:wrap",
Tyler Chatowd28951f2019-02-16 20:12:28 -0800112 ],
113)
114
115cc_test(
116 name = "joystick_angle_test",
117 srcs = [
118 "joystick_angle_test.cc",
119 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800120 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowd28951f2019-02-16 20:12:28 -0800121 deps = [
122 ":joystick_angle",
123 "//aos/testing:googletest",
124 ],
125)
126
Sabina Davis1b84afa2019-02-09 01:20:21 -0800127cc_binary(
Sabina Davis91b23602019-01-21 00:06:01 -0800128 name = "joystick_reader",
129 srcs = [
130 ":joystick_reader.cc",
131 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800132 target_compatible_with = ["@platforms//os:linux"],
Sabina Davis91b23602019-01-21 00:06:01 -0800133 deps = [
Austin Schuhed5b26d2019-12-05 20:51:59 -0800134 ":camera_log_fbs",
Tyler Chatowe0241452019-03-08 21:07:50 -0800135 ":vision_proto",
Sabina Davis91b23602019-01-21 00:06:01 -0800136 "//aos:init",
137 "//aos/actions:action_lib",
Sabina Davis91b23602019-01-21 00:06:01 -0800138 "//aos/logging",
139 "//aos/network:team_number",
140 "//aos/stl_mutex",
141 "//aos/time",
142 "//aos/util:log_interval",
143 "//aos/vision/events:udp",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700144 "//frc971/autonomous:auto_fbs",
Sabina Davis91b23602019-01-21 00:06:01 -0800145 "//frc971/autonomous:base_autonomous_actor",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700146 "//frc971/control_loops:profiled_subsystem_fbs",
147 "//frc971/control_loops/drivetrain:localizer_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700148 "//frc971/input:action_joystick_input",
149 "//frc971/input:drivetrain_input",
150 "//frc971/input:joystick_input",
Sabina Davis91b23602019-01-21 00:06:01 -0800151 "//y2019/control_loops/drivetrain:drivetrain_base",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700152 "//y2019/control_loops/drivetrain:target_selector_fbs",
153 "//y2019/control_loops/superstructure:superstructure_goal_fbs",
154 "//y2019/control_loops/superstructure:superstructure_position_fbs",
155 "//y2019/control_loops/superstructure:superstructure_status_fbs",
Tyler Chatowe0241452019-03-08 21:07:50 -0800156 "@com_google_protobuf//:protobuf",
Sabina Davis91b23602019-01-21 00:06:01 -0800157 ],
158)
Sabina Davisabeae332019-02-01 21:12:57 -0800159
Alex Perrycb7da4b2019-08-28 19:35:56 -0700160flatbuffer_cc_library(
Austin Schuhed5b26d2019-12-05 20:51:59 -0800161 name = "camera_log_fbs",
162 srcs = [
163 "camera_log.fbs",
164 ],
165 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -0800166 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhed5b26d2019-12-05 20:51:59 -0800167 visibility = ["//visibility:public"],
168)
169
170flatbuffer_cc_library(
171 name = "status_light_fbs",
Sabina Davisc6329342019-03-01 20:44:42 -0800172 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700173 "status_light.fbs",
174 ],
175 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -0800176 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700177 visibility = ["//visibility:public"],
178)
179
180aos_config(
181 name = "config",
182 src = "y2019.json",
183 flatbuffers = [
Austin Schuhed5b26d2019-12-05 20:51:59 -0800184 ":status_light_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700185 "//y2019/control_loops/drivetrain:camera_fbs",
186 "//y2019/control_loops/drivetrain:target_selector_fbs",
187 "//y2019/control_loops/superstructure:superstructure_goal_fbs",
188 "//y2019/control_loops/superstructure:superstructure_output_fbs",
189 "//y2019/control_loops/superstructure:superstructure_position_fbs",
190 "//y2019/control_loops/superstructure:superstructure_status_fbs",
Austin Schuhed5b26d2019-12-05 20:51:59 -0800191 ":camera_log_fbs",
Sabina Davisc6329342019-03-01 20:44:42 -0800192 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800193 target_compatible_with = ["@platforms//os:linux"],
Sabina Davisc6329342019-03-01 20:44:42 -0800194 visibility = ["//visibility:public"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700195 deps = [
Austin Schuhed5b26d2019-12-05 20:51:59 -0800196 "//frc971/autonomous:config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700197 "//frc971/control_loops/drivetrain:config",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700198 "//frc971/input:config",
Austin Schuhed5b26d2019-12-05 20:51:59 -0800199 "//frc971/wpilib:config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700200 ],
Sabina Davisc6329342019-03-01 20:44:42 -0800201)
202
Michael Schuh5a1a7582019-03-01 13:03:47 -0800203cc_proto_library(
204 name = "vision_proto",
205 srcs = ["vision.proto"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800206 target_compatible_with = ["@platforms//os:linux"],
Michael Schuh5a1a7582019-03-01 13:03:47 -0800207 visibility = ["//visibility:public"],
208)
209
Michael Schuhab42b0a2019-01-07 16:33:43 -0800210py_library(
211 name = "python_init",
212 srcs = ["__init__.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800213 target_compatible_with = ["@platforms//os:linux"],
Michael Schuhab42b0a2019-01-07 16:33:43 -0800214 visibility = ["//visibility:public"],
Sabina Davisabeae332019-02-01 21:12:57 -0800215)