James Kuszmaul | 1798c07 | 2022-02-13 15:32:11 -0800 | [diff] [blame^] | 1 | load("//aos:config.bzl", "aos_config") |
| 2 | |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 3 | genrule( |
| 4 | name = "genrule_drivetrain", |
| 5 | outs = [ |
| 6 | "drivetrain_dog_motor_plant.h", |
| 7 | "drivetrain_dog_motor_plant.cc", |
| 8 | "kalman_drivetrain_motor_plant.h", |
| 9 | "kalman_drivetrain_motor_plant.cc", |
| 10 | ], |
| 11 | cmd = "$(location //y2022/control_loops/python:drivetrain) $(OUTS)", |
| 12 | target_compatible_with = ["@platforms//os:linux"], |
| 13 | tools = [ |
| 14 | "//y2022/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 //y2022/control_loops/python:polydrivetrain) $(OUTS)", |
| 29 | target_compatible_with = ["@platforms//os:linux"], |
| 30 | tools = [ |
| 31 | "//y2022/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 | target_compatible_with = ["@platforms//os:linux"], |
| 50 | visibility = ["//visibility:public"], |
| 51 | deps = [ |
| 52 | "//frc971/control_loops:hybrid_state_feedback_loop", |
| 53 | "//frc971/control_loops:state_feedback_loop", |
| 54 | ], |
| 55 | ) |
| 56 | |
| 57 | cc_library( |
| 58 | name = "drivetrain_base", |
| 59 | srcs = [ |
| 60 | "drivetrain_base.cc", |
| 61 | ], |
| 62 | hdrs = [ |
| 63 | "drivetrain_base.h", |
| 64 | ], |
| 65 | target_compatible_with = ["@platforms//os:linux"], |
| 66 | visibility = ["//visibility:public"], |
| 67 | deps = [ |
| 68 | ":polydrivetrain_plants", |
| 69 | "//frc971:shifter_hall_effect", |
| 70 | "//frc971/control_loops/drivetrain:drivetrain_config", |
| 71 | ], |
| 72 | ) |
| 73 | |
James Kuszmaul | 1798c07 | 2022-02-13 15:32:11 -0800 | [diff] [blame^] | 74 | cc_library( |
| 75 | name = "localizer", |
| 76 | srcs = ["localizer.cc"], |
| 77 | hdrs = ["localizer.h"], |
| 78 | deps = [ |
| 79 | "//aos/events:event_loop", |
| 80 | "//aos/network:message_bridge_server_fbs", |
| 81 | "//frc971/control_loops/drivetrain:hybrid_ekf", |
| 82 | "//frc971/control_loops/drivetrain:localizer", |
| 83 | "//y2022/control_loops/localizer:localizer_output_fbs", |
| 84 | ], |
| 85 | ) |
| 86 | |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 87 | cc_binary( |
| 88 | name = "drivetrain", |
| 89 | srcs = [ |
| 90 | "drivetrain_main.cc", |
| 91 | ], |
| 92 | target_compatible_with = ["@platforms//os:linux"], |
| 93 | visibility = ["//visibility:public"], |
| 94 | deps = [ |
| 95 | ":drivetrain_base", |
James Kuszmaul | 1798c07 | 2022-02-13 15:32:11 -0800 | [diff] [blame^] | 96 | ":localizer", |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 97 | "//aos:init", |
| 98 | "//aos/events:shm_event_loop", |
| 99 | "//frc971/control_loops/drivetrain:drivetrain_lib", |
| 100 | ], |
| 101 | ) |
James Kuszmaul | 1798c07 | 2022-02-13 15:32:11 -0800 | [diff] [blame^] | 102 | |
| 103 | aos_config( |
| 104 | name = "simulation_config", |
| 105 | src = "drivetrain_simulation_config.json", |
| 106 | target_compatible_with = ["@platforms//os:linux"], |
| 107 | visibility = ["//visibility:public"], |
| 108 | deps = [ |
| 109 | "//frc971/control_loops/drivetrain:simulation_channels", |
| 110 | "//y2022:config", |
| 111 | ], |
| 112 | ) |
| 113 | |
| 114 | cc_test( |
| 115 | name = "localizer_test", |
| 116 | srcs = ["localizer_test.cc"], |
| 117 | data = [":simulation_config"], |
| 118 | target_compatible_with = ["@platforms//os:linux"], |
| 119 | deps = [ |
| 120 | ":drivetrain_base", |
| 121 | ":localizer", |
| 122 | "//aos/events:simulated_event_loop", |
| 123 | "//aos/events/logging:log_writer", |
| 124 | "//aos/network:team_number", |
| 125 | "//aos/network:testing_time_converter", |
| 126 | "//frc971/control_loops:control_loop_test", |
| 127 | "//frc971/control_loops:team_number_test_environment", |
| 128 | "//frc971/control_loops/drivetrain:drivetrain_lib", |
| 129 | "//frc971/control_loops/drivetrain:drivetrain_test_lib", |
| 130 | "//y2022/control_loops/localizer:localizer_output_fbs", |
| 131 | ], |
| 132 | ) |