Jim Ostrowski | cb8b408 | 2024-01-21 02:23:46 -0800 | [diff] [blame] | 1 | include "frc971/vision/calibration.fbs"; |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 2 | include "frc971/vision/target_map.fbs"; |
Niko Sohmers | b21dbdc | 2024-01-20 20:06:59 -0800 | [diff] [blame] | 3 | include "frc971/control_loops/profiled_subsystem.fbs"; |
| 4 | include "frc971/zeroing/constants.fbs"; |
Niko Sohmers | c4d2c50 | 2024-02-19 19:35:35 -0800 | [diff] [blame] | 5 | include "frc971/math/matrix.fbs"; |
James Kuszmaul | 2549e75 | 2024-01-20 17:42:51 -0800 | [diff] [blame] | 6 | include "frc971/control_loops/drivetrain/drivetrain_config.fbs"; |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 7 | |
| 8 | namespace y2024; |
| 9 | |
Jim Ostrowski | cb8b408 | 2024-01-21 02:23:46 -0800 | [diff] [blame] | 10 | table CameraConfiguration { |
| 11 | calibration:frc971.vision.calibration.CameraCalibration (id: 0); |
| 12 | } |
| 13 | |
Maxwell Henderson | 93f37f2 | 2024-01-19 17:08:23 -0800 | [diff] [blame] | 14 | table ShotParams { |
| 15 | shot_velocity: double (id: 0); |
Maxwell Henderson | ed97029 | 2024-02-02 20:08:08 -0800 | [diff] [blame] | 16 | |
| 17 | // Angle of the altitude |
| 18 | shot_altitude_angle: double (id: 1); |
| 19 | |
| 20 | // Angle of the catapult |
| 21 | shot_catapult_angle: double (id: 2); |
| 22 | |
| 23 | // Speed over ground to use for shooting on the fly |
| 24 | shot_speed_over_ground: double (id: 3); |
Maxwell Henderson | 93f37f2 | 2024-01-19 17:08:23 -0800 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | table InterpolationTablePoint { |
| 28 | distance_from_goal: double (id: 0); |
| 29 | shot_params: ShotParams (id: 1); |
| 30 | } |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 31 | |
Niko Sohmers | b21dbdc | 2024-01-20 20:06:59 -0800 | [diff] [blame] | 32 | // Amount of voltage to give to the intake rollers when: |
James Kuszmaul | 2549e75 | 2024-01-20 17:42:51 -0800 | [diff] [blame] | 33 | // spitting, which represents voltage when IntakeRollerGoal is SPITTING |
Niko Sohmers | b21dbdc | 2024-01-20 20:06:59 -0800 | [diff] [blame] | 34 | // and intaking, which represents voltage when IntakeRollerGoal is INTAKING |
| 35 | table IntakeRollerVoltages { |
| 36 | spitting:double (id: 0); |
| 37 | intaking:double (id: 1); |
| 38 | } |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 39 | |
Niko Sohmers | b21dbdc | 2024-01-20 20:06:59 -0800 | [diff] [blame] | 40 | // Set points for the pivot in radians when: |
| 41 | // extended, which represents radians for when IntakePivotGoal is EXTENDED |
| 42 | // and retracted, which represents radians for when IntakePivotGoal is RETRACTED or NONE |
| 43 | table IntakePivotSetPoints { |
| 44 | extended:double (id: 0); |
| 45 | retracted:double (id: 1); |
| 46 | } |
| 47 | |
Filip Kujawa | 37aa0bc | 2024-01-31 20:59:49 -0800 | [diff] [blame] | 48 | // Set points for the climber in meters when: |
| 49 | // fully extended, which represents meters for when ClimberGoal is FULL_EXTEND |
| 50 | // partially extended, which represents meters for when ClimberGoal is HALF_EXTEND |
| 51 | // and retracted, which represents meters for when ClimberGoal is RETRACT |
| 52 | table ClimberSetPoints { |
| 53 | full_extend:double (id: 0); |
Maxwell Henderson | 7db2978 | 2024-02-24 20:10:26 -0800 | [diff] [blame] | 54 | stowed:double (id: 1); |
Filip Kujawa | 37aa0bc | 2024-01-31 20:59:49 -0800 | [diff] [blame] | 55 | retract:double (id: 2); |
| 56 | } |
| 57 | |
| 58 | table PotAndAbsEncoderConstants { |
| 59 | zeroing_constants:frc971.zeroing.PotAndAbsoluteEncoderZeroingConstants (id: 0); |
Niko Sohmers | b21dbdc | 2024-01-20 20:06:59 -0800 | [diff] [blame] | 60 | potentiometer_offset:double (id: 1); |
| 61 | } |
| 62 | |
Niko Sohmers | 1259b2a | 2024-01-29 18:00:37 -0800 | [diff] [blame] | 63 | // Stores current limits for motors |
| 64 | table CurrentLimits { |
| 65 | intake_pivot_supply_current_limit:double (id: 0); |
| 66 | intake_pivot_stator_current_limit:double (id: 1); |
| 67 | intake_roller_supply_current_limit:double (id: 2); |
| 68 | intake_roller_stator_current_limit:double (id: 3); |
Niko Sohmers | ed7ffc4 | 2024-02-03 16:05:19 -0800 | [diff] [blame] | 69 | transfer_roller_supply_current_limit:double (id: 4); |
| 70 | transfer_roller_stator_current_limit:double (id: 5); |
Maxwell Henderson | fb3bfea | 2024-02-03 19:24:46 -0800 | [diff] [blame] | 71 | drivetrain_supply_current_limit:double (id: 6); |
| 72 | drivetrain_stator_current_limit:double (id: 7); |
Filip Kujawa | 749f244 | 2024-02-04 01:12:35 -0800 | [diff] [blame] | 73 | climber_supply_current_limit:double (id: 8); |
| 74 | climber_stator_current_limit:double (id: 9); |
Filip Kujawa | d75252a | 2024-02-10 16:54:35 -0800 | [diff] [blame] | 75 | extend_supply_current_limit:double (id: 10); |
| 76 | extend_stator_current_limit:double (id: 11); |
| 77 | extend_roller_supply_current_limit:double (id: 12); |
| 78 | extend_roller_stator_current_limit:double (id: 13); |
Niko Sohmers | 27d92c6 | 2024-02-19 14:15:07 -0800 | [diff] [blame] | 79 | turret_supply_current_limit:double (id: 14); |
| 80 | turret_stator_current_limit:double (id: 15); |
| 81 | altitude_supply_current_limit:double (id: 16); |
| 82 | altitude_stator_current_limit:double (id: 17); |
Maxwell Henderson | 862fc2c | 2024-02-23 16:04:37 -0800 | [diff] [blame] | 83 | retention_roller_supply_current_limit:double (id: 18); |
| 84 | retention_roller_stator_current_limit:double (id: 19); |
Maxwell Henderson | d5bf47a | 2024-02-23 17:16:48 -0800 | [diff] [blame] | 85 | slower_retention_roller_stator_current_limit:double (id: 20); |
Maxwell Henderson | 6b1be31 | 2024-02-28 20:15:06 -0800 | [diff] [blame] | 86 | shooting_retention_roller_stator_current_limit:double (id: 23); |
Maxwell Henderson | 3d68e14 | 2024-02-25 09:58:11 -0800 | [diff] [blame] | 87 | catapult_supply_current_limit:double (id: 21); |
| 88 | catapult_stator_current_limit:double (id: 22); |
Niko Sohmers | 1259b2a | 2024-01-29 18:00:37 -0800 | [diff] [blame] | 89 | } |
| 90 | |
Nathan Leong | b7a81bf | 2024-02-03 16:04:17 -0800 | [diff] [blame] | 91 | table TransferRollerVoltages { |
James Kuszmaul | 6cae7d7 | 2024-03-01 21:29:56 -0800 | [diff] [blame] | 92 | // Voltage to apply while intaking the game piece. |
Nathan Leong | b7a81bf | 2024-02-03 16:04:17 -0800 | [diff] [blame] | 93 | transfer_in:double (id: 0); |
James Kuszmaul | 6cae7d7 | 2024-03-01 21:29:56 -0800 | [diff] [blame] | 94 | // Voltage to apply while spitting the game piece. |
Nathan Leong | b7a81bf | 2024-02-03 16:04:17 -0800 | [diff] [blame] | 95 | transfer_out:double (id: 1); |
James Kuszmaul | 6cae7d7 | 2024-03-01 21:29:56 -0800 | [diff] [blame] | 96 | // Voltage to apply while the extend is moving and dragging the |
| 97 | // game piece out of the rollers. |
| 98 | extend_moving:double (id: 2); |
Nathan Leong | b7a81bf | 2024-02-03 16:04:17 -0800 | [diff] [blame] | 99 | } |
| 100 | |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 101 | table ExtendRollerVoltages { |
| 102 | scoring:double (id: 0); |
| 103 | reversing:double (id: 1); |
| 104 | } |
| 105 | |
Austin Schuh | 3db875a | 2024-02-18 20:02:40 -0800 | [diff] [blame] | 106 | // Extend positions |
| 107 | table ExtendSetPoints { |
Filip Kujawa | 7a79960 | 2024-02-23 12:27:47 -0800 | [diff] [blame] | 108 | // The position which lets us score on the trap. |
| 109 | trap:double (id: 0); |
| 110 | // The position which lets us score on the amp. |
| 111 | amp:double (id: 1); |
| 112 | // The position which lets us transfer into the catapult. |
| 113 | catapult:double (id: 2); |
| 114 | // The position near 0 where we are ready to intake a note. |
| 115 | retracted:double (id: 3); |
Austin Schuh | 3db875a | 2024-02-18 20:02:40 -0800 | [diff] [blame] | 116 | } |
| 117 | |
James Kuszmaul | cafeb34 | 2024-03-15 22:00:18 -0700 | [diff] [blame] | 118 | enum AutonomousMode : ubyte { |
| 119 | NONE = 0, |
| 120 | // Simple test S-spline auto mode |
| 121 | SPLINE_AUTO = 1, |
| 122 | // Simple drive-and-shoot to pick up at most one game piece. |
| 123 | MOBILITY_AND_SHOOT = 2, |
| 124 | // Auto to pick up four game pieces. |
James Kuszmaul | 58f5143 | 2024-03-24 15:00:06 -0700 | [diff] [blame] | 125 | FIVE_PIECE = 3, |
Maxwell Henderson | a2dadd0 | 2024-03-24 13:57:09 -0700 | [diff] [blame] | 126 | // Auto which picks up two game pieces from the center |
| 127 | TWO_PIECE_STEAL = 4, |
James Kuszmaul | cafeb34 | 2024-03-15 22:00:18 -0700 | [diff] [blame] | 128 | } |
| 129 | |
Niko Sohmers | b21dbdc | 2024-01-20 20:06:59 -0800 | [diff] [blame] | 130 | table RobotConstants { |
Niko Sohmers | 74b0ad5 | 2024-02-03 18:00:31 -0800 | [diff] [blame] | 131 | intake_constants:frc971.zeroing.AbsoluteEncoderZeroingConstants (id: 0); |
Niko Sohmers | 4d93d4c | 2024-03-24 14:48:26 -0700 | [diff] [blame] | 132 | // Deprecated since climber no longer has an encoder |
| 133 | climber_constants:PotAndAbsEncoderConstants (id: 1, deprecated); |
| 134 | climber_potentiometer_offset:double (id: 8); |
Niko Sohmers | 3bfe3d6 | 2024-02-18 16:09:49 -0800 | [diff] [blame] | 135 | catapult_constants:PotAndAbsEncoderConstants (id: 2); |
| 136 | altitude_constants:PotAndAbsEncoderConstants (id: 3); |
| 137 | turret_constants:PotAndAbsEncoderConstants (id: 4); |
Austin Schuh | 3db875a | 2024-02-18 20:02:40 -0800 | [diff] [blame] | 138 | extend_constants:PotAndAbsEncoderConstants (id: 5); |
Niko Sohmers | 58461f5 | 2024-03-20 20:12:10 -0700 | [diff] [blame] | 139 | disable_extend:bool (id: 6); |
| 140 | disable_climber:bool (id: 7); |
Niko Sohmers | b21dbdc | 2024-01-20 20:06:59 -0800 | [diff] [blame] | 141 | } |
| 142 | |
Filip Kujawa | 45d72cd | 2024-02-24 18:29:15 -0800 | [diff] [blame] | 143 | table ShooterSetPoint { |
| 144 | turret_position: double (id: 0); |
| 145 | altitude_position: double (id: 1); |
| 146 | shot_velocity:double (id: 2); |
| 147 | } |
| 148 | |
Niko Sohmers | c4d2c50 | 2024-02-19 19:35:35 -0800 | [diff] [blame] | 149 | table Pose { |
| 150 | // Pos is a 3x1 matrix which contains the (x, y, z) component of the Pose. |
| 151 | pos: frc971.fbs.Matrix (id: 0); |
| 152 | theta: double (id: 1); |
| 153 | } |
| 154 | |
| 155 | table ShooterTargets { |
| 156 | // The Pose of the red and blue alliance speakers we are aiming at. |
| 157 | red_alliance: Pose (id: 0); |
| 158 | blue_alliance: Pose (id: 1); |
| 159 | } |
| 160 | |
| 161 | table RetentionRollerVoltages { |
| 162 | retaining:double (id: 0); |
| 163 | spitting:double (id: 1); |
| 164 | } |
| 165 | |
James Kuszmaul | cafeb34 | 2024-03-15 22:00:18 -0700 | [diff] [blame] | 166 | // Set of april tag targets, by april tag ID, to ignore when on a |
| 167 | // given alliance. |
| 168 | table IgnoreTargets { |
| 169 | red:[uint64] (id: 0); |
| 170 | blue:[uint64] (id: 1); |
| 171 | } |
| 172 | |
Niko Sohmers | b21dbdc | 2024-01-20 20:06:59 -0800 | [diff] [blame] | 173 | // Common table for constants unrelated to the robot |
| 174 | table Common { |
| 175 | target_map:frc971.vision.TargetMap (id: 0); |
| 176 | shooter_interpolation_table: [InterpolationTablePoint] (id: 1); |
Filip Kujawa | 1286c01 | 2024-03-31 22:53:27 -0700 | [diff] [blame] | 177 | shooter_shuttle_interpolation_table: [InterpolationTablePoint] (id: 30); |
Niko Sohmers | b21dbdc | 2024-01-20 20:06:59 -0800 | [diff] [blame] | 178 | intake_roller_voltages:IntakeRollerVoltages (id : 2); |
| 179 | intake_pivot_set_points:IntakePivotSetPoints (id: 3); |
| 180 | intake_pivot:frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemCommonParams (id: 4); |
James Kuszmaul | 2549e75 | 2024-01-20 17:42:51 -0800 | [diff] [blame] | 181 | drivetrain:frc971.control_loops.drivetrain.fbs.DrivetrainConfig (id: 5); |
Niko Sohmers | 1259b2a | 2024-01-29 18:00:37 -0800 | [diff] [blame] | 182 | current_limits:CurrentLimits (id: 6); |
Nathan Leong | b7a81bf | 2024-02-03 16:04:17 -0800 | [diff] [blame] | 183 | transfer_roller_voltages:TransferRollerVoltages (id: 7); |
Niko Sohmers | 4d93d4c | 2024-03-24 14:48:26 -0700 | [diff] [blame] | 184 | climber:frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemCommonParams (id: 8, deprecated); |
| 185 | climber_set_points:ClimberSetPoints (id: 9, deprecated); |
Maxwell Henderson | ed97029 | 2024-02-02 20:08:08 -0800 | [diff] [blame] | 186 | turret_loading_position: double (id: 10); |
| 187 | catapult_return_position: double (id: 11); |
Niko Sohmers | 3bfe3d6 | 2024-02-18 16:09:49 -0800 | [diff] [blame] | 188 | catapult:frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemCommonParams (id: 12); |
| 189 | altitude:frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemCommonParams (id: 13); |
| 190 | turret:frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemCommonParams (id: 14); |
Austin Schuh | 3db875a | 2024-02-18 20:02:40 -0800 | [diff] [blame] | 191 | extend:frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemCommonParams (id: 15); |
Filip Kujawa | 45d72cd | 2024-02-24 18:29:15 -0800 | [diff] [blame] | 192 | extend_roller_voltages:ExtendRollerVoltages (id: 16); |
| 193 | shooter_targets:ShooterTargets (id: 17); |
Filip Kujawa | 1286c01 | 2024-03-31 22:53:27 -0700 | [diff] [blame] | 194 | shooter_shuttle_targets:ShooterTargets (id: 29); |
Filip Kujawa | 45d72cd | 2024-02-24 18:29:15 -0800 | [diff] [blame] | 195 | altitude_loading_position: double (id: 18); |
| 196 | retention_roller_voltages:RetentionRollerVoltages (id: 19); |
| 197 | min_altitude_shooting_angle: double (id: 20); |
Maxwell Henderson | 3d68e14 | 2024-02-25 09:58:11 -0800 | [diff] [blame] | 198 | max_altitude_shooting_angle: double (id: 25); |
Filip Kujawa | 45d72cd | 2024-02-24 18:29:15 -0800 | [diff] [blame] | 199 | shooter_speaker_set_point: ShooterSetPoint (id: 21); |
| 200 | shooter_podium_set_point: ShooterSetPoint (id: 22); |
James Kuszmaul | cafeb34 | 2024-03-15 22:00:18 -0700 | [diff] [blame] | 201 | extend_set_points:ExtendSetPoints (id: 23); |
Filip Kujawa | 7a79960 | 2024-02-23 12:27:47 -0800 | [diff] [blame] | 202 | // The position to move the turret to when avoiding collision |
| 203 | // with the extend when the extend is moving to amp/trap position. |
Filip Kujawa | 45d72cd | 2024-02-24 18:29:15 -0800 | [diff] [blame] | 204 | turret_avoid_extend_collision_position: double (id: 24); |
Niko Sohmers | 6adb5b9 | 2024-03-16 17:47:54 -0700 | [diff] [blame] | 205 | altitude_avoid_extend_collision_position: double (id: 28); |
James Kuszmaul | cafeb34 | 2024-03-15 22:00:18 -0700 | [diff] [blame] | 206 | autonomous_mode:AutonomousMode (id: 26); |
| 207 | ignore_targets:IgnoreTargets (id: 27); |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 208 | } |
| 209 | |
| 210 | table Constants { |
Niko Sohmers | c4d2c50 | 2024-02-19 19:35:35 -0800 | [diff] [blame] | 211 | cameras:[CameraConfiguration] (id: 0); |
| 212 | robot:RobotConstants (id: 1); |
| 213 | common:Common (id: 2); |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 214 | } |
| 215 | |
James Kuszmaul | 2549e75 | 2024-01-20 17:42:51 -0800 | [diff] [blame] | 216 | root_type Constants; |