Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 1 | include "frc971/control_loops/control_loops.fbs"; |
| 2 | include "frc971/control_loops/profiled_subsystem.fbs"; |
| 3 | |
| 4 | namespace y2017.control_loops.superstructure; |
| 5 | |
| 6 | table IndexerStatus { |
| 7 | // The current average velocity in radians/second. Positive is moving balls up |
| 8 | // towards the shooter. This is the angular velocity of the inner piece. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 9 | avg_angular_velocity:double (id: 0); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 10 | |
| 11 | // The current instantaneous filtered velocity in radians/second. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 12 | angular_velocity:double (id: 1); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 13 | |
| 14 | // True if the indexer is ready. It is better to compare the velocities |
| 15 | // directly so there isn't confusion on if the goal is up to date. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 16 | ready:bool (id: 2); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 17 | |
| 18 | // True if the indexer is stuck. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 19 | stuck:bool (id: 3); |
| 20 | stuck_voltage:float (id: 4); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 21 | |
| 22 | // The state of the indexer state machine. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 23 | state:int32 (id: 5); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 24 | |
| 25 | // The estimated voltage error from the kalman filter in volts. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 26 | voltage_error:double (id: 6); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 27 | // The estimated voltage error from the stuck indexer kalman filter. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 28 | stuck_voltage_error:double (id: 7); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 29 | |
| 30 | // The current velocity measured as delta x / delta t in radians/sec. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 31 | instantaneous_velocity:double (id: 8); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 32 | |
| 33 | // The error between our measurement and expected measurement in radians. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 34 | position_error:double (id: 9); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | table ShooterStatus { |
| 38 | // The current average velocity in radians/second. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 39 | avg_angular_velocity:double (id: 0); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 40 | |
| 41 | // The current instantaneous filtered velocity in radians/second. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 42 | angular_velocity:double (id: 1); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 43 | |
| 44 | // True if the shooter is ready. It is better to compare the velocities |
| 45 | // directly so there isn't confusion on if the goal is up to date. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 46 | ready:bool (id: 2); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 47 | |
| 48 | // The estimated voltage error from the kalman filter in volts. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 49 | voltage_error:double (id: 3); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 50 | |
| 51 | // The current velocity measured as delta x / delta t in radians/sec. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 52 | instantaneous_velocity:double (id: 4); |
| 53 | filtered_velocity:double (id: 5); |
| 54 | fixed_instantaneous_velocity:double (id: 6); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 55 | |
| 56 | // The error between our measurement and expected measurement in radians. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 57 | position_error:double (id: 7); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 58 | } |
| 59 | |
| 60 | table ColumnEstimatorState { |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 61 | error:bool (id: 0); |
| 62 | zeroed:bool (id: 1); |
| 63 | indexer:frc971.HallEffectAndPositionEstimatorState (id: 2); |
| 64 | turret:frc971.HallEffectAndPositionEstimatorState (id: 3); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 65 | } |
| 66 | |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 67 | table TurretProfiledSubsystemStatus { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 68 | // Is the subsystem zeroed? |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 69 | zeroed:bool (id: 0); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 70 | |
| 71 | // The state of the subsystem, if applicable. -1 otherwise. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 72 | state:int (id: 1); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 73 | |
| 74 | // If true, we have aborted. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 75 | estopped:bool (id: 2); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 76 | |
| 77 | // Position of the joint. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 78 | position:float (id: 3); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 79 | // Velocity of the joint in units/second. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 80 | velocity:float (id: 4); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 81 | // Profiled goal position of the joint. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 82 | goal_position:float (id: 5); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 83 | // Profiled goal velocity of the joint in units/second. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 84 | goal_velocity:float (id: 6); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 85 | // Unprofiled goal position from absoulte zero of the joint. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 86 | unprofiled_goal_position:float (id: 7); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 87 | // Unprofiled goal velocity of the joint in units/second. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 88 | unprofiled_goal_velocity:float (id: 8); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 89 | |
| 90 | // The estimated voltage error. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 91 | voltage_error:float (id: 9); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 92 | |
| 93 | // The calculated velocity with delta x/delta t |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 94 | calculated_velocity:float (id: 10); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 95 | |
| 96 | // Components of the control loop output |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 97 | position_power:float (id: 11); |
| 98 | velocity_power:float (id: 12); |
| 99 | feedforwards_power:float (id: 13); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 100 | |
| 101 | // State of the estimator. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 102 | estimator_state:ColumnEstimatorState (id: 14); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 103 | |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 104 | raw_vision_angle:double (id: 15); |
| 105 | vision_angle:double (id: 16); |
| 106 | vision_tracking:bool (id: 17); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 107 | |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 108 | turret_encoder_angle:double (id: 18); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | table Status { |
| 112 | // Are all the subsystems zeroed? |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 113 | zeroed:bool (id: 0); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 114 | |
| 115 | // If true, we have aborted. This is the or of all subsystem estops. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 116 | estopped:bool (id: 1); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 117 | |
| 118 | // Each subsystems status. |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 119 | intake:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 2); |
| 120 | hood:frc971.control_loops.IndexProfiledJointStatus (id: 3); |
| 121 | shooter:ShooterStatus (id: 4); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 122 | |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 123 | turret:TurretProfiledSubsystemStatus (id: 5); |
| 124 | indexer:IndexerStatus (id: 6); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 125 | |
Austin Schuh | d7851b0 | 2020-11-14 13:46:27 -0800 | [diff] [blame] | 126 | vision_distance:float (id: 7); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 127 | } |
| 128 | |
| 129 | root_type Status; |