blob: 7d4e2335cc9f7afe2fde158b4be9c4fb1275b8f7 [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 Schuhde605f12022-02-23 23:08:19 -08009 "@ctre_phoenix_api_cpp_athena//:shared_libraries",
10 "@ctre_phoenix_cci_athena//:shared_libraries",
Austin Schuhed5b26d2019-12-05 20:51:59 -080011 ],
Austin Schuh635e8bf2019-03-23 18:53:15 -070012 dirs = [
13 "//y2019/vision/server:www_files",
14 ],
Sabina Davis1b84afa2019-02-09 01:20:21 -080015 start_binaries = [
16 ":joystick_reader",
17 ":wpilib_interface",
18 "//y2019/control_loops/drivetrain:drivetrain",
James Kuszmaul75a18c52021-03-10 22:02:07 -080019 "//y2019/control_loops/drivetrain:trajectory_generator",
Austin Schuh355f3272019-02-15 23:09:29 -080020 "//y2019/control_loops/superstructure:superstructure",
Austin Schuh986091a2019-03-22 20:35:12 -070021 "//y2019/actors:binaries",
Austin Schuh635e8bf2019-03-23 18:53:15 -070022 "//y2019/vision/server",
Sabina Davis1b84afa2019-02-09 01:20:21 -080023 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080024 target_compatible_with = ["@platforms//os:linux"],
Sabina Davis1b84afa2019-02-09 01:20:21 -080025)
26
Tyler Chatow37ecdcd2019-01-26 20:18:42 -080027cc_library(
28 name = "constants",
29 srcs = [
30 "constants.cc",
31 ],
32 hdrs = [
33 "constants.h",
34 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080035 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow37ecdcd2019-01-26 20:18:42 -080036 visibility = ["//visibility:public"],
37 deps = [
Tyler Chatow37ecdcd2019-01-26 20:18:42 -080038 "//aos/network:team_number",
Brian Silverman1463c092020-10-30 17:28:24 -070039 "//aos/stl_mutex",
Tyler Chatow37ecdcd2019-01-26 20:18:42 -080040 "//frc971:constants",
James Kuszmaul22c5ab32019-02-09 14:45:58 -080041 "//frc971/control_loops:pose",
Theo Bafrali00e42272019-02-12 01:07:46 -080042 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
James Kuszmaulf4ede202020-02-14 08:47:40 -080043 "//frc971/control_loops/drivetrain:camera",
Sabina Davis7be49f32019-02-02 00:30:19 -080044 "//y2019/control_loops/drivetrain:polydrivetrain_plants",
Alex Perry5fb5ff22019-02-09 21:53:17 -080045 "//y2019/control_loops/superstructure/elevator:elevator_plants",
46 "//y2019/control_loops/superstructure/intake:intake_plants",
47 "//y2019/control_loops/superstructure/stilts:stilts_plants",
Austin Schuhc1d6f832019-02-15 23:22:17 -080048 "//y2019/control_loops/superstructure/wrist:wrist_plants",
James Kuszmaule2c71ea2019-03-04 08:14:21 -080049 "//y2019/vision:constants",
Brian Silvermanf4d329c2021-11-04 19:32:10 -070050 "@com_github_google_glog//:glog",
Austin Schuhed5b26d2019-12-05 20:51:59 -080051 "@com_google_absl//absl/base",
Tyler Chatow37ecdcd2019-01-26 20:18:42 -080052 ],
53)
54
Sabina Davisabeae332019-02-01 21:12:57 -080055cc_binary(
56 name = "wpilib_interface",
57 srcs = [
58 "wpilib_interface.cc",
59 ],
Brian Silverman7be68ba2020-01-08 22:08:40 -080060 # This library uses some deprecated parts of the SPI API.
61 copts = ["-Wno-deprecated-declarations"],
Philipp Schraderdada1072020-11-24 11:34:46 -080062 target_compatible_with = ["//tools/platforms/hardware:roborio"],
Sabina Davisabeae332019-02-01 21:12:57 -080063 deps = [
Austin Schuhed5b26d2019-12-05 20:51:59 -080064 ":camera_log_fbs",
Sabina Davis7be49f32019-02-02 00:30:19 -080065 ":constants",
Austin Schuhed5b26d2019-12-05 20:51:59 -080066 ":status_light_fbs",
Sabina Davisabeae332019-02-01 21:12:57 -080067 "//aos:init",
Sabina Davisabeae332019-02-01 21:12:57 -080068 "//aos:math",
Alex Perrycb7da4b2019-08-28 19:35:56 -070069 "//aos/events:shm_event_loop",
Sabina Davisabeae332019-02-01 21:12:57 -080070 "//aos/logging",
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",
Austin Schuh0a3c9d42021-07-15 22:36:24 -070077 "//frc971/control_loops:control_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -070078 "//frc971/control_loops:control_loops_fbs",
79 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -070080 "//frc971/input:robot_state_fbs",
Sabina Davisabeae332019-02-01 21:12:57 -080081 "//frc971/wpilib:ADIS16448",
Austin Schuhc1d6f832019-02-15 23:22:17 -080082 "//frc971/wpilib:buffered_pcm",
Sabina Davisd004fd62019-02-02 23:51:46 -080083 "//frc971/wpilib:drivetrain_writer",
Sabina Davisabeae332019-02-01 21:12:57 -080084 "//frc971/wpilib:encoder_and_potentiometer",
85 "//frc971/wpilib:interrupt_edge_counting",
86 "//frc971/wpilib:joystick_sender",
Alex Perrycb7da4b2019-08-28 19:35:56 -070087 "//frc971/wpilib:logging_fbs",
Sabina Davisabeae332019-02-01 21:12:57 -080088 "//frc971/wpilib:loop_output_handler",
89 "//frc971/wpilib:pdp_fetcher",
Sabina Davisadc58542019-02-01 22:23:00 -080090 "//frc971/wpilib:sensor_reader",
Sabina Davisabeae332019-02-01 21:12:57 -080091 "//frc971/wpilib:wpilib_interface",
92 "//frc971/wpilib:wpilib_robot_base",
Austin Schuhf6b94632019-02-02 22:11:27 -080093 "//third_party:phoenix",
Sabina Davisabeae332019-02-01 21:12:57 -080094 "//third_party:wpilib",
Alex Perrycb7da4b2019-08-28 19:35:56 -070095 "//y2019/control_loops/drivetrain:camera_fbs",
96 "//y2019/control_loops/superstructure:superstructure_output_fbs",
97 "//y2019/control_loops/superstructure:superstructure_position_fbs",
Brian Silvermanf8b75252019-02-24 16:13:58 -080098 "//y2019/jevois:spi",
Sabina Davisabeae332019-02-01 21:12:57 -080099 ],
100)
Sabina Davis1b84afa2019-02-09 01:20:21 -0800101
Tyler Chatowd28951f2019-02-16 20:12:28 -0800102cc_library(
103 name = "joystick_angle",
104 srcs = [
105 "joystick_angle.cc",
106 ],
107 hdrs = [
108 "joystick_angle.h",
109 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800110 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowd28951f2019-02-16 20:12:28 -0800111 deps = [
James Kuszmaul7077d342021-06-09 20:23:58 -0700112 "//frc971/input:drivetrain_input",
Tyler Chatowc8012ca2019-02-18 22:33:01 -0800113 "//frc971/zeroing:wrap",
Tyler Chatowd28951f2019-02-16 20:12:28 -0800114 ],
115)
116
117cc_test(
118 name = "joystick_angle_test",
119 srcs = [
120 "joystick_angle_test.cc",
121 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800122 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowd28951f2019-02-16 20:12:28 -0800123 deps = [
124 ":joystick_angle",
125 "//aos/testing:googletest",
126 ],
127)
128
Sabina Davis1b84afa2019-02-09 01:20:21 -0800129cc_binary(
Sabina Davis91b23602019-01-21 00:06:01 -0800130 name = "joystick_reader",
131 srcs = [
132 ":joystick_reader.cc",
133 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800134 target_compatible_with = ["@platforms//os:linux"],
Sabina Davis91b23602019-01-21 00:06:01 -0800135 deps = [
Austin Schuhed5b26d2019-12-05 20:51:59 -0800136 ":camera_log_fbs",
Tyler Chatowe0241452019-03-08 21:07:50 -0800137 ":vision_proto",
Sabina Davis91b23602019-01-21 00:06:01 -0800138 "//aos:init",
139 "//aos/actions:action_lib",
Sabina Davis91b23602019-01-21 00:06:01 -0800140 "//aos/logging",
141 "//aos/network:team_number",
142 "//aos/stl_mutex",
143 "//aos/time",
144 "//aos/util:log_interval",
145 "//aos/vision/events:udp",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700146 "//frc971/autonomous:auto_fbs",
Sabina Davis91b23602019-01-21 00:06:01 -0800147 "//frc971/autonomous:base_autonomous_actor",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700148 "//frc971/control_loops:profiled_subsystem_fbs",
149 "//frc971/control_loops/drivetrain:localizer_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700150 "//frc971/input:action_joystick_input",
151 "//frc971/input:drivetrain_input",
152 "//frc971/input:joystick_input",
Sabina Davis91b23602019-01-21 00:06:01 -0800153 "//y2019/control_loops/drivetrain:drivetrain_base",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700154 "//y2019/control_loops/drivetrain:target_selector_fbs",
155 "//y2019/control_loops/superstructure:superstructure_goal_fbs",
156 "//y2019/control_loops/superstructure:superstructure_position_fbs",
157 "//y2019/control_loops/superstructure:superstructure_status_fbs",
Tyler Chatowe0241452019-03-08 21:07:50 -0800158 "@com_google_protobuf//:protobuf",
Sabina Davis91b23602019-01-21 00:06:01 -0800159 ],
160)
Sabina Davisabeae332019-02-01 21:12:57 -0800161
Alex Perrycb7da4b2019-08-28 19:35:56 -0700162flatbuffer_cc_library(
Austin Schuhed5b26d2019-12-05 20:51:59 -0800163 name = "camera_log_fbs",
164 srcs = [
165 "camera_log.fbs",
166 ],
167 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -0800168 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhed5b26d2019-12-05 20:51:59 -0800169 visibility = ["//visibility:public"],
170)
171
172flatbuffer_cc_library(
173 name = "status_light_fbs",
Sabina Davisc6329342019-03-01 20:44:42 -0800174 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700175 "status_light.fbs",
176 ],
177 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -0800178 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700179 visibility = ["//visibility:public"],
180)
181
182aos_config(
183 name = "config",
184 src = "y2019.json",
185 flatbuffers = [
Austin Schuhed5b26d2019-12-05 20:51:59 -0800186 ":status_light_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700187 "//y2019/control_loops/drivetrain:camera_fbs",
188 "//y2019/control_loops/drivetrain:target_selector_fbs",
189 "//y2019/control_loops/superstructure:superstructure_goal_fbs",
190 "//y2019/control_loops/superstructure:superstructure_output_fbs",
191 "//y2019/control_loops/superstructure:superstructure_position_fbs",
192 "//y2019/control_loops/superstructure:superstructure_status_fbs",
Austin Schuhed5b26d2019-12-05 20:51:59 -0800193 ":camera_log_fbs",
Sabina Davisc6329342019-03-01 20:44:42 -0800194 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800195 target_compatible_with = ["@platforms//os:linux"],
Sabina Davisc6329342019-03-01 20:44:42 -0800196 visibility = ["//visibility:public"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700197 deps = [
Austin Schuhed5b26d2019-12-05 20:51:59 -0800198 "//frc971/autonomous:config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700199 "//frc971/control_loops/drivetrain:config",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700200 "//frc971/input:config",
Austin Schuhed5b26d2019-12-05 20:51:59 -0800201 "//frc971/wpilib:config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700202 ],
Sabina Davisc6329342019-03-01 20:44:42 -0800203)
204
Michael Schuh5a1a7582019-03-01 13:03:47 -0800205cc_proto_library(
206 name = "vision_proto",
207 srcs = ["vision.proto"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800208 target_compatible_with = ["@platforms//os:linux"],
Michael Schuh5a1a7582019-03-01 13:03:47 -0800209 visibility = ["//visibility:public"],
210)
211
Michael Schuhab42b0a2019-01-07 16:33:43 -0800212py_library(
213 name = "python_init",
214 srcs = ["__init__.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800215 target_compatible_with = ["@platforms//os:linux"],
Michael Schuhab42b0a2019-01-07 16:33:43 -0800216 visibility = ["//visibility:public"],
Sabina Davisabeae332019-02-01 21:12:57 -0800217)