Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 1 | load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library") |
James Kuszmaul | 5398fae | 2020-02-17 16:44:03 -0800 | [diff] [blame] | 2 | load("//aos:config.bzl", "aos_config") |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 3 | load("//tools/build_rules:select.bzl", "compiler_select", "cpu_select") |
| 4 | |
| 5 | genrule( |
| 6 | name = "genrule_drivetrain", |
| 7 | outs = [ |
| 8 | "drivetrain_dog_motor_plant.h", |
| 9 | "drivetrain_dog_motor_plant.cc", |
| 10 | "kalman_drivetrain_motor_plant.h", |
| 11 | "kalman_drivetrain_motor_plant.cc", |
| 12 | ], |
| 13 | cmd = "$(location //y2020/control_loops/python:drivetrain) $(OUTS)", |
| 14 | tools = [ |
| 15 | "//y2020/control_loops/python:drivetrain", |
| 16 | ], |
| 17 | ) |
| 18 | |
| 19 | genrule( |
| 20 | name = "genrule_polydrivetrain", |
| 21 | outs = [ |
| 22 | "polydrivetrain_dog_motor_plant.h", |
| 23 | "polydrivetrain_dog_motor_plant.cc", |
| 24 | "polydrivetrain_cim_plant.h", |
| 25 | "polydrivetrain_cim_plant.cc", |
| 26 | "hybrid_velocity_drivetrain.h", |
| 27 | "hybrid_velocity_drivetrain.cc", |
| 28 | ], |
| 29 | cmd = "$(location //y2020/control_loops/python:polydrivetrain) $(OUTS)", |
| 30 | tools = [ |
| 31 | "//y2020/control_loops/python:polydrivetrain", |
| 32 | ], |
| 33 | ) |
| 34 | |
| 35 | cc_library( |
| 36 | name = "polydrivetrain_plants", |
| 37 | srcs = [ |
| 38 | "drivetrain_dog_motor_plant.cc", |
| 39 | "hybrid_velocity_drivetrain.cc", |
| 40 | "kalman_drivetrain_motor_plant.cc", |
| 41 | "polydrivetrain_dog_motor_plant.cc", |
| 42 | ], |
| 43 | hdrs = [ |
| 44 | "drivetrain_dog_motor_plant.h", |
| 45 | "hybrid_velocity_drivetrain.h", |
| 46 | "kalman_drivetrain_motor_plant.h", |
| 47 | "polydrivetrain_dog_motor_plant.h", |
| 48 | ], |
| 49 | visibility = ["//visibility:public"], |
| 50 | deps = [ |
| 51 | "//frc971/control_loops:hybrid_state_feedback_loop", |
| 52 | "//frc971/control_loops:state_feedback_loop", |
| 53 | ], |
| 54 | ) |
| 55 | |
| 56 | cc_library( |
James Kuszmaul | 5398fae | 2020-02-17 16:44:03 -0800 | [diff] [blame] | 57 | name = "localizer", |
| 58 | srcs = ["localizer.cc"], |
| 59 | hdrs = ["localizer.h"], |
| 60 | deps = [ |
| 61 | "//aos/containers:ring_buffer", |
James Kuszmaul | 958b21e | 2020-02-26 21:51:40 -0800 | [diff] [blame] | 62 | "//aos/network:message_bridge_server_fbs", |
James Kuszmaul | 5398fae | 2020-02-17 16:44:03 -0800 | [diff] [blame] | 63 | "//frc971/control_loops:profiled_subsystem_fbs", |
| 64 | "//frc971/control_loops/drivetrain:hybrid_ekf", |
| 65 | "//frc971/control_loops/drivetrain:localizer", |
| 66 | "//y2020:constants", |
| 67 | "//y2020/control_loops/superstructure:superstructure_status_fbs", |
| 68 | "//y2020/vision/sift:sift_fbs", |
| 69 | ], |
| 70 | ) |
| 71 | |
| 72 | cc_library( |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 73 | name = "drivetrain_base", |
| 74 | srcs = [ |
| 75 | "drivetrain_base.cc", |
| 76 | ], |
| 77 | hdrs = [ |
| 78 | "drivetrain_base.h", |
| 79 | ], |
| 80 | visibility = ["//visibility:public"], |
| 81 | deps = [ |
| 82 | ":polydrivetrain_plants", |
| 83 | "//frc971:shifter_hall_effect", |
| 84 | "//frc971/control_loops/drivetrain:drivetrain_config", |
| 85 | ], |
| 86 | ) |
| 87 | |
| 88 | cc_binary( |
| 89 | name = "drivetrain", |
| 90 | srcs = [ |
| 91 | "drivetrain_main.cc", |
| 92 | ], |
| 93 | visibility = ["//visibility:public"], |
| 94 | deps = [ |
| 95 | ":drivetrain_base", |
James Kuszmaul | 68f7d27 | 2020-02-22 20:55:02 -0800 | [diff] [blame] | 96 | ":localizer", |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 97 | "//aos:init", |
| 98 | "//aos/events:shm_event_loop", |
| 99 | "//frc971/control_loops/drivetrain:drivetrain_lib", |
| 100 | ], |
| 101 | ) |
James Kuszmaul | 022d40e | 2020-02-11 17:06:18 -0800 | [diff] [blame] | 102 | |
James Kuszmaul | 5398fae | 2020-02-17 16:44:03 -0800 | [diff] [blame] | 103 | aos_config( |
| 104 | name = "simulation_config", |
| 105 | src = "drivetrain_simulation_config.json", |
| 106 | visibility = ["//visibility:public"], |
| 107 | deps = [ |
| 108 | "//frc971/control_loops/drivetrain:simulation_channels", |
| 109 | "//y2020:config", |
| 110 | ], |
| 111 | ) |
| 112 | |
| 113 | cc_test( |
| 114 | name = "localizer_test", |
| 115 | srcs = ["localizer_test.cc"], |
| 116 | data = [":simulation_config.json"], |
| 117 | deps = [ |
| 118 | ":drivetrain_base", |
| 119 | ":localizer", |
| 120 | "//aos/controls:control_loop_test", |
| 121 | "//aos/events:simulated_event_loop", |
| 122 | "//aos/events/logging:logger", |
| 123 | "//aos/network:team_number", |
| 124 | "//frc971/control_loops:team_number_test_environment", |
| 125 | "//frc971/control_loops/drivetrain:drivetrain_lib", |
| 126 | "//frc971/control_loops/drivetrain:drivetrain_test_lib", |
| 127 | ], |
| 128 | ) |
| 129 | |
James Kuszmaul | 531609d | 2020-02-18 17:12:23 -0800 | [diff] [blame] | 130 | cc_test( |
| 131 | name = "drivetrain_replay_test", |
| 132 | srcs = ["drivetrain_replay_test.cc"], |
| 133 | data = [ |
| 134 | "//y2020:config.json", |
| 135 | "@drivetrain_replay//file:spinning_wheels_while_still.bfbs", |
| 136 | ], |
| 137 | deps = [ |
| 138 | ":drivetrain_base", |
| 139 | "//aos:configuration", |
| 140 | "//aos:init", |
| 141 | "//aos/events:shm_event_loop", |
| 142 | "//aos/events:simulated_event_loop", |
| 143 | "//aos/events/logging:logger", |
| 144 | "//aos/testing:googletest", |
| 145 | "//frc971/control_loops/drivetrain:drivetrain_lib", |
| 146 | "@com_github_gflags_gflags//:gflags", |
| 147 | "@com_github_google_glog//:glog", |
| 148 | ], |
| 149 | ) |
| 150 | |
James Kuszmaul | 022d40e | 2020-02-11 17:06:18 -0800 | [diff] [blame] | 151 | cc_binary( |
| 152 | name = "drivetrain_replay", |
| 153 | srcs = ["drivetrain_replay.cc"], |
| 154 | data = ["//y2020:config.json"], |
| 155 | deps = [ |
| 156 | ":drivetrain_base", |
James Kuszmaul | 68f7d27 | 2020-02-22 20:55:02 -0800 | [diff] [blame] | 157 | ":localizer", |
James Kuszmaul | 022d40e | 2020-02-11 17:06:18 -0800 | [diff] [blame] | 158 | "//aos:configuration", |
| 159 | "//aos:init", |
| 160 | "//aos/events:shm_event_loop", |
| 161 | "//aos/events:simulated_event_loop", |
| 162 | "//aos/events/logging:logger", |
| 163 | "//frc971/control_loops/drivetrain:drivetrain_lib", |
| 164 | "@com_github_gflags_gflags//:gflags", |
| 165 | "@com_github_google_glog//:glog", |
| 166 | ], |
| 167 | ) |