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", |
| 62 | "//frc971/control_loops:profiled_subsystem_fbs", |
| 63 | "//frc971/control_loops/drivetrain:hybrid_ekf", |
| 64 | "//frc971/control_loops/drivetrain:localizer", |
| 65 | "//y2020:constants", |
| 66 | "//y2020/control_loops/superstructure:superstructure_status_fbs", |
| 67 | "//y2020/vision/sift:sift_fbs", |
| 68 | ], |
| 69 | ) |
| 70 | |
| 71 | cc_library( |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 72 | name = "drivetrain_base", |
| 73 | srcs = [ |
| 74 | "drivetrain_base.cc", |
| 75 | ], |
| 76 | hdrs = [ |
| 77 | "drivetrain_base.h", |
| 78 | ], |
| 79 | visibility = ["//visibility:public"], |
| 80 | deps = [ |
| 81 | ":polydrivetrain_plants", |
| 82 | "//frc971:shifter_hall_effect", |
| 83 | "//frc971/control_loops/drivetrain:drivetrain_config", |
| 84 | ], |
| 85 | ) |
| 86 | |
| 87 | cc_binary( |
| 88 | name = "drivetrain", |
| 89 | srcs = [ |
| 90 | "drivetrain_main.cc", |
| 91 | ], |
| 92 | visibility = ["//visibility:public"], |
| 93 | deps = [ |
| 94 | ":drivetrain_base", |
| 95 | "//aos:init", |
| 96 | "//aos/events:shm_event_loop", |
| 97 | "//frc971/control_loops/drivetrain:drivetrain_lib", |
| 98 | ], |
| 99 | ) |
James Kuszmaul | 022d40e | 2020-02-11 17:06:18 -0800 | [diff] [blame] | 100 | |
James Kuszmaul | 5398fae | 2020-02-17 16:44:03 -0800 | [diff] [blame] | 101 | aos_config( |
| 102 | name = "simulation_config", |
| 103 | src = "drivetrain_simulation_config.json", |
| 104 | visibility = ["//visibility:public"], |
| 105 | deps = [ |
| 106 | "//frc971/control_loops/drivetrain:simulation_channels", |
| 107 | "//y2020:config", |
| 108 | ], |
| 109 | ) |
| 110 | |
| 111 | cc_test( |
| 112 | name = "localizer_test", |
| 113 | srcs = ["localizer_test.cc"], |
| 114 | data = [":simulation_config.json"], |
| 115 | deps = [ |
| 116 | ":drivetrain_base", |
| 117 | ":localizer", |
| 118 | "//aos/controls:control_loop_test", |
| 119 | "//aos/events:simulated_event_loop", |
| 120 | "//aos/events/logging:logger", |
| 121 | "//aos/network:team_number", |
| 122 | "//frc971/control_loops:team_number_test_environment", |
| 123 | "//frc971/control_loops/drivetrain:drivetrain_lib", |
| 124 | "//frc971/control_loops/drivetrain:drivetrain_test_lib", |
| 125 | ], |
| 126 | ) |
| 127 | |
James Kuszmaul | 022d40e | 2020-02-11 17:06:18 -0800 | [diff] [blame] | 128 | cc_binary( |
| 129 | name = "drivetrain_replay", |
| 130 | srcs = ["drivetrain_replay.cc"], |
| 131 | data = ["//y2020:config.json"], |
| 132 | deps = [ |
| 133 | ":drivetrain_base", |
| 134 | "//aos:configuration", |
| 135 | "//aos:init", |
| 136 | "//aos/events:shm_event_loop", |
| 137 | "//aos/events:simulated_event_loop", |
| 138 | "//aos/events/logging:logger", |
| 139 | "//frc971/control_loops/drivetrain:drivetrain_lib", |
| 140 | "@com_github_gflags_gflags//:gflags", |
| 141 | "@com_github_google_glog//:glog", |
| 142 | ], |
| 143 | ) |