James Kuszmaul | f01da39 | 2023-12-14 11:22:14 -0800 | [diff] [blame] | 1 | load("//aos/flatbuffers:generate.bzl", "static_flatbuffer") |
Philipp Schrader | 3de4dfc | 2023-02-15 20:18:25 -0800 | [diff] [blame] | 2 | load("//tools/build_rules:js.bzl", "ts_project") |
Austin Schuh | a1d006e | 2022-09-14 21:50:42 -0700 | [diff] [blame] | 3 | load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library") |
James Kuszmaul | 5398fae | 2020-02-17 16:44:03 -0800 | [diff] [blame] | 4 | load("//aos:config.bzl", "aos_config") |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 5 | |
| 6 | genrule( |
| 7 | name = "genrule_drivetrain", |
| 8 | outs = [ |
| 9 | "drivetrain_dog_motor_plant.h", |
| 10 | "drivetrain_dog_motor_plant.cc", |
James Kuszmaul | eeb98e9 | 2024-01-14 22:15:32 -0800 | [diff] [blame] | 11 | "drivetrain_dog_motor_plant.json", |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 12 | "kalman_drivetrain_motor_plant.h", |
| 13 | "kalman_drivetrain_motor_plant.cc", |
James Kuszmaul | eeb98e9 | 2024-01-14 22:15:32 -0800 | [diff] [blame] | 14 | "kalman_drivetrain_motor_plant.json", |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 15 | ], |
| 16 | cmd = "$(location //y2020/control_loops/python:drivetrain) $(OUTS)", |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 17 | target_compatible_with = ["@platforms//os:linux"], |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 18 | tools = [ |
| 19 | "//y2020/control_loops/python:drivetrain", |
| 20 | ], |
| 21 | ) |
| 22 | |
| 23 | genrule( |
| 24 | name = "genrule_polydrivetrain", |
| 25 | outs = [ |
| 26 | "polydrivetrain_dog_motor_plant.h", |
| 27 | "polydrivetrain_dog_motor_plant.cc", |
James Kuszmaul | eeb98e9 | 2024-01-14 22:15:32 -0800 | [diff] [blame] | 28 | "polydrivetrain_dog_motor_plant.json", |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 29 | "polydrivetrain_cim_plant.h", |
| 30 | "polydrivetrain_cim_plant.cc", |
James Kuszmaul | eeb98e9 | 2024-01-14 22:15:32 -0800 | [diff] [blame] | 31 | "polydrivetrain_cim_plant.json", |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 32 | "hybrid_velocity_drivetrain.h", |
| 33 | "hybrid_velocity_drivetrain.cc", |
James Kuszmaul | eeb98e9 | 2024-01-14 22:15:32 -0800 | [diff] [blame] | 34 | "hybrid_velocity_drivetrain.json", |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 35 | ], |
| 36 | cmd = "$(location //y2020/control_loops/python:polydrivetrain) $(OUTS)", |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 37 | target_compatible_with = ["@platforms//os:linux"], |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 38 | tools = [ |
| 39 | "//y2020/control_loops/python:polydrivetrain", |
| 40 | ], |
| 41 | ) |
| 42 | |
| 43 | cc_library( |
| 44 | name = "polydrivetrain_plants", |
| 45 | srcs = [ |
| 46 | "drivetrain_dog_motor_plant.cc", |
| 47 | "hybrid_velocity_drivetrain.cc", |
| 48 | "kalman_drivetrain_motor_plant.cc", |
| 49 | "polydrivetrain_dog_motor_plant.cc", |
| 50 | ], |
| 51 | hdrs = [ |
| 52 | "drivetrain_dog_motor_plant.h", |
| 53 | "hybrid_velocity_drivetrain.h", |
| 54 | "kalman_drivetrain_motor_plant.h", |
| 55 | "polydrivetrain_dog_motor_plant.h", |
| 56 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 57 | target_compatible_with = ["@platforms//os:linux"], |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 58 | visibility = ["//visibility:public"], |
| 59 | deps = [ |
| 60 | "//frc971/control_loops:hybrid_state_feedback_loop", |
| 61 | "//frc971/control_loops:state_feedback_loop", |
| 62 | ], |
| 63 | ) |
| 64 | |
James Kuszmaul | f01da39 | 2023-12-14 11:22:14 -0800 | [diff] [blame] | 65 | static_flatbuffer( |
James Kuszmaul | 5ff8a86 | 2021-09-25 17:29:43 -0700 | [diff] [blame] | 66 | name = "localizer_debug_fbs", |
| 67 | srcs = ["localizer_debug.fbs"], |
James Kuszmaul | 5ff8a86 | 2021-09-25 17:29:43 -0700 | [diff] [blame] | 68 | visibility = ["//visibility:public"], |
| 69 | ) |
| 70 | |
James Kuszmaul | f75ecd6 | 2021-10-23 14:33:46 -0700 | [diff] [blame] | 71 | flatbuffer_ts_library( |
| 72 | name = "localizer_debug_ts_fbs", |
| 73 | srcs = ["localizer_debug.fbs"], |
| 74 | target_compatible_with = ["@platforms//os:linux"], |
| 75 | visibility = ["//visibility:public"], |
| 76 | ) |
| 77 | |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 78 | cc_library( |
James Kuszmaul | 5398fae | 2020-02-17 16:44:03 -0800 | [diff] [blame] | 79 | name = "localizer", |
| 80 | srcs = ["localizer.cc"], |
| 81 | hdrs = ["localizer.h"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 82 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | 5398fae | 2020-02-17 16:44:03 -0800 | [diff] [blame] | 83 | deps = [ |
James Kuszmaul | 5ff8a86 | 2021-09-25 17:29:43 -0700 | [diff] [blame] | 84 | ":localizer_debug_fbs", |
James Kuszmaul | 5398fae | 2020-02-17 16:44:03 -0800 | [diff] [blame] | 85 | "//aos/containers:ring_buffer", |
James Kuszmaul | 5ff8a86 | 2021-09-25 17:29:43 -0700 | [diff] [blame] | 86 | "//aos/containers:sized_array", |
James Kuszmaul | 958b21e | 2020-02-26 21:51:40 -0800 | [diff] [blame] | 87 | "//aos/network:message_bridge_server_fbs", |
James Kuszmaul | 5398fae | 2020-02-17 16:44:03 -0800 | [diff] [blame] | 88 | "//frc971/control_loops:profiled_subsystem_fbs", |
| 89 | "//frc971/control_loops/drivetrain:hybrid_ekf", |
| 90 | "//frc971/control_loops/drivetrain:localizer", |
| 91 | "//y2020:constants", |
| 92 | "//y2020/control_loops/superstructure:superstructure_status_fbs", |
| 93 | "//y2020/vision/sift:sift_fbs", |
| 94 | ], |
| 95 | ) |
| 96 | |
| 97 | cc_library( |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 98 | name = "drivetrain_base", |
| 99 | srcs = [ |
| 100 | "drivetrain_base.cc", |
| 101 | ], |
| 102 | hdrs = [ |
| 103 | "drivetrain_base.h", |
| 104 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 105 | target_compatible_with = ["@platforms//os:linux"], |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 106 | visibility = ["//visibility:public"], |
| 107 | deps = [ |
| 108 | ":polydrivetrain_plants", |
| 109 | "//frc971:shifter_hall_effect", |
| 110 | "//frc971/control_loops/drivetrain:drivetrain_config", |
Brian Silverman | 7026e2d | 2021-11-11 16:15:35 -0800 | [diff] [blame] | 111 | "//y2020:constants", |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 112 | ], |
| 113 | ) |
| 114 | |
| 115 | cc_binary( |
James Kuszmaul | 75a18c5 | 2021-03-10 22:02:07 -0800 | [diff] [blame] | 116 | name = "trajectory_generator", |
| 117 | srcs = [ |
| 118 | "trajectory_generator_main.cc", |
| 119 | ], |
| 120 | target_compatible_with = ["@platforms//os:linux"], |
| 121 | visibility = ["//visibility:public"], |
| 122 | deps = [ |
| 123 | ":drivetrain_base", |
| 124 | "//aos:init", |
| 125 | "//aos/events:shm_event_loop", |
| 126 | "//frc971/control_loops/drivetrain:trajectory_generator", |
| 127 | ], |
| 128 | ) |
| 129 | |
| 130 | cc_binary( |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 131 | name = "drivetrain", |
| 132 | srcs = [ |
| 133 | "drivetrain_main.cc", |
| 134 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 135 | target_compatible_with = ["@platforms//os:linux"], |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 136 | visibility = ["//visibility:public"], |
| 137 | deps = [ |
| 138 | ":drivetrain_base", |
James Kuszmaul | 68f7d27 | 2020-02-22 20:55:02 -0800 | [diff] [blame] | 139 | ":localizer", |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 140 | "//aos:init", |
| 141 | "//aos/events:shm_event_loop", |
| 142 | "//frc971/control_loops/drivetrain:drivetrain_lib", |
| 143 | ], |
| 144 | ) |
James Kuszmaul | 022d40e | 2020-02-11 17:06:18 -0800 | [diff] [blame] | 145 | |
James Kuszmaul | 5398fae | 2020-02-17 16:44:03 -0800 | [diff] [blame] | 146 | aos_config( |
| 147 | name = "simulation_config", |
| 148 | src = "drivetrain_simulation_config.json", |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 149 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | 5398fae | 2020-02-17 16:44:03 -0800 | [diff] [blame] | 150 | visibility = ["//visibility:public"], |
| 151 | deps = [ |
| 152 | "//frc971/control_loops/drivetrain:simulation_channels", |
Austin Schuh | c5fa6d9 | 2022-02-25 14:36:28 -0800 | [diff] [blame] | 153 | "//y2020:aos_config", |
James Kuszmaul | 5398fae | 2020-02-17 16:44:03 -0800 | [diff] [blame] | 154 | ], |
| 155 | ) |
| 156 | |
| 157 | cc_test( |
| 158 | name = "localizer_test", |
| 159 | srcs = ["localizer_test.cc"], |
Austin Schuh | 14d7d3d | 2020-09-10 18:14:36 -0700 | [diff] [blame] | 160 | data = [":simulation_config"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 161 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | 5398fae | 2020-02-17 16:44:03 -0800 | [diff] [blame] | 162 | deps = [ |
| 163 | ":drivetrain_base", |
| 164 | ":localizer", |
James Kuszmaul | 5398fae | 2020-02-17 16:44:03 -0800 | [diff] [blame] | 165 | "//aos/events:simulated_event_loop", |
Austin Schuh | b06f03b | 2021-02-17 22:00:37 -0800 | [diff] [blame] | 166 | "//aos/events/logging:log_writer", |
James Kuszmaul | 5398fae | 2020-02-17 16:44:03 -0800 | [diff] [blame] | 167 | "//aos/network:team_number", |
Austin Schuh | 87dd383 | 2021-01-01 23:07:31 -0800 | [diff] [blame] | 168 | "//aos/network:testing_time_converter", |
Austin Schuh | 0a3c9d4 | 2021-07-15 22:36:24 -0700 | [diff] [blame] | 169 | "//frc971/control_loops:control_loop_test", |
James Kuszmaul | 5398fae | 2020-02-17 16:44:03 -0800 | [diff] [blame] | 170 | "//frc971/control_loops:team_number_test_environment", |
| 171 | "//frc971/control_loops/drivetrain:drivetrain_lib", |
| 172 | "//frc971/control_loops/drivetrain:drivetrain_test_lib", |
| 173 | ], |
| 174 | ) |
| 175 | |
James Kuszmaul | 531609d | 2020-02-18 17:12:23 -0800 | [diff] [blame] | 176 | cc_test( |
| 177 | name = "drivetrain_replay_test", |
| 178 | srcs = ["drivetrain_replay_test.cc"], |
| 179 | data = [ |
Austin Schuh | c5fa6d9 | 2022-02-25 14:36:28 -0800 | [diff] [blame] | 180 | "//y2020:aos_config", |
James Kuszmaul | 9c12812 | 2021-03-22 22:24:36 -0700 | [diff] [blame] | 181 | "@drivetrain_replay", |
James Kuszmaul | 531609d | 2020-02-18 17:12:23 -0800 | [diff] [blame] | 182 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 183 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | 531609d | 2020-02-18 17:12:23 -0800 | [diff] [blame] | 184 | deps = [ |
| 185 | ":drivetrain_base", |
| 186 | "//aos:configuration", |
| 187 | "//aos:init", |
| 188 | "//aos/events:shm_event_loop", |
| 189 | "//aos/events:simulated_event_loop", |
Austin Schuh | b06f03b | 2021-02-17 22:00:37 -0800 | [diff] [blame] | 190 | "//aos/events/logging:log_reader", |
| 191 | "//aos/events/logging:log_writer", |
James Kuszmaul | 531609d | 2020-02-18 17:12:23 -0800 | [diff] [blame] | 192 | "//aos/testing:googletest", |
| 193 | "//frc971/control_loops/drivetrain:drivetrain_lib", |
Austin Schuh | 41fad8c | 2021-10-23 21:25:12 -0700 | [diff] [blame] | 194 | "//frc971/control_loops/drivetrain:trajectory_schema", |
James Kuszmaul | 531609d | 2020-02-18 17:12:23 -0800 | [diff] [blame] | 195 | "@com_github_gflags_gflags//:gflags", |
| 196 | "@com_github_google_glog//:glog", |
| 197 | ], |
| 198 | ) |
| 199 | |
James Kuszmaul | 022d40e | 2020-02-11 17:06:18 -0800 | [diff] [blame] | 200 | cc_binary( |
| 201 | name = "drivetrain_replay", |
| 202 | srcs = ["drivetrain_replay.cc"], |
Austin Schuh | c5fa6d9 | 2022-02-25 14:36:28 -0800 | [diff] [blame] | 203 | data = ["//y2020:aos_config"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 204 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | 022d40e | 2020-02-11 17:06:18 -0800 | [diff] [blame] | 205 | deps = [ |
| 206 | ":drivetrain_base", |
James Kuszmaul | 68f7d27 | 2020-02-22 20:55:02 -0800 | [diff] [blame] | 207 | ":localizer", |
James Kuszmaul | 022d40e | 2020-02-11 17:06:18 -0800 | [diff] [blame] | 208 | "//aos:configuration", |
| 209 | "//aos:init", |
| 210 | "//aos/events:shm_event_loop", |
| 211 | "//aos/events:simulated_event_loop", |
Austin Schuh | b06f03b | 2021-02-17 22:00:37 -0800 | [diff] [blame] | 212 | "//aos/events/logging:log_reader", |
| 213 | "//aos/events/logging:log_writer", |
James Kuszmaul | e485354 | 2023-05-15 20:35:48 -0700 | [diff] [blame] | 214 | "//aos/util:simulation_logger", |
James Kuszmaul | 022d40e | 2020-02-11 17:06:18 -0800 | [diff] [blame] | 215 | "//frc971/control_loops/drivetrain:drivetrain_lib", |
James Kuszmaul | 75a18c5 | 2021-03-10 22:02:07 -0800 | [diff] [blame] | 216 | "//frc971/control_loops/drivetrain:trajectory_generator", |
milind-u | ba4f09a | 2021-10-11 17:51:22 -0700 | [diff] [blame] | 217 | "//y2020:constants", |
James Kuszmaul | aca8878 | 2021-04-24 16:48:45 -0700 | [diff] [blame] | 218 | "//y2020/control_loops/superstructure:superstructure_lib", |
James Kuszmaul | 022d40e | 2020-02-11 17:06:18 -0800 | [diff] [blame] | 219 | "@com_github_gflags_gflags//:gflags", |
| 220 | "@com_github_google_glog//:glog", |
| 221 | ], |
| 222 | ) |
James Kuszmaul | 9c23d26 | 2021-09-25 21:50:02 -0700 | [diff] [blame] | 223 | |
Philipp Schrader | 3de4dfc | 2023-02-15 20:18:25 -0800 | [diff] [blame] | 224 | ts_project( |
James Kuszmaul | 9c23d26 | 2021-09-25 21:50:02 -0700 | [diff] [blame] | 225 | name = "localizer_plotter", |
| 226 | srcs = ["localizer_plotter.ts"], |
| 227 | target_compatible_with = ["@platforms//os:linux"], |
| 228 | visibility = ["//visibility:public"], |
| 229 | deps = [ |
| 230 | "//aos:configuration_ts_fbs", |
| 231 | "//aos/network/www:aos_plotter", |
| 232 | "//aos/network/www:colors", |
| 233 | "//aos/network/www:plotter", |
| 234 | "//aos/network/www:proxy", |
| 235 | "//aos/network/www:reflection_ts", |
James Kuszmaul | dac091f | 2022-03-22 09:35:06 -0700 | [diff] [blame] | 236 | "@com_github_google_flatbuffers//reflection:reflection_ts_fbs", |
James Kuszmaul | 9c23d26 | 2021-09-25 21:50:02 -0700 | [diff] [blame] | 237 | "@com_github_google_flatbuffers//ts:flatbuffers_ts", |
| 238 | ], |
| 239 | ) |