Move generic packages from frc971/analysis to aos
To eliminate a dependency of aos on frc971.
Signed-off-by: Stephan Pleines <pleines.stephan@gmail.com>
Change-Id: Ic4a8f75da29f8e8c6675d96f02824cd08a9b99be
diff --git a/aos/analysis/BUILD b/aos/analysis/BUILD
new file mode 100644
index 0000000..63f2d57
--- /dev/null
+++ b/aos/analysis/BUILD
@@ -0,0 +1,108 @@
+load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
+load("//tools/build_rules:js.bzl", "ts_project")
+load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
+load("//aos:config.bzl", "aos_config")
+
+package(default_visibility = ["//visibility:public"])
+
+cc_binary(
+ name = "py_log_reader.so",
+ srcs = ["py_log_reader.cc"],
+ linkshared = True,
+ target_compatible_with = ["@platforms//os:linux"],
+ deps = [
+ "//aos:configuration",
+ "//aos:json_to_flatbuffer",
+ "//aos/events:shm_event_loop",
+ "//aos/events:simulated_event_loop",
+ "//aos/events/logging:log_reader",
+ "//third_party/python",
+ "@com_github_google_glog//:glog",
+ ],
+)
+
+py_test(
+ name = "log_reader_test",
+ srcs = ["log_reader_test.py"],
+ data = [
+ ":py_log_reader.so",
+ "@sample_logfile//file",
+ ],
+ target_compatible_with = ["@platforms//os:linux"],
+ deps = ["//aos:configuration_fbs_python"],
+)
+
+static_flatbuffer(
+ name = "plot_data_fbs",
+ srcs = [
+ "plot_data.fbs",
+ ],
+ target_compatible_with = ["@platforms//os:linux"],
+)
+
+flatbuffer_ts_library(
+ name = "plot_data_ts_fbs",
+ srcs = [
+ "plot_data.fbs",
+ ],
+ target_compatible_with = ["@platforms//os:linux"],
+)
+
+ts_project(
+ name = "plot_data_utils",
+ srcs = ["plot_data_utils.ts"],
+ visibility = ["//visibility:public"],
+ deps = [
+ ":plot_data_ts_fbs",
+ "//aos:configuration_ts_fbs",
+ "//aos/network/www:aos_plotter",
+ "//aos/network/www:plotter",
+ "//aos/network/www:proxy",
+ "@com_github_google_flatbuffers//reflection:reflection_ts_fbs",
+ "@com_github_google_flatbuffers//ts:flatbuffers_ts",
+ ],
+)
+
+aos_config(
+ name = "plotter",
+ src = "plotter_config.json",
+ flatbuffers = [":plot_data_fbs"],
+ target_compatible_with = ["@platforms//os:linux"],
+ deps = ["//aos/events:aos_config"],
+)
+
+cc_library(
+ name = "in_process_plotter",
+ srcs = ["in_process_plotter.cc"],
+ hdrs = ["in_process_plotter.h"],
+ data = [
+ ":plotter",
+ "//aos/analysis/cpp_plot:cpp_plot_files",
+ ],
+ deps = [
+ ":plot_data_fbs",
+ "//aos/events:simulated_event_loop",
+ "//aos/network:web_proxy",
+ ],
+)
+
+cc_binary(
+ name = "in_process_plotter_demo",
+ srcs = ["in_process_plotter_demo.cc"],
+ deps = [
+ ":in_process_plotter",
+ "//aos:init",
+ ],
+)
+
+cc_binary(
+ name = "local_foxglove",
+ srcs = ["local_foxglove.cc"],
+ data = ["@foxglove_studio"],
+ deps = [
+ "//aos:init",
+ "//aos/network:gen_embedded",
+ "//aos/seasocks:seasocks_logger",
+ "//third_party/seasocks",
+ ],
+)
diff --git a/frc971/analysis/cpp_plot/BUILD b/aos/analysis/cpp_plot/BUILD
similarity index 94%
rename from frc971/analysis/cpp_plot/BUILD
rename to aos/analysis/cpp_plot/BUILD
index 7f34afe..7286aaf 100644
--- a/frc971/analysis/cpp_plot/BUILD
+++ b/aos/analysis/cpp_plot/BUILD
@@ -8,8 +8,8 @@
target_compatible_with = ["@platforms//os:linux"],
deps = [
"//aos:configuration_ts_fbs",
+ "//aos/analysis:plot_data_utils",
"//aos/network/www:proxy",
- "//frc971/analysis:plot_data_utils",
],
)
diff --git a/frc971/analysis/cpp_plot/cpp_plot.ts b/aos/analysis/cpp_plot/cpp_plot.ts
similarity index 100%
rename from frc971/analysis/cpp_plot/cpp_plot.ts
rename to aos/analysis/cpp_plot/cpp_plot.ts
diff --git a/frc971/analysis/cpp_plot/index.html b/aos/analysis/cpp_plot/index.html
similarity index 100%
rename from frc971/analysis/cpp_plot/index.html
rename to aos/analysis/cpp_plot/index.html
diff --git a/frc971/analysis/in_process_plotter.cc b/aos/analysis/in_process_plotter.cc
similarity index 98%
rename from frc971/analysis/in_process_plotter.cc
rename to aos/analysis/in_process_plotter.cc
index b537aa4..a2ed68c 100644
--- a/frc971/analysis/in_process_plotter.cc
+++ b/aos/analysis/in_process_plotter.cc
@@ -1,4 +1,4 @@
-#include "frc971/analysis/in_process_plotter.h"
+#include "aos/analysis/in_process_plotter.h"
#include "aos/configuration.h"
diff --git a/frc971/analysis/in_process_plotter.h b/aos/analysis/in_process_plotter.h
similarity index 98%
rename from frc971/analysis/in_process_plotter.h
rename to aos/analysis/in_process_plotter.h
index df81041..fdfde8c 100644
--- a/frc971/analysis/in_process_plotter.h
+++ b/aos/analysis/in_process_plotter.h
@@ -3,9 +3,9 @@
#include <vector>
+#include "aos/analysis/plot_data_generated.h"
#include "aos/events/simulated_event_loop.h"
#include "aos/network/web_proxy.h"
-#include "frc971/analysis/plot_data_generated.h"
namespace frc971::analysis {
diff --git a/frc971/analysis/in_process_plotter_demo.cc b/aos/analysis/in_process_plotter_demo.cc
similarity index 96%
rename from frc971/analysis/in_process_plotter_demo.cc
rename to aos/analysis/in_process_plotter_demo.cc
index 99e0c1d..a02451a 100644
--- a/frc971/analysis/in_process_plotter_demo.cc
+++ b/aos/analysis/in_process_plotter_demo.cc
@@ -1,5 +1,5 @@
+#include "aos/analysis/in_process_plotter.h"
#include "aos/init.h"
-#include "frc971/analysis/in_process_plotter.h"
// To run this example, do:
// bazel run -c opt //frc971/analysis:in_process_plotter_demo
diff --git a/frc971/analysis/local_foxglove.cc b/aos/analysis/local_foxglove.cc
similarity index 100%
rename from frc971/analysis/local_foxglove.cc
rename to aos/analysis/local_foxglove.cc
diff --git a/frc971/analysis/log_reader_test.py b/aos/analysis/log_reader_test.py
similarity index 98%
rename from frc971/analysis/log_reader_test.py
rename to aos/analysis/log_reader_test.py
index 7af08e6..69627aa 100644
--- a/frc971/analysis/log_reader_test.py
+++ b/aos/analysis/log_reader_test.py
@@ -2,7 +2,7 @@
import json
import unittest
-from frc971.analysis.py_log_reader import LogReader
+from aos.analysis.py_log_reader import LogReader
class LogReaderTest(unittest.TestCase):
diff --git a/frc971/analysis/plot_data.fbs b/aos/analysis/plot_data.fbs
similarity index 100%
rename from frc971/analysis/plot_data.fbs
rename to aos/analysis/plot_data.fbs
diff --git a/frc971/analysis/plot_data_utils.ts b/aos/analysis/plot_data_utils.ts
similarity index 100%
rename from frc971/analysis/plot_data_utils.ts
rename to aos/analysis/plot_data_utils.ts
diff --git a/frc971/analysis/plotter_config.json b/aos/analysis/plotter_config.json
similarity index 100%
rename from frc971/analysis/plotter_config.json
rename to aos/analysis/plotter_config.json
diff --git a/frc971/analysis/py_log_reader.cc b/aos/analysis/py_log_reader.cc
similarity index 100%
rename from frc971/analysis/py_log_reader.cc
rename to aos/analysis/py_log_reader.cc
diff --git a/aos/events/logging/BUILD b/aos/events/logging/BUILD
index 1743f88..21754bb 100644
--- a/aos/events/logging/BUILD
+++ b/aos/events/logging/BUILD
@@ -965,7 +965,7 @@
srcs = ["timestamp_plot.cc"],
deps = [
"//aos:init",
- "//frc971/analysis:in_process_plotter",
+ "//aos/analysis:in_process_plotter",
"@com_google_absl//absl/strings",
],
)
diff --git a/aos/events/logging/timestamp_plot.cc b/aos/events/logging/timestamp_plot.cc
index e266716..8aee90d 100644
--- a/aos/events/logging/timestamp_plot.cc
+++ b/aos/events/logging/timestamp_plot.cc
@@ -1,9 +1,9 @@
#include "absl/strings/str_cat.h"
#include "absl/strings/str_split.h"
+#include "aos/analysis/in_process_plotter.h"
#include "aos/init.h"
#include "aos/util/file.h"
-#include "frc971/analysis/in_process_plotter.h"
using frc971::analysis::Plotter;
diff --git a/frc971/analysis/BUILD b/frc971/analysis/BUILD
index 93f50f4..b179ad9 100644
--- a/frc971/analysis/BUILD
+++ b/frc971/analysis/BUILD
@@ -1,37 +1,7 @@
-load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
load("//tools/build_rules:js.bzl", "rollup_bundle", "ts_project")
-load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
-load("//aos:config.bzl", "aos_config")
package(default_visibility = ["//visibility:public"])
-cc_binary(
- name = "py_log_reader.so",
- srcs = ["py_log_reader.cc"],
- linkshared = True,
- target_compatible_with = ["@platforms//os:linux"],
- deps = [
- "//aos:configuration",
- "//aos:json_to_flatbuffer",
- "//aos/events:shm_event_loop",
- "//aos/events:simulated_event_loop",
- "//aos/events/logging:log_reader",
- "//third_party/python",
- "@com_github_google_glog//:glog",
- ],
-)
-
-py_test(
- name = "log_reader_test",
- srcs = ["log_reader_test.py"],
- data = [
- ":py_log_reader.so",
- "@sample_logfile//file",
- ],
- target_compatible_with = ["@platforms//os:linux"],
- deps = ["//aos:configuration_fbs_python"],
-)
-
ts_project(
name = "plot_index",
srcs = ["plot_index.ts"],
@@ -73,15 +43,6 @@
],
)
-genrule(
- name = "copy_css",
- srcs = [
- "//aos/network/www:styles.css",
- ],
- outs = ["styles.css"],
- cmd = "cp $< $@",
-)
-
filegroup(
name = "plotter_files",
srcs = [
@@ -112,67 +73,13 @@
target_compatible_with = ["@platforms//os:linux"],
)
-static_flatbuffer(
- name = "plot_data_fbs",
+genrule(
+ name = "copy_css",
srcs = [
- "plot_data.fbs",
+ "//aos/network/www:styles.css",
],
- target_compatible_with = ["@platforms//os:linux"],
-)
-
-flatbuffer_ts_library(
- name = "plot_data_ts_fbs",
- srcs = [
- "plot_data.fbs",
- ],
- target_compatible_with = ["@platforms//os:linux"],
-)
-
-ts_project(
- name = "plot_data_utils",
- srcs = ["plot_data_utils.ts"],
- visibility = ["//visibility:public"],
- deps = [
- ":plot_data_ts_fbs",
- "//aos:configuration_ts_fbs",
- "//aos/network/www:aos_plotter",
- "//aos/network/www:plotter",
- "//aos/network/www:proxy",
- "@com_github_google_flatbuffers//reflection:reflection_ts_fbs",
- "@com_github_google_flatbuffers//ts:flatbuffers_ts",
- ],
-)
-
-aos_config(
- name = "plotter",
- src = "plotter_config.json",
- flatbuffers = [":plot_data_fbs"],
- target_compatible_with = ["@platforms//os:linux"],
- deps = ["//aos/events:aos_config"],
-)
-
-cc_library(
- name = "in_process_plotter",
- srcs = ["in_process_plotter.cc"],
- hdrs = ["in_process_plotter.h"],
- data = [
- ":plotter",
- "//frc971/analysis/cpp_plot:cpp_plot_files",
- ],
- deps = [
- ":plot_data_fbs",
- "//aos/events:simulated_event_loop",
- "//aos/network:web_proxy",
- ],
-)
-
-cc_binary(
- name = "in_process_plotter_demo",
- srcs = ["in_process_plotter_demo.cc"],
- deps = [
- ":in_process_plotter",
- "//aos:init",
- ],
+ outs = ["styles.css"],
+ cmd = "cp $< $@",
)
cc_binary(
@@ -204,18 +111,6 @@
],
)
-cc_binary(
- name = "local_foxglove",
- srcs = ["local_foxglove.cc"],
- data = ["@foxglove_studio"],
- deps = [
- "//aos:init",
- "//aos/network:gen_embedded",
- "//aos/seasocks:seasocks_logger",
- "//third_party/seasocks",
- ],
-)
-
py_binary(
name = "trim_and_plot_foxglove",
srcs = ["trim_and_plot_foxglove.py"],
diff --git a/frc971/control_loops/drivetrain/BUILD b/frc971/control_loops/drivetrain/BUILD
index 6f98839..afbce9b 100644
--- a/frc971/control_loops/drivetrain/BUILD
+++ b/frc971/control_loops/drivetrain/BUILD
@@ -606,8 +606,8 @@
target_compatible_with = ["@platforms//os:linux"],
deps = [
":spline",
+ "//aos/analysis:in_process_plotter",
"//aos/testing:googletest",
- "//frc971/analysis:in_process_plotter",
"@com_github_gflags_gflags//:gflags",
],
)
diff --git a/frc971/control_loops/drivetrain/spline_test.cc b/frc971/control_loops/drivetrain/spline_test.cc
index 6d84d53..fcd0030 100644
--- a/frc971/control_loops/drivetrain/spline_test.cc
+++ b/frc971/control_loops/drivetrain/spline_test.cc
@@ -5,7 +5,7 @@
#include "gflags/gflags.h"
#include "gtest/gtest.h"
-#include "frc971/analysis/in_process_plotter.h"
+#include "aos/analysis/in_process_plotter.h"
DEFINE_bool(plot, false, "If true, plot");
diff --git a/frc971/vision/BUILD b/frc971/vision/BUILD
index 5d8bf7c..6cee780 100644
--- a/frc971/vision/BUILD
+++ b/frc971/vision/BUILD
@@ -131,7 +131,6 @@
":foxglove_image_converter_lib",
"//aos:init",
"//aos/events/logging:log_reader",
- "//frc971/analysis:in_process_plotter",
"//frc971/control_loops/drivetrain:improved_down_estimator",
"//frc971/vision:visualize_robot",
"//frc971/wpilib:imu_batch_fbs",
@@ -142,6 +141,12 @@
"@com_google_absl//absl/strings:str_format",
"@com_google_ceres_solver//:ceres",
"@org_tuxfamily_eigen//:eigen",
+ ] + [
+ # TODO(Stephan): This is a whacky hack. If we include this
+ # in the proper spot above (alphabetically), then we get a
+ # linker error: duplicate symbol: crc32.
+ # It's part of both @zlib and @com_github_rawrtc_re.
+ "//aos/analysis:in_process_plotter",
],
)
diff --git a/frc971/vision/extrinsics_calibration.cc b/frc971/vision/extrinsics_calibration.cc
index 6017258..5c4ae31 100644
--- a/frc971/vision/extrinsics_calibration.cc
+++ b/frc971/vision/extrinsics_calibration.cc
@@ -7,8 +7,8 @@
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc.hpp>
+#include "aos/analysis/in_process_plotter.h"
#include "aos/time/time.h"
-#include "frc971/analysis/in_process_plotter.h"
#include "frc971/control_loops/runge_kutta.h"
#include "frc971/vision/calibration_accumulator.h"
#include "frc971/vision/charuco_lib.h"
diff --git a/y2018/control_loops/superstructure/arm/BUILD b/y2018/control_loops/superstructure/arm/BUILD
index ec18f9d..319e591 100644
--- a/y2018/control_loops/superstructure/arm/BUILD
+++ b/y2018/control_loops/superstructure/arm/BUILD
@@ -73,7 +73,7 @@
deps = [
":arm_constants",
":generated_graph",
- "//frc971/analysis:in_process_plotter",
+ "//aos/analysis:in_process_plotter",
"//frc971/control_loops/double_jointed_arm:ekf",
"//frc971/control_loops/double_jointed_arm:trajectory",
"@com_github_gflags_gflags//:gflags",
diff --git a/y2018/control_loops/superstructure/arm/trajectory_plot.cc b/y2018/control_loops/superstructure/arm/trajectory_plot.cc
index 6739b07..29dc085 100644
--- a/y2018/control_loops/superstructure/arm/trajectory_plot.cc
+++ b/y2018/control_loops/superstructure/arm/trajectory_plot.cc
@@ -1,7 +1,7 @@
#include "gflags/gflags.h"
+#include "aos/analysis/in_process_plotter.h"
#include "aos/init.h"
-#include "frc971/analysis/in_process_plotter.h"
#include "frc971/control_loops/double_jointed_arm/dynamics.h"
#include "frc971/control_loops/double_jointed_arm/ekf.h"
#include "frc971/control_loops/double_jointed_arm/trajectory.h"
diff --git a/y2023/control_loops/superstructure/arm/BUILD b/y2023/control_loops/superstructure/arm/BUILD
index 2f4e7d6..a54f72c 100644
--- a/y2023/control_loops/superstructure/arm/BUILD
+++ b/y2023/control_loops/superstructure/arm/BUILD
@@ -119,7 +119,7 @@
deps = [
":arm_constants",
"//aos:init",
- "//frc971/analysis:in_process_plotter",
+ "//aos/analysis:in_process_plotter",
"//frc971/control_loops:dlqr",
"//frc971/control_loops:jacobian",
"//frc971/control_loops/double_jointed_arm:dynamics",
@@ -166,7 +166,7 @@
":arm_constants",
":generated_graph",
":trajectory",
- "//frc971/analysis:in_process_plotter",
+ "//aos/analysis:in_process_plotter",
"//frc971/control_loops:binomial",
"//frc971/control_loops:fixed_quadrature",
"//frc971/control_loops/double_jointed_arm:ekf",
diff --git a/y2023/control_loops/superstructure/arm/arm_design.cc b/y2023/control_loops/superstructure/arm/arm_design.cc
index e918746..d17535a 100644
--- a/y2023/control_loops/superstructure/arm/arm_design.cc
+++ b/y2023/control_loops/superstructure/arm/arm_design.cc
@@ -1,5 +1,5 @@
+#include "aos/analysis/in_process_plotter.h"
#include "aos/init.h"
-#include "frc971/analysis/in_process_plotter.h"
#include "frc971/control_loops/dlqr.h"
#include "frc971/control_loops/double_jointed_arm/dynamics.h"
#include "frc971/control_loops/jacobian.h"
diff --git a/y2023/control_loops/superstructure/arm/trajectory_plot.cc b/y2023/control_loops/superstructure/arm/trajectory_plot.cc
index 4db5080..9b99660 100644
--- a/y2023/control_loops/superstructure/arm/trajectory_plot.cc
+++ b/y2023/control_loops/superstructure/arm/trajectory_plot.cc
@@ -1,7 +1,7 @@
#include "gflags/gflags.h"
+#include "aos/analysis/in_process_plotter.h"
#include "aos/init.h"
-#include "frc971/analysis/in_process_plotter.h"
#include "frc971/control_loops/binomial.h"
#include "frc971/control_loops/double_jointed_arm/dynamics.h"
#include "frc971/control_loops/double_jointed_arm/ekf.h"