blob: 864cb571d751e14c06d187306f93883bdccf8a65 [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")
Adam Snaider13d48d92023-08-03 12:20:15 -07003load("@rules_cc//cc:defs.bzl", "cc_proto_library")
4load("@rules_proto//proto:defs.bzl", "proto_library")
Alex Perrycb7da4b2019-08-28 19:35:56 -07005load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
Sabina Davis1b84afa2019-02-09 01:20:21 -08006
7robot_downloader(
Austin Schuhed5b26d2019-12-05 20:51:59 -08008 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -08009 ":aos_config",
Austin Schuhde605f12022-02-23 23:08:19 -080010 "@ctre_phoenix_api_cpp_athena//:shared_libraries",
11 "@ctre_phoenix_cci_athena//:shared_libraries",
Austin Schuhed5b26d2019-12-05 20:51:59 -080012 ],
Austin Schuh635e8bf2019-03-23 18:53:15 -070013 dirs = [
14 "//y2019/vision/server:www_files",
15 ],
Sabina Davis1b84afa2019-02-09 01:20:21 -080016 start_binaries = [
17 ":joystick_reader",
18 ":wpilib_interface",
19 "//y2019/control_loops/drivetrain:drivetrain",
James Kuszmaul75a18c52021-03-10 22:02:07 -080020 "//y2019/control_loops/drivetrain:trajectory_generator",
Austin Schuh355f3272019-02-15 23:09:29 -080021 "//y2019/control_loops/superstructure:superstructure",
Austin Schuh986091a2019-03-22 20:35:12 -070022 "//y2019/actors:binaries",
Austin Schuh635e8bf2019-03-23 18:53:15 -070023 "//y2019/vision/server",
Sabina Davis1b84afa2019-02-09 01:20:21 -080024 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080025 target_compatible_with = ["@platforms//os:linux"],
Sabina Davis1b84afa2019-02-09 01:20:21 -080026)
27
Tyler Chatow37ecdcd2019-01-26 20:18:42 -080028cc_library(
29 name = "constants",
30 srcs = [
31 "constants.cc",
32 ],
33 hdrs = [
34 "constants.h",
35 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080036 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow37ecdcd2019-01-26 20:18:42 -080037 visibility = ["//visibility:public"],
38 deps = [
Tyler Chatow37ecdcd2019-01-26 20:18:42 -080039 "//aos/network:team_number",
Brian Silverman1463c092020-10-30 17:28:24 -070040 "//aos/stl_mutex",
Tyler Chatow37ecdcd2019-01-26 20:18:42 -080041 "//frc971:constants",
James Kuszmaul22c5ab32019-02-09 14:45:58 -080042 "//frc971/control_loops:pose",
Theo Bafrali00e42272019-02-12 01:07:46 -080043 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
James Kuszmaulf4ede202020-02-14 08:47:40 -080044 "//frc971/control_loops/drivetrain:camera",
James Kuszmaulec635d22023-08-12 18:39:24 -070045 "//frc971/zeroing:absolute_encoder",
46 "//frc971/zeroing:pot_and_absolute_encoder",
Sabina Davis7be49f32019-02-02 00:30:19 -080047 "//y2019/control_loops/drivetrain:polydrivetrain_plants",
Alex Perry5fb5ff22019-02-09 21:53:17 -080048 "//y2019/control_loops/superstructure/elevator:elevator_plants",
49 "//y2019/control_loops/superstructure/intake:intake_plants",
50 "//y2019/control_loops/superstructure/stilts:stilts_plants",
Austin Schuhc1d6f832019-02-15 23:22:17 -080051 "//y2019/control_loops/superstructure/wrist:wrist_plants",
James Kuszmaule2c71ea2019-03-04 08:14:21 -080052 "//y2019/vision:constants",
Brian Silvermanf4d329c2021-11-04 19:32:10 -070053 "@com_github_google_glog//:glog",
Austin Schuhed5b26d2019-12-05 20:51:59 -080054 "@com_google_absl//absl/base",
Tyler Chatow37ecdcd2019-01-26 20:18:42 -080055 ],
56)
57
Sabina Davisabeae332019-02-01 21:12:57 -080058cc_binary(
59 name = "wpilib_interface",
60 srcs = [
61 "wpilib_interface.cc",
62 ],
Brian Silverman7be68ba2020-01-08 22:08:40 -080063 # This library uses some deprecated parts of the SPI API.
64 copts = ["-Wno-deprecated-declarations"],
Philipp Schraderdada1072020-11-24 11:34:46 -080065 target_compatible_with = ["//tools/platforms/hardware:roborio"],
Sabina Davisabeae332019-02-01 21:12:57 -080066 deps = [
Austin Schuhed5b26d2019-12-05 20:51:59 -080067 ":camera_log_fbs",
Sabina Davis7be49f32019-02-02 00:30:19 -080068 ":constants",
Austin Schuhed5b26d2019-12-05 20:51:59 -080069 ":status_light_fbs",
Sabina Davisabeae332019-02-01 21:12:57 -080070 "//aos:init",
Sabina Davisabeae332019-02-01 21:12:57 -080071 "//aos:math",
Alex Perrycb7da4b2019-08-28 19:35:56 -070072 "//aos/events:shm_event_loop",
Sabina Davisabeae332019-02-01 21:12:57 -080073 "//aos/logging",
Sabina Davisabeae332019-02-01 21:12:57 -080074 "//aos/stl_mutex",
75 "//aos/time",
76 "//aos/util:log_interval",
77 "//aos/util:phased_loop",
78 "//aos/util:wrapping_counter",
Austin Schuhed5b26d2019-12-05 20:51:59 -080079 "//frc971/autonomous:auto_mode_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -070080 "//frc971/control_loops:control_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -070081 "//frc971/control_loops:control_loops_fbs",
82 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -070083 "//frc971/input:robot_state_fbs",
Sabina Davisabeae332019-02-01 21:12:57 -080084 "//frc971/wpilib:ADIS16448",
Austin Schuhc1d6f832019-02-15 23:22:17 -080085 "//frc971/wpilib:buffered_pcm",
Sabina Davisd004fd62019-02-02 23:51:46 -080086 "//frc971/wpilib:drivetrain_writer",
Sabina Davisabeae332019-02-01 21:12:57 -080087 "//frc971/wpilib:encoder_and_potentiometer",
88 "//frc971/wpilib:interrupt_edge_counting",
89 "//frc971/wpilib:joystick_sender",
Alex Perrycb7da4b2019-08-28 19:35:56 -070090 "//frc971/wpilib:logging_fbs",
Sabina Davisabeae332019-02-01 21:12:57 -080091 "//frc971/wpilib:loop_output_handler",
92 "//frc971/wpilib:pdp_fetcher",
Sabina Davisadc58542019-02-01 22:23:00 -080093 "//frc971/wpilib:sensor_reader",
Sabina Davisabeae332019-02-01 21:12:57 -080094 "//frc971/wpilib:wpilib_interface",
95 "//frc971/wpilib:wpilib_robot_base",
Austin Schuhf6b94632019-02-02 22:11:27 -080096 "//third_party:phoenix",
Sabina Davisabeae332019-02-01 21:12:57 -080097 "//third_party:wpilib",
Alex Perrycb7da4b2019-08-28 19:35:56 -070098 "//y2019/control_loops/drivetrain:camera_fbs",
99 "//y2019/control_loops/superstructure:superstructure_output_fbs",
100 "//y2019/control_loops/superstructure:superstructure_position_fbs",
Brian Silvermanf8b75252019-02-24 16:13:58 -0800101 "//y2019/jevois:spi",
Sabina Davisabeae332019-02-01 21:12:57 -0800102 ],
103)
Sabina Davis1b84afa2019-02-09 01:20:21 -0800104
Tyler Chatowd28951f2019-02-16 20:12:28 -0800105cc_library(
106 name = "joystick_angle",
107 srcs = [
108 "joystick_angle.cc",
109 ],
110 hdrs = [
111 "joystick_angle.h",
112 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800113 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowd28951f2019-02-16 20:12:28 -0800114 deps = [
James Kuszmaul7077d342021-06-09 20:23:58 -0700115 "//frc971/input:drivetrain_input",
Tyler Chatowc8012ca2019-02-18 22:33:01 -0800116 "//frc971/zeroing:wrap",
Tyler Chatowd28951f2019-02-16 20:12:28 -0800117 ],
118)
119
120cc_test(
121 name = "joystick_angle_test",
122 srcs = [
123 "joystick_angle_test.cc",
124 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800125 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowd28951f2019-02-16 20:12:28 -0800126 deps = [
127 ":joystick_angle",
128 "//aos/testing:googletest",
129 ],
130)
131
Sabina Davis1b84afa2019-02-09 01:20:21 -0800132cc_binary(
Sabina Davis91b23602019-01-21 00:06:01 -0800133 name = "joystick_reader",
134 srcs = [
135 ":joystick_reader.cc",
136 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800137 target_compatible_with = ["@platforms//os:linux"],
Sabina Davis91b23602019-01-21 00:06:01 -0800138 deps = [
Austin Schuhed5b26d2019-12-05 20:51:59 -0800139 ":camera_log_fbs",
Tyler Chatowe0241452019-03-08 21:07:50 -0800140 ":vision_proto",
Sabina Davis91b23602019-01-21 00:06:01 -0800141 "//aos:init",
142 "//aos/actions:action_lib",
Sabina Davis91b23602019-01-21 00:06:01 -0800143 "//aos/logging",
144 "//aos/network:team_number",
145 "//aos/stl_mutex",
146 "//aos/time",
147 "//aos/util:log_interval",
148 "//aos/vision/events:udp",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700149 "//frc971/autonomous:auto_fbs",
Sabina Davis91b23602019-01-21 00:06:01 -0800150 "//frc971/autonomous:base_autonomous_actor",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700151 "//frc971/control_loops:profiled_subsystem_fbs",
152 "//frc971/control_loops/drivetrain:localizer_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700153 "//frc971/input:action_joystick_input",
154 "//frc971/input:drivetrain_input",
155 "//frc971/input:joystick_input",
Sabina Davis91b23602019-01-21 00:06:01 -0800156 "//y2019/control_loops/drivetrain:drivetrain_base",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700157 "//y2019/control_loops/drivetrain:target_selector_fbs",
158 "//y2019/control_loops/superstructure:superstructure_goal_fbs",
159 "//y2019/control_loops/superstructure:superstructure_position_fbs",
160 "//y2019/control_loops/superstructure:superstructure_status_fbs",
Tyler Chatowe0241452019-03-08 21:07:50 -0800161 "@com_google_protobuf//:protobuf",
Sabina Davis91b23602019-01-21 00:06:01 -0800162 ],
163)
Sabina Davisabeae332019-02-01 21:12:57 -0800164
Alex Perrycb7da4b2019-08-28 19:35:56 -0700165flatbuffer_cc_library(
Austin Schuhed5b26d2019-12-05 20:51:59 -0800166 name = "camera_log_fbs",
167 srcs = [
168 "camera_log.fbs",
169 ],
170 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -0800171 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhed5b26d2019-12-05 20:51:59 -0800172 visibility = ["//visibility:public"],
173)
174
175flatbuffer_cc_library(
176 name = "status_light_fbs",
Sabina Davisc6329342019-03-01 20:44:42 -0800177 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700178 "status_light.fbs",
179 ],
180 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -0800181 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700182 visibility = ["//visibility:public"],
183)
184
185aos_config(
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800186 name = "aos_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700187 src = "y2019.json",
188 flatbuffers = [
Austin Schuhed5b26d2019-12-05 20:51:59 -0800189 ":status_light_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700190 "//y2019/control_loops/drivetrain:camera_fbs",
191 "//y2019/control_loops/drivetrain:target_selector_fbs",
192 "//y2019/control_loops/superstructure:superstructure_goal_fbs",
193 "//y2019/control_loops/superstructure:superstructure_output_fbs",
194 "//y2019/control_loops/superstructure:superstructure_position_fbs",
195 "//y2019/control_loops/superstructure:superstructure_status_fbs",
Austin Schuhed5b26d2019-12-05 20:51:59 -0800196 ":camera_log_fbs",
Sabina Davisc6329342019-03-01 20:44:42 -0800197 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800198 target_compatible_with = ["@platforms//os:linux"],
Sabina Davisc6329342019-03-01 20:44:42 -0800199 visibility = ["//visibility:public"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700200 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800201 "//frc971/autonomous:aos_config",
202 "//frc971/control_loops/drivetrain:aos_config",
203 "//frc971/input:aos_config",
204 "//frc971/wpilib:aos_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700205 ],
Sabina Davisc6329342019-03-01 20:44:42 -0800206)
207
Adam Snaider13d48d92023-08-03 12:20:15 -0700208proto_library(
209 name = "vision_proto_proto",
Michael Schuh5a1a7582019-03-01 13:03:47 -0800210 srcs = ["vision.proto"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800211 target_compatible_with = ["@platforms//os:linux"],
Michael Schuh5a1a7582019-03-01 13:03:47 -0800212 visibility = ["//visibility:public"],
213)
214
Adam Snaider13d48d92023-08-03 12:20:15 -0700215cc_proto_library(
216 name = "vision_proto",
217 target_compatible_with = ["@platforms//os:linux"],
218 visibility = ["//visibility:public"],
219 deps = ["vision_proto_proto"],
220)
221
Michael Schuhab42b0a2019-01-07 16:33:43 -0800222py_library(
223 name = "python_init",
224 srcs = ["__init__.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800225 target_compatible_with = ["@platforms//os:linux"],
Michael Schuhab42b0a2019-01-07 16:33:43 -0800226 visibility = ["//visibility:public"],
Sabina Davisabeae332019-02-01 21:12:57 -0800227)