Austin Schuh | 378483c | 2019-01-20 16:36:40 -0800 | [diff] [blame] | 1 | load("//aos/build:queues.bzl", "queue_library") |
James Kuszmaul | 1057ce8 | 2019-02-09 17:58:24 -0800 | [diff] [blame] | 2 | load("//tools/build_rules:select.bzl", "cpu_select", "compiler_select") |
Austin Schuh | 378483c | 2019-01-20 16:36:40 -0800 | [diff] [blame] | 3 | |
| 4 | genrule( |
| 5 | name = "genrule_drivetrain", |
| 6 | outs = [ |
| 7 | "drivetrain_dog_motor_plant.h", |
| 8 | "drivetrain_dog_motor_plant.cc", |
| 9 | "kalman_drivetrain_motor_plant.h", |
| 10 | "kalman_drivetrain_motor_plant.cc", |
| 11 | ], |
| 12 | cmd = "$(location //y2019/control_loops/python:drivetrain) $(OUTS)", |
| 13 | tools = [ |
| 14 | "//y2019/control_loops/python:drivetrain", |
| 15 | ], |
| 16 | ) |
| 17 | |
| 18 | genrule( |
| 19 | name = "genrule_polydrivetrain", |
| 20 | outs = [ |
| 21 | "polydrivetrain_dog_motor_plant.h", |
| 22 | "polydrivetrain_dog_motor_plant.cc", |
| 23 | "polydrivetrain_cim_plant.h", |
| 24 | "polydrivetrain_cim_plant.cc", |
| 25 | "hybrid_velocity_drivetrain.h", |
| 26 | "hybrid_velocity_drivetrain.cc", |
| 27 | ], |
| 28 | cmd = "$(location //y2019/control_loops/python:polydrivetrain) $(OUTS)", |
| 29 | tools = [ |
| 30 | "//y2019/control_loops/python:polydrivetrain", |
| 31 | ], |
| 32 | ) |
| 33 | |
| 34 | cc_library( |
| 35 | name = "polydrivetrain_plants", |
| 36 | srcs = [ |
| 37 | "drivetrain_dog_motor_plant.cc", |
| 38 | "hybrid_velocity_drivetrain.cc", |
| 39 | "kalman_drivetrain_motor_plant.cc", |
| 40 | "polydrivetrain_dog_motor_plant.cc", |
| 41 | ], |
| 42 | hdrs = [ |
| 43 | "drivetrain_dog_motor_plant.h", |
| 44 | "hybrid_velocity_drivetrain.h", |
| 45 | "kalman_drivetrain_motor_plant.h", |
| 46 | "polydrivetrain_dog_motor_plant.h", |
| 47 | ], |
| 48 | visibility = ["//visibility:public"], |
| 49 | deps = [ |
| 50 | "//frc971/control_loops:hybrid_state_feedback_loop", |
| 51 | "//frc971/control_loops:state_feedback_loop", |
| 52 | ], |
| 53 | ) |
| 54 | |
| 55 | cc_library( |
| 56 | name = "drivetrain_base", |
| 57 | srcs = [ |
| 58 | "drivetrain_base.cc", |
| 59 | ], |
| 60 | hdrs = [ |
| 61 | "drivetrain_base.h", |
| 62 | ], |
| 63 | visibility = ["//visibility:public"], |
| 64 | deps = [ |
| 65 | ":polydrivetrain_plants", |
| 66 | "//frc971:shifter_hall_effect", |
| 67 | "//frc971/control_loops/drivetrain:drivetrain_config", |
| 68 | ], |
| 69 | ) |
| 70 | |
| 71 | cc_binary( |
| 72 | name = "drivetrain", |
| 73 | srcs = [ |
| 74 | "drivetrain_main.cc", |
| 75 | ], |
| 76 | visibility = ["//visibility:public"], |
| 77 | deps = [ |
| 78 | ":drivetrain_base", |
James Kuszmaul | 09f564a | 2019-02-18 17:37:09 -0800 | [diff] [blame] | 79 | ":event_loop_localizer", |
Austin Schuh | 378483c | 2019-01-20 16:36:40 -0800 | [diff] [blame] | 80 | "//aos:init", |
Austin Schuh | 55a13dc | 2019-01-27 22:39:03 -0800 | [diff] [blame] | 81 | "//aos/events:shm-event-loop", |
Austin Schuh | 378483c | 2019-01-20 16:36:40 -0800 | [diff] [blame] | 82 | "//frc971/control_loops/drivetrain:drivetrain_lib", |
| 83 | ], |
| 84 | ) |
James Kuszmaul | 57c7c9b | 2019-01-27 16:16:01 -0800 | [diff] [blame] | 85 | |
James Kuszmaul | 09f564a | 2019-02-18 17:37:09 -0800 | [diff] [blame] | 86 | queue_library( |
James Kuszmaul | 7d1ef44 | 2019-03-23 20:20:50 -0700 | [diff] [blame^] | 87 | name = "target_selector_queue", |
| 88 | srcs = [ |
| 89 | "target_selector.q", |
| 90 | ], |
| 91 | visibility = ["//visibility:public"], |
| 92 | ) |
| 93 | |
| 94 | queue_library( |
James Kuszmaul | 09f564a | 2019-02-18 17:37:09 -0800 | [diff] [blame] | 95 | name = "camera_queue", |
| 96 | srcs = [ |
| 97 | "camera.q", |
| 98 | ], |
Brian Silverman | c41fb86 | 2019-03-02 21:14:46 -0800 | [diff] [blame] | 99 | visibility = ["//visibility:public"], |
James Kuszmaul | 09f564a | 2019-02-18 17:37:09 -0800 | [diff] [blame] | 100 | ) |
| 101 | |
James Kuszmaul | 57c7c9b | 2019-01-27 16:16:01 -0800 | [diff] [blame] | 102 | cc_library( |
| 103 | name = "camera", |
| 104 | srcs = ["camera.h"], |
James Kuszmaul | 22c5ab3 | 2019-02-09 14:45:58 -0800 | [diff] [blame] | 105 | visibility = ["//y2019:__pkg__"], |
James Kuszmaul | 57c7c9b | 2019-01-27 16:16:01 -0800 | [diff] [blame] | 106 | deps = [ |
| 107 | "//aos/containers:sized_array", |
| 108 | "//frc971/control_loops:pose", |
| 109 | ], |
| 110 | ) |
| 111 | |
| 112 | cc_test( |
| 113 | name = "camera_test", |
| 114 | srcs = ["camera_test.cc"], |
| 115 | deps = [ |
| 116 | ":camera", |
| 117 | "//aos/testing:googletest", |
| 118 | ], |
| 119 | ) |
James Kuszmaul | 1057ce8 | 2019-02-09 17:58:24 -0800 | [diff] [blame] | 120 | |
| 121 | cc_library( |
| 122 | name = "localizer", |
| 123 | hdrs = ["localizer.h"], |
| 124 | deps = [ |
| 125 | ":camera", |
| 126 | "//frc971/control_loops:pose", |
| 127 | "//frc971/control_loops/drivetrain:hybrid_ekf", |
| 128 | ], |
| 129 | ) |
| 130 | |
James Kuszmaul | 09f564a | 2019-02-18 17:37:09 -0800 | [diff] [blame] | 131 | cc_library( |
James Kuszmaul | d73d025 | 2019-03-02 14:57:09 -0800 | [diff] [blame] | 132 | name = "target_selector", |
| 133 | srcs = ["target_selector.cc"], |
| 134 | hdrs = ["target_selector.h"], |
| 135 | deps = [ |
| 136 | ":camera", |
James Kuszmaul | 7d1ef44 | 2019-03-23 20:20:50 -0700 | [diff] [blame^] | 137 | ":target_selector_queue", |
James Kuszmaul | d73d025 | 2019-03-02 14:57:09 -0800 | [diff] [blame] | 138 | "//frc971/control_loops:pose", |
| 139 | "//frc971/control_loops/drivetrain:localizer", |
| 140 | "//y2019:constants", |
James Kuszmaul | 7d1ef44 | 2019-03-23 20:20:50 -0700 | [diff] [blame^] | 141 | "//y2019/control_loops/superstructure:superstructure_queue", |
James Kuszmaul | d73d025 | 2019-03-02 14:57:09 -0800 | [diff] [blame] | 142 | ], |
| 143 | ) |
| 144 | |
| 145 | cc_test( |
| 146 | name = "target_selector_test", |
| 147 | srcs = ["target_selector_test.cc"], |
| 148 | deps = [ |
| 149 | ":target_selector", |
| 150 | "//aos/testing:googletest", |
James Kuszmaul | 7d1ef44 | 2019-03-23 20:20:50 -0700 | [diff] [blame^] | 151 | "//aos/testing:test_shm", |
James Kuszmaul | d73d025 | 2019-03-02 14:57:09 -0800 | [diff] [blame] | 152 | ], |
| 153 | ) |
| 154 | |
| 155 | cc_library( |
James Kuszmaul | 09f564a | 2019-02-18 17:37:09 -0800 | [diff] [blame] | 156 | name = "event_loop_localizer", |
| 157 | srcs = ["event_loop_localizer.cc"], |
| 158 | hdrs = ["event_loop_localizer.h"], |
| 159 | deps = [ |
| 160 | ":camera_queue", |
| 161 | ":localizer", |
James Kuszmaul | d73d025 | 2019-03-02 14:57:09 -0800 | [diff] [blame] | 162 | ":target_selector", |
James Kuszmaul | 09f564a | 2019-02-18 17:37:09 -0800 | [diff] [blame] | 163 | "//frc971/control_loops/drivetrain:localizer", |
| 164 | "//y2019:constants", |
| 165 | ], |
| 166 | ) |
| 167 | |
James Kuszmaul | 1057ce8 | 2019-02-09 17:58:24 -0800 | [diff] [blame] | 168 | cc_test( |
| 169 | name = "localizer_test", |
| 170 | srcs = ["localizer_test.cc"], |
| 171 | defines = |
| 172 | cpu_select({ |
| 173 | "amd64": [ |
| 174 | "SUPPORT_PLOT=1", |
| 175 | ], |
| 176 | "arm": [], |
| 177 | }), |
| 178 | linkstatic = True, |
| 179 | deps = [ |
| 180 | ":localizer", |
| 181 | ":drivetrain_base", |
| 182 | "//aos/testing:googletest", |
| 183 | "//aos/testing:random_seed", |
| 184 | "//aos/testing:test_shm", |
| 185 | "//frc971/control_loops/drivetrain:trajectory", |
| 186 | "//y2019:constants", |
| 187 | "//frc971/control_loops/drivetrain:splinedrivetrain", |
| 188 | "@com_github_gflags_gflags//:gflags", |
| 189 | ] + cpu_select({ |
| 190 | "amd64": [ |
| 191 | "//third_party/matplotlib-cpp", |
| 192 | ], |
| 193 | "arm": [], |
| 194 | }), |
| 195 | ) |
James Kuszmaul | 09f564a | 2019-02-18 17:37:09 -0800 | [diff] [blame] | 196 | |
| 197 | cc_test( |
| 198 | name = "localized_drivetrain_test", |
| 199 | srcs = ["localized_drivetrain_test.cc"], |
| 200 | deps = [ |
| 201 | ":camera_queue", |
| 202 | ":drivetrain_base", |
| 203 | ":event_loop_localizer", |
| 204 | ":localizer", |
| 205 | "//aos/controls:control_loop_test", |
| 206 | "//aos/network:team_number", |
| 207 | "//frc971/control_loops:team_number_test_environment", |
| 208 | "//frc971/control_loops/drivetrain:drivetrain_lib", |
| 209 | "//frc971/control_loops/drivetrain:drivetrain_test_lib", |
| 210 | ], |
| 211 | ) |