blob: 99041324fb9f537e13e19ac2eb47273f8a232ab4 [file] [log] [blame]
Philipp Schrader87277f42022-01-01 07:45:12 -08001load("@npm//@bazel/typescript:index.bzl", "ts_library")
2load("//tools/build_rules:js.bzl", "rollup_bundle")
Austin Schuha1d006e2022-09-14 21:50:42 -07003load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
4load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
James Kuszmaul48671362020-12-24 13:54:16 -08005load("//aos:config.bzl", "aos_config")
James Kuszmaul61a971f2020-01-01 15:06:18 -08006
Philipp Schradercc016b32021-12-30 08:59:58 -08007package(default_visibility = ["//visibility:public"])
8
James Kuszmaul7daef362019-12-31 18:28:17 -08009cc_binary(
10 name = "py_log_reader.so",
11 srcs = ["py_log_reader.cc"],
12 linkshared = True,
Philipp Schraderdada1072020-11-24 11:34:46 -080013 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul7daef362019-12-31 18:28:17 -080014 deps = [
15 "//aos:configuration",
16 "//aos:json_to_flatbuffer",
17 "//aos/events:shm_event_loop",
18 "//aos/events:simulated_event_loop",
Austin Schuhb06f03b2021-02-17 22:00:37 -080019 "//aos/events/logging:log_reader",
James Kuszmaul7daef362019-12-31 18:28:17 -080020 "@com_github_google_glog//:glog",
Brian Silverman4c7235a2021-11-17 19:04:37 -080021 "@python_repo//:python3.9_lib",
James Kuszmaul7daef362019-12-31 18:28:17 -080022 ],
23)
24
25py_test(
26 name = "log_reader_test",
27 srcs = ["log_reader_test.py"],
28 data = [
29 ":py_log_reader.so",
30 "@sample_logfile//file",
31 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080032 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul7daef362019-12-31 18:28:17 -080033 deps = ["//aos:configuration_fbs_python"],
34)
James Kuszmaul61a971f2020-01-01 15:06:18 -080035
James Kuszmaul5f5e1232020-12-22 20:58:00 -080036ts_library(
37 name = "plot_index",
38 srcs = ["plot_index.ts"],
39 target_compatible_with = ["@platforms//os:linux"],
40 deps = [
41 "//aos:configuration_ts_fbs",
42 "//aos/network/www:demo_plot",
43 "//aos/network/www:proxy",
James Kuszmaulac2b6b42021-03-07 22:38:06 -080044 "//frc971/control_loops/drivetrain:down_estimator_plotter",
James Kuszmaulc4ae11c2020-12-26 16:26:58 -080045 "//frc971/control_loops/drivetrain:drivetrain_plotter",
milind upadhyay9bd381d2021-01-23 13:44:13 -080046 "//frc971/control_loops/drivetrain:robot_state_plotter",
James Kuszmaul73fc1352021-04-09 22:31:25 -070047 "//frc971/control_loops/drivetrain:spline_plotter",
James Kuszmaul5f5e1232020-12-22 20:58:00 -080048 "//frc971/wpilib:imu_plotter",
James Kuszmaul9c23d262021-09-25 21:50:02 -070049 "//y2020/control_loops/drivetrain:localizer_plotter",
Austin Schuh7d63eab2021-03-06 20:15:02 -080050 "//y2020/control_loops/superstructure:accelerator_plotter",
51 "//y2020/control_loops/superstructure:finisher_plotter",
Austin Schuh2efe1682021-03-06 22:47:15 -080052 "//y2020/control_loops/superstructure:hood_plotter",
James Kuszmaul78101402021-09-11 12:42:21 -070053 "//y2020/control_loops/superstructure:turret_plotter",
Sabina Leaver58f04b72021-10-06 20:52:09 -070054 "//y2021_bot3/control_loops/superstructure:superstructure_plotter",
Austin Schuh76f227c2022-02-23 16:34:08 -080055 "//y2022/control_loops/superstructure:catapult_plotter",
Milind Upadhyayeb739bb2022-03-02 10:49:21 -080056 "//y2022/control_loops/superstructure:climber_plotter",
57 "//y2022/control_loops/superstructure:intake_plotter",
Ravago Jonesb64988c2022-03-06 15:05:01 -080058 "//y2022/control_loops/superstructure:superstructure_plotter",
Milind Upadhyayeb739bb2022-03-02 10:49:21 -080059 "//y2022/control_loops/superstructure:turret_plotter",
James Kuszmaul51fa1ae2022-02-26 00:49:57 -080060 "//y2022/localizer:localizer_plotter",
James Kuszmaulb35e2342022-03-06 15:44:00 -080061 "//y2022/vision:vision_plotter",
James Kuszmaul5f5e1232020-12-22 20:58:00 -080062 ],
63)
64
65rollup_bundle(
66 name = "plot_index_bundle",
James Kuszmaul5f5e1232020-12-22 20:58:00 -080067 entry_point = "plot_index.ts",
68 target_compatible_with = ["@platforms//os:linux"],
69 deps = [
70 ":plot_index",
71 ],
72)
73
Austin Schuhfcd56942022-07-18 17:41:32 -070074genrule(
75 name = "copy_css",
76 srcs = [
77 "//aos/network/www:styles.css",
78 ],
79 outs = ["styles.css"],
80 cmd = "cp $< $@",
81)
82
James Kuszmaul5f5e1232020-12-22 20:58:00 -080083filegroup(
84 name = "plotter_files",
85 srcs = [
86 "index.html",
87 "plot_index_bundle.min.js",
Austin Schuhfcd56942022-07-18 17:41:32 -070088 "styles.css",
James Kuszmaul5f5e1232020-12-22 20:58:00 -080089 ],
90)
91
92sh_binary(
93 name = "web_plotter",
94 srcs = ["web_plotter.sh"],
95 data = [
96 ":plotter_files",
97 "//aos/network:log_web_proxy_main",
98 ],
99 target_compatible_with = ["@platforms//os:linux"],
100)
101
102sh_binary(
103 name = "live_web_plotter_demo",
104 srcs = ["live_web_plotter_demo.sh"],
105 data = [
106 ":plotter_files",
107 "//aos/network:web_proxy_main",
108 "//aos/network/www:test_config",
109 ],
110 target_compatible_with = ["@platforms//os:linux"],
111)
James Kuszmaul48671362020-12-24 13:54:16 -0800112
113flatbuffer_cc_library(
114 name = "plot_data_fbs",
115 srcs = [
116 "plot_data.fbs",
117 ],
118 gen_reflections = 1,
119 target_compatible_with = ["@platforms//os:linux"],
120)
121
122flatbuffer_ts_library(
123 name = "plot_data_ts_fbs",
124 srcs = [
125 "plot_data.fbs",
126 ],
127 target_compatible_with = ["@platforms//os:linux"],
128)
129
130ts_library(
131 name = "plot_data_utils",
132 srcs = ["plot_data_utils.ts"],
133 visibility = ["//visibility:public"],
134 deps = [
135 ":plot_data_ts_fbs",
136 "//aos:configuration_ts_fbs",
137 "//aos/network/www:aos_plotter",
138 "//aos/network/www:plotter",
139 "//aos/network/www:proxy",
James Kuszmauldac091f2022-03-22 09:35:06 -0700140 "@com_github_google_flatbuffers//reflection:reflection_ts_fbs",
James Kuszmaul48671362020-12-24 13:54:16 -0800141 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
142 ],
143)
144
145aos_config(
146 name = "plotter",
147 src = "plotter_config.json",
148 flatbuffers = [":plot_data_fbs"],
149 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800150 deps = ["//aos/events:aos_config"],
James Kuszmaul48671362020-12-24 13:54:16 -0800151)
152
153cc_library(
154 name = "in_process_plotter",
155 srcs = ["in_process_plotter.cc"],
156 hdrs = ["in_process_plotter.h"],
James Kuszmaule32fa932021-05-11 21:38:16 -0700157 data = [
158 ":plotter",
Austin Schuhaa3b0862022-07-15 14:38:41 -0700159 "//frc971/analysis/cpp_plot:cpp_plot_files",
James Kuszmaul48671362020-12-24 13:54:16 -0800160 ],
161 deps = [
162 ":plot_data_fbs",
163 "//aos/events:simulated_event_loop",
164 "//aos/network:web_proxy",
165 ],
166)
167
168cc_binary(
169 name = "in_process_plotter_demo",
170 srcs = ["in_process_plotter_demo.cc"],
James Kuszmaul48671362020-12-24 13:54:16 -0800171 deps = [
172 ":in_process_plotter",
173 "//aos:init",
174 ],
175)
Henry Speiserc82be542022-04-07 22:05:20 -0700176
177cc_binary(
178 name = "log_to_match",
179 srcs = [
180 "log_to_match.cc",
181 ],
182 target_compatible_with = ["@platforms//os:linux"],
183 deps = [
184 "//aos:init",
185 "//aos/events:simulated_event_loop",
186 "//aos/events/logging:log_reader",
187 "//frc971/input:joystick_state_fbs",
188 ],
189)