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