Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 1 | include "frc971/control_loops/control_loops.fbs"; |
| 2 | include "frc971/control_loops/profiled_subsystem.fbs"; |
| 3 | |
| 4 | namespace y2020.control_loops.superstructure; |
| 5 | |
milind-u | 0beb7dc | 2021-10-16 19:31:33 -0700 | [diff] [blame] | 6 | enum Subsystem:byte { |
| 7 | FINISHER, |
| 8 | ACCELERATOR, |
| 9 | TURRET |
| 10 | } |
| 11 | |
Sabina Davis | edf8947 | 2020-02-17 15:27:37 -0800 | [diff] [blame] | 12 | table FlywheelControllerStatus { |
Tyler Chatow | cf41366 | 2020-02-09 14:36:36 -0800 | [diff] [blame] | 13 | // The current average velocity in radians/second over the last kHistoryLength |
| 14 | // in shooter.h |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 15 | avg_angular_velocity:double (id: 0); |
Tyler Chatow | cf41366 | 2020-02-09 14:36:36 -0800 | [diff] [blame] | 16 | |
| 17 | // The current instantaneous filtered velocity in radians/second. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 18 | angular_velocity:double (id: 1); |
Tyler Chatow | cf41366 | 2020-02-09 14:36:36 -0800 | [diff] [blame] | 19 | |
| 20 | // The target speed selected by the lookup table or from manual override |
| 21 | // Can be compared to velocity to determine if ready. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 22 | angular_velocity_goal:double (id: 2); |
Austin Schuh | 43b9ae9 | 2020-02-29 23:08:38 -0800 | [diff] [blame] | 23 | |
| 24 | // Voltage error. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 25 | voltage_error:double (id: 3); |
Austin Schuh | 8047677 | 2021-03-06 20:17:36 -0800 | [diff] [blame] | 26 | |
| 27 | // The commanded battery current. |
| 28 | commanded_current:double (id: 4); |
| 29 | |
| 30 | // The angular velocity of the flywheel computed using delta x / delta t |
| 31 | dt_angular_velocity:double (id: 5); |
Tyler Chatow | cf41366 | 2020-02-09 14:36:36 -0800 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | table ShooterStatus { |
| 35 | // The final wheel shooting the ball |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 36 | finisher:FlywheelControllerStatus (id: 0); |
Tyler Chatow | cf41366 | 2020-02-09 14:36:36 -0800 | [diff] [blame] | 37 | |
Sabina Davis | edf8947 | 2020-02-17 15:27:37 -0800 | [diff] [blame] | 38 | // The subsystem to accelerate the ball before the finisher |
Austin Schuh | 9dcd520 | 2020-02-20 20:06:04 -0800 | [diff] [blame] | 39 | // Velocity is the fastest (top) wheel |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 40 | accelerator_left:FlywheelControllerStatus (id: 1); |
| 41 | accelerator_right:FlywheelControllerStatus (id: 2); |
Austin Schuh | 5c40ea4 | 2021-09-26 13:28:03 -0700 | [diff] [blame] | 42 | |
| 43 | // If the shooter is ready, this is true. Note: don't use this for status |
| 44 | // checking, only for plotting. Changes in goal take time to impact this. |
| 45 | ready:bool (id: 3); |
milind-u | 7baf734 | 2021-08-25 18:31:26 -0700 | [diff] [blame] | 46 | |
| 47 | // The total number of balls we have shot |
| 48 | balls_shot:int (id: 4); |
Tyler Chatow | cf41366 | 2020-02-09 14:36:36 -0800 | [diff] [blame] | 49 | } |
| 50 | |
James Kuszmaul | b1b2d8e | 2020-02-21 21:11:46 -0800 | [diff] [blame] | 51 | table AimerStatus { |
| 52 | // The current goal angle for the turret auto-tracking, in radians. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 53 | turret_position:double (id: 0); |
James Kuszmaul | b1b2d8e | 2020-02-21 21:11:46 -0800 | [diff] [blame] | 54 | // The current goal velocity for the turret, in radians / sec. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 55 | turret_velocity:double (id: 1); |
James Kuszmaul | a53c3ac | 2020-02-22 19:36:01 -0800 | [diff] [blame] | 56 | // Whether we are currently aiming for the inner port. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 57 | aiming_for_inner_port:bool (id: 2); |
James Kuszmaul | 519585d | 2020-03-08 22:32:48 -0700 | [diff] [blame] | 58 | // The current distance to the target, in meters. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 59 | target_distance:double (id: 3); |
James Kuszmaul | 519585d | 2020-03-08 22:32:48 -0700 | [diff] [blame] | 60 | // The current "shot distance." When shooting on the fly, this may be |
| 61 | // different from the static distance to the target. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 62 | shot_distance:double (id: 4); |
James Kuszmaul | 88c5cef | 2021-10-23 13:17:36 -0700 | [diff] [blame^] | 63 | // Amount the shot is off from being dead-straight relative to the inner port. |
| 64 | inner_port_angle:double (id: 5); |
James Kuszmaul | b1b2d8e | 2020-02-21 21:11:46 -0800 | [diff] [blame] | 65 | } |
| 66 | |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 67 | table Status { |
| 68 | // All subsystems know their location. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 69 | zeroed:bool (id: 0); |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 70 | |
Sabina Davis | 5187f86 | 2020-02-09 13:16:51 -0800 | [diff] [blame] | 71 | // If true, we have aborted. This is if one or all subsystem estops. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 72 | estopped:bool (id: 1); |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 73 | |
Austin Schuh | 9dcd520 | 2020-02-20 20:06:04 -0800 | [diff] [blame] | 74 | // Subsystem status. |
Ravago Jones | 937587c | 2020-12-26 17:21:09 -0800 | [diff] [blame] | 75 | hood:frc971.control_loops.AbsoluteAndAbsoluteEncoderProfiledJointStatus (id: 2); |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 76 | intake:frc971.control_loops.AbsoluteEncoderProfiledJointStatus (id: 3); |
| 77 | turret:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 4); |
Tyler Chatow | cf41366 | 2020-02-09 14:36:36 -0800 | [diff] [blame] | 78 | |
| 79 | // Shooter subsystem status. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 80 | shooter:ShooterStatus (id: 5); |
Sabina Davis | 5187f86 | 2020-02-09 13:16:51 -0800 | [diff] [blame] | 81 | |
| 82 | // Status of the control_panel |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 83 | control_panel:frc971.control_loops.RelativeEncoderProfiledJointStatus (id: 6); |
James Kuszmaul | b1b2d8e | 2020-02-21 21:11:46 -0800 | [diff] [blame] | 84 | |
| 85 | // Status of the vision auto-tracking. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 86 | aimer:AimerStatus (id: 7); |
milind-u | 0beb7dc | 2021-10-16 19:31:33 -0700 | [diff] [blame] | 87 | |
| 88 | // Vector of the subsystems that are not at goal and are preventing shooting. |
| 89 | subsystems_not_ready:[Subsystem] (id: 8); |
Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -0800 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | root_type Status; |