blob: 3f361a72b75bd4530958bbd8932002768671cd65 [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",
Austin Schuh355f3272019-02-15 23:09:29 -080017 "//y2019/control_loops/superstructure:superstructure",
Austin Schuh986091a2019-03-22 20:35:12 -070018 "//y2019/actors:binaries",
Austin Schuh635e8bf2019-03-23 18:53:15 -070019 "//y2019/vision/server",
Sabina Davis1b84afa2019-02-09 01:20:21 -080020 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080021 target_compatible_with = ["@platforms//os:linux"],
Sabina Davis1b84afa2019-02-09 01:20:21 -080022)
23
Tyler Chatow37ecdcd2019-01-26 20:18:42 -080024cc_library(
25 name = "constants",
26 srcs = [
27 "constants.cc",
28 ],
29 hdrs = [
30 "constants.h",
31 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080032 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow37ecdcd2019-01-26 20:18:42 -080033 visibility = ["//visibility:public"],
34 deps = [
Tyler Chatow37ecdcd2019-01-26 20:18:42 -080035 "//aos/logging",
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",
Austin Schuhed5b26d2019-12-05 20:51:59 -080048 "@com_google_absl//absl/base",
Tyler Chatow37ecdcd2019-01-26 20:18:42 -080049 ],
50)
51
Sabina Davisabeae332019-02-01 21:12:57 -080052cc_binary(
53 name = "wpilib_interface",
54 srcs = [
55 "wpilib_interface.cc",
56 ],
Brian Silverman7be68ba2020-01-08 22:08:40 -080057 # This library uses some deprecated parts of the SPI API.
58 copts = ["-Wno-deprecated-declarations"],
Philipp Schraderdada1072020-11-24 11:34:46 -080059 target_compatible_with = ["//tools/platforms/hardware:roborio"],
Sabina Davisabeae332019-02-01 21:12:57 -080060 deps = [
Austin Schuhed5b26d2019-12-05 20:51:59 -080061 ":camera_log_fbs",
Sabina Davis7be49f32019-02-02 00:30:19 -080062 ":constants",
Austin Schuhed5b26d2019-12-05 20:51:59 -080063 ":status_light_fbs",
Sabina Davisabeae332019-02-01 21:12:57 -080064 "//aos:init",
65 "//aos:make_unique",
66 "//aos:math",
67 "//aos/controls:control_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -070068 "//aos/events:shm_event_loop",
Sabina Davisabeae332019-02-01 21:12:57 -080069 "//aos/logging",
Alex Perrycb7da4b2019-08-28 19:35:56 -070070 "//aos/robot_state:robot_state_fbs",
Sabina Davisabeae332019-02-01 21:12:57 -080071 "//aos/stl_mutex",
72 "//aos/time",
73 "//aos/util:log_interval",
74 "//aos/util:phased_loop",
75 "//aos/util:wrapping_counter",
Austin Schuhed5b26d2019-12-05 20:51:59 -080076 "//frc971/autonomous:auto_mode_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -070077 "//frc971/control_loops:control_loops_fbs",
78 "//frc971/control_loops/drivetrain:drivetrain_position_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 = [
110 "//aos/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 Davis1b84afa2019-02-09 01:20:21 -0800138 "//aos/input:action_joystick_input",
Sabina Davis91b23602019-01-21 00:06:01 -0800139 "//aos/input:drivetrain_input",
140 "//aos/input:joystick_input",
Sabina Davis91b23602019-01-21 00:06:01 -0800141 "//aos/logging",
142 "//aos/network:team_number",
143 "//aos/stl_mutex",
144 "//aos/time",
145 "//aos/util:log_interval",
146 "//aos/vision/events:udp",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700147 "//frc971/autonomous:auto_fbs",
Sabina Davis91b23602019-01-21 00:06:01 -0800148 "//frc971/autonomous:base_autonomous_actor",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700149 "//frc971/control_loops:profiled_subsystem_fbs",
150 "//frc971/control_loops/drivetrain:localizer_fbs",
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 = [
196 "//aos/robot_state:config",
Austin Schuhed5b26d2019-12-05 20:51:59 -0800197 "//frc971/autonomous:config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700198 "//frc971/control_loops/drivetrain: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)