James Kuszmaul | 04a343c | 2023-02-20 16:38:22 -0800 | [diff] [blame] | 1 | load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library") |
James Kuszmaul | a8e0d6e | 2023-03-12 13:33:36 -0700 | [diff] [blame] | 2 | load("//tools/build_rules:js.bzl", "ts_project") |
James Kuszmaul | 827a6d6 | 2023-03-26 12:40:29 -0700 | [diff] [blame] | 3 | load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library") |
| 4 | |
| 5 | ts_project( |
| 6 | name = "localizer_plotter", |
| 7 | srcs = ["localizer_plotter.ts"], |
| 8 | target_compatible_with = ["@platforms//os:linux"], |
| 9 | visibility = ["//visibility:public"], |
| 10 | deps = [ |
| 11 | "//aos/network/www:aos_plotter", |
| 12 | "//aos/network/www:colors", |
| 13 | "//aos/network/www:proxy", |
| 14 | "//frc971/wpilib:imu_plot_utils", |
| 15 | ], |
| 16 | ) |
James Kuszmaul | 04a343c | 2023-02-20 16:38:22 -0800 | [diff] [blame] | 17 | |
| 18 | flatbuffer_cc_library( |
| 19 | name = "status_fbs", |
| 20 | srcs = [ |
| 21 | "status.fbs", |
| 22 | ], |
| 23 | gen_reflections = True, |
| 24 | target_compatible_with = ["@platforms//os:linux"], |
| 25 | visibility = ["//visibility:public"], |
| 26 | deps = [ |
| 27 | "//frc971/control_loops/drivetrain:drivetrain_status_fbs", |
| 28 | "//frc971/imu_reader:imu_failures_fbs", |
| 29 | ], |
| 30 | ) |
| 31 | |
| 32 | flatbuffer_ts_library( |
| 33 | name = "status_ts_fbs", |
| 34 | srcs = ["status.fbs"], |
| 35 | visibility = ["//visibility:public"], |
| 36 | deps = [ |
| 37 | "//frc971/control_loops/drivetrain:drivetrain_status_ts_fbs", |
| 38 | "//frc971/imu_reader:imu_failures_ts_fbs", |
| 39 | ], |
| 40 | ) |
| 41 | |
| 42 | flatbuffer_cc_library( |
| 43 | name = "visualization_fbs", |
| 44 | srcs = [ |
| 45 | "visualization.fbs", |
| 46 | ], |
| 47 | gen_reflections = True, |
James Kuszmaul | 04a343c | 2023-02-20 16:38:22 -0800 | [diff] [blame] | 48 | visibility = ["//visibility:public"], |
| 49 | deps = [ |
| 50 | ":status_fbs", |
| 51 | ], |
| 52 | ) |
| 53 | |
| 54 | flatbuffer_ts_library( |
| 55 | name = "visualization_ts_fbs", |
| 56 | srcs = ["visualization.fbs"], |
| 57 | visibility = ["//visibility:public"], |
| 58 | deps = [ |
| 59 | ":status_ts_fbs", |
| 60 | ], |
| 61 | ) |
| 62 | |
James Kuszmaul | 18008f8 | 2023-02-23 20:52:50 -0800 | [diff] [blame] | 63 | flatbuffer_cc_library( |
| 64 | name = "scoring_map_fbs", |
| 65 | srcs = [ |
| 66 | "scoring_map.fbs", |
| 67 | ], |
| 68 | gen_reflections = True, |
| 69 | visibility = ["//visibility:public"], |
| 70 | deps = [ |
| 71 | "//frc971/vision:target_map_fbs", |
| 72 | ], |
| 73 | ) |
| 74 | |
| 75 | flatbuffer_cc_library( |
| 76 | name = "relative_scoring_map_fbs", |
| 77 | srcs = [ |
| 78 | "relative_scoring_map.fbs", |
| 79 | ], |
| 80 | gen_reflections = True, |
| 81 | visibility = ["//visibility:public"], |
| 82 | deps = [ |
| 83 | ":scoring_map_fbs", |
| 84 | ], |
| 85 | ) |
| 86 | |
| 87 | cc_library( |
| 88 | name = "utils", |
| 89 | srcs = ["utils.cc"], |
| 90 | hdrs = ["utils.h"], |
milind-u | 607f323 | 2023-02-26 15:22:40 -0800 | [diff] [blame] | 91 | visibility = ["//visibility:public"], |
James Kuszmaul | 18008f8 | 2023-02-23 20:52:50 -0800 | [diff] [blame] | 92 | deps = [ |
| 93 | "//frc971/vision:target_map_fbs", |
| 94 | "@org_tuxfamily_eigen//:eigen", |
| 95 | ], |
| 96 | ) |
| 97 | |
| 98 | cc_library( |
| 99 | name = "map_expander_lib", |
| 100 | srcs = ["map_expander_lib.cc"], |
| 101 | hdrs = ["map_expander_lib.h"], |
| 102 | deps = [ |
| 103 | ":relative_scoring_map_fbs", |
| 104 | ":scoring_map_fbs", |
| 105 | ":utils", |
| 106 | "//aos:flatbuffers", |
| 107 | "//aos:json_to_flatbuffer", |
| 108 | ], |
| 109 | ) |
| 110 | |
| 111 | cc_binary( |
| 112 | name = "map_expander", |
| 113 | srcs = ["map_expander.cc"], |
| 114 | data = [ |
| 115 | "//y2023/constants:scoring_map", |
| 116 | "//y2023/vision/maps", |
| 117 | ], |
| 118 | deps = [ |
| 119 | ":map_expander_lib", |
| 120 | "//aos:init", |
| 121 | ], |
| 122 | ) |
| 123 | |
| 124 | cc_test( |
| 125 | name = "map_expander_lib_test", |
| 126 | srcs = ["map_expander_lib_test.cc"], |
| 127 | data = [ |
| 128 | "//y2023/constants:scoring_map", |
| 129 | "//y2023/vision/maps", |
| 130 | ], |
| 131 | deps = [ |
| 132 | ":map_expander_lib", |
| 133 | "//aos/testing:flatbuffer_eq", |
| 134 | "//aos/testing:googletest", |
| 135 | ], |
| 136 | ) |
| 137 | |
James Kuszmaul | 04a343c | 2023-02-20 16:38:22 -0800 | [diff] [blame] | 138 | cc_library( |
| 139 | name = "localizer", |
| 140 | srcs = ["localizer.cc"], |
| 141 | hdrs = ["localizer.h"], |
milind-u | d4051fe | 2023-02-25 18:00:05 -0800 | [diff] [blame] | 142 | visibility = ["//visibility:public"], |
James Kuszmaul | 04a343c | 2023-02-20 16:38:22 -0800 | [diff] [blame] | 143 | deps = [ |
| 144 | ":status_fbs", |
James Kuszmaul | 18008f8 | 2023-02-23 20:52:50 -0800 | [diff] [blame] | 145 | ":utils", |
James Kuszmaul | 04a343c | 2023-02-20 16:38:22 -0800 | [diff] [blame] | 146 | ":visualization_fbs", |
| 147 | "//aos/containers:sized_array", |
| 148 | "//aos/events:event_loop", |
Maxwell Henderson | 85d8187 | 2023-04-07 18:21:59 -0700 | [diff] [blame^] | 149 | "//aos/network:message_bridge_client_fbs", |
James Kuszmaul | 04a343c | 2023-02-20 16:38:22 -0800 | [diff] [blame] | 150 | "//frc971/constants:constants_sender_lib", |
| 151 | "//frc971/control_loops:pose", |
| 152 | "//frc971/control_loops/drivetrain:hybrid_ekf", |
| 153 | "//frc971/control_loops/drivetrain:improved_down_estimator", |
| 154 | "//frc971/control_loops/drivetrain:localizer_fbs", |
| 155 | "//frc971/control_loops/drivetrain/localization:localizer_output_fbs", |
| 156 | "//frc971/control_loops/drivetrain/localization:utils", |
| 157 | "//frc971/imu_reader:imu_watcher", |
| 158 | "//frc971/vision:target_map_fbs", |
| 159 | "//y2023:constants", |
| 160 | "//y2023/constants:constants_fbs", |
| 161 | ], |
| 162 | ) |
| 163 | |
| 164 | cc_test( |
| 165 | name = "localizer_test", |
| 166 | srcs = ["localizer_test.cc"], |
| 167 | data = ["//y2023:aos_config"], |
| 168 | deps = [ |
| 169 | ":localizer", |
| 170 | ":status_fbs", |
James Kuszmaul | 18008f8 | 2023-02-23 20:52:50 -0800 | [diff] [blame] | 171 | ":utils", |
James Kuszmaul | 04a343c | 2023-02-20 16:38:22 -0800 | [diff] [blame] | 172 | "//aos/events:simulated_event_loop", |
| 173 | "//aos/events/logging:log_writer", |
| 174 | "//aos/testing:googletest", |
| 175 | "//frc971/control_loops/drivetrain:drivetrain_test_lib", |
| 176 | "//frc971/control_loops/drivetrain:localizer_fbs", |
| 177 | "//y2023/constants:simulated_constants_sender", |
| 178 | "//y2023/control_loops/drivetrain:drivetrain_base", |
| 179 | ], |
| 180 | ) |
| 181 | |
| 182 | cc_binary( |
| 183 | name = "localizer_main", |
| 184 | srcs = ["localizer_main.cc"], |
| 185 | visibility = ["//visibility:public"], |
| 186 | deps = [ |
| 187 | ":localizer", |
| 188 | "//aos:init", |
| 189 | "//aos/events:shm_event_loop", |
| 190 | "//frc971/constants:constants_sender_lib", |
| 191 | "//y2023/control_loops/drivetrain:drivetrain_base", |
| 192 | ], |
| 193 | ) |
James Kuszmaul | a8e0d6e | 2023-03-12 13:33:36 -0700 | [diff] [blame] | 194 | |
| 195 | ts_project( |
| 196 | name = "corrections_plotter", |
| 197 | srcs = ["corrections_plotter.ts"], |
| 198 | target_compatible_with = ["@platforms//os:linux"], |
| 199 | visibility = ["//visibility:public"], |
| 200 | deps = [ |
| 201 | ":visualization_ts_fbs", |
| 202 | "//aos/network/www:aos_plotter", |
| 203 | "//aos/network/www:colors", |
| 204 | "//aos/network/www:proxy", |
| 205 | ], |
| 206 | ) |
James Kuszmaul | 6e0d865 | 2023-03-12 14:02:26 -0700 | [diff] [blame] | 207 | |
| 208 | cc_binary( |
| 209 | name = "localizer_replay", |
| 210 | srcs = ["localizer_replay.cc"], |
| 211 | data = [ |
| 212 | "//y2023:aos_config", |
| 213 | ], |
| 214 | target_compatible_with = ["@platforms//os:linux"], |
| 215 | deps = [ |
| 216 | ":localizer", |
| 217 | "//aos:configuration", |
| 218 | "//aos:init", |
| 219 | "//aos:json_to_flatbuffer", |
| 220 | "//aos/events:simulated_event_loop", |
| 221 | "//aos/events/logging:log_reader", |
| 222 | "//aos/events/logging:log_writer", |
| 223 | "//y2023/control_loops/drivetrain:drivetrain_base", |
| 224 | ], |
| 225 | ) |