Austin Schuh | 00be3a8 | 2017-02-05 19:01:40 -0800 | [diff] [blame] | 1 | package frc971.control_loops; |
| 2 | |
| 3 | import "frc971/control_loops/control_loops.q"; |
| 4 | |
| 5 | struct ProfiledJointStatus { |
Adam Snaider | 79900c2 | 2017-02-08 20:23:15 -0800 | [diff] [blame] | 6 | // Is the subsystem zeroed? |
Austin Schuh | 00be3a8 | 2017-02-05 19:01:40 -0800 | [diff] [blame] | 7 | bool zeroed; |
| 8 | |
| 9 | // The state of the subsystem, if applicable. -1 otherwise. |
| 10 | int32_t state; |
| 11 | |
| 12 | // If true, we have aborted. |
| 13 | bool estopped; |
| 14 | |
| 15 | // Position of the joint. |
| 16 | float position; |
| 17 | // Velocity of the joint in units/second. |
| 18 | float velocity; |
| 19 | // Profiled goal position of the joint. |
| 20 | float goal_position; |
| 21 | // Profiled goal velocity of the joint in units/second. |
| 22 | float goal_velocity; |
| 23 | // Unprofiled goal position from absoulte zero of the joint. |
| 24 | float unprofiled_goal_position; |
| 25 | // Unprofiled goal velocity of the joint in units/second. |
| 26 | float unprofiled_goal_velocity; |
| 27 | |
| 28 | // The estimated voltage error. |
| 29 | float voltage_error; |
| 30 | |
| 31 | // The calculated velocity with delta x/delta t |
| 32 | float calculated_velocity; |
| 33 | |
| 34 | // Components of the control loop output |
| 35 | float position_power; |
| 36 | float velocity_power; |
| 37 | float feedforwards_power; |
| 38 | |
| 39 | // State of the estimator. |
| 40 | .frc971.EstimatorState estimator_state; |
| 41 | }; |
Adam Snaider | 79900c2 | 2017-02-08 20:23:15 -0800 | [diff] [blame] | 42 | |
Lee Mracek | 0348557 | 2019-01-04 02:27:26 -0800 | [diff] [blame] | 43 | struct HallProfiledJointStatus { |
| 44 | // Is the subsystem zeroed? |
| 45 | bool zeroed; |
| 46 | |
| 47 | // The state of the subsystem, if applicable. -1 otherwise. |
| 48 | int32_t state; |
| 49 | |
| 50 | // If true, we have aborted. |
| 51 | bool estopped; |
| 52 | |
| 53 | // Position of the joint. |
| 54 | float position; |
| 55 | // Velocity of the joint in units/second. |
| 56 | float velocity; |
| 57 | // Profiled goal position of the joint. |
| 58 | float goal_position; |
| 59 | // Profiled goal velocity of the joint in units/second. |
| 60 | float goal_velocity; |
| 61 | // Unprofiled goal position from absoulte zero of the joint. |
| 62 | float unprofiled_goal_position; |
| 63 | // Unprofiled goal velocity of the joint in units/second. |
| 64 | float unprofiled_goal_velocity; |
| 65 | |
| 66 | // The estimated voltage error. |
| 67 | float voltage_error; |
| 68 | |
| 69 | // The calculated velocity with delta x/delta t |
| 70 | float calculated_velocity; |
| 71 | |
| 72 | // Components of the control loop output |
| 73 | float position_power; |
| 74 | float velocity_power; |
| 75 | float feedforwards_power; |
| 76 | |
| 77 | // State of the estimator. |
| 78 | .frc971.HallEffectAndPositionEstimatorState estimator_state; |
| 79 | }; |
| 80 | |
Tyler Chatow | 9867cd7 | 2019-02-09 21:46:01 -0800 | [diff] [blame] | 81 | struct PotAndAbsoluteEncoderProfiledJointStatus { |
Adam Snaider | 79900c2 | 2017-02-08 20:23:15 -0800 | [diff] [blame] | 82 | // Is the subsystem zeroed? |
| 83 | bool zeroed; |
| 84 | |
| 85 | // The state of the subsystem, if applicable. -1 otherwise. |
| 86 | int32_t state; |
| 87 | |
| 88 | // If true, we have aborted. |
| 89 | bool estopped; |
| 90 | |
| 91 | // Position of the joint. |
| 92 | float position; |
| 93 | // Velocity of the joint in units/second. |
| 94 | float velocity; |
| 95 | // Profiled goal position of the joint. |
| 96 | float goal_position; |
| 97 | // Profiled goal velocity of the joint in units/second. |
| 98 | float goal_velocity; |
| 99 | // Unprofiled goal position from absoulte zero of the joint. |
| 100 | float unprofiled_goal_position; |
| 101 | // Unprofiled goal velocity of the joint in units/second. |
| 102 | float unprofiled_goal_velocity; |
| 103 | |
| 104 | // The estimated voltage error. |
| 105 | float voltage_error; |
| 106 | |
| 107 | // The calculated velocity with delta x/delta t |
| 108 | float calculated_velocity; |
| 109 | |
| 110 | // Components of the control loop output |
| 111 | float position_power; |
| 112 | float velocity_power; |
| 113 | float feedforwards_power; |
| 114 | |
| 115 | // State of the estimator. |
Austin Schuh | 72db9a1 | 2019-01-21 18:02:51 -0800 | [diff] [blame] | 116 | .frc971.PotAndAbsoluteEncoderEstimatorState estimator_state; |
Adam Snaider | 79900c2 | 2017-02-08 20:23:15 -0800 | [diff] [blame] | 117 | }; |
Austin Schuh | 6a90cd9 | 2017-02-19 20:55:33 -0800 | [diff] [blame] | 118 | |
| 119 | struct IndexProfiledJointStatus { |
| 120 | // Is the subsystem zeroed? |
| 121 | bool zeroed; |
| 122 | |
| 123 | // The state of the subsystem, if applicable. -1 otherwise. |
| 124 | int32_t state; |
| 125 | |
| 126 | // If true, we have aborted. |
| 127 | bool estopped; |
| 128 | |
| 129 | // Position of the joint. |
| 130 | float position; |
| 131 | // Velocity of the joint in units/second. |
| 132 | float velocity; |
| 133 | // Profiled goal position of the joint. |
| 134 | float goal_position; |
| 135 | // Profiled goal velocity of the joint in units/second. |
| 136 | float goal_velocity; |
| 137 | // Unprofiled goal position from absoulte zero of the joint. |
| 138 | float unprofiled_goal_position; |
| 139 | // Unprofiled goal velocity of the joint in units/second. |
| 140 | float unprofiled_goal_velocity; |
| 141 | |
| 142 | // The estimated voltage error. |
| 143 | float voltage_error; |
| 144 | |
| 145 | // The calculated velocity with delta x/delta t |
| 146 | float calculated_velocity; |
| 147 | |
| 148 | // Components of the control loop output |
| 149 | float position_power; |
| 150 | float velocity_power; |
| 151 | float feedforwards_power; |
| 152 | |
| 153 | // State of the estimator. |
| 154 | .frc971.IndexEstimatorState estimator_state; |
| 155 | }; |
Tyler Chatow | 1258156 | 2019-01-26 20:42:42 -0800 | [diff] [blame] | 156 | |
Tyler Chatow | c591c4c | 2019-02-09 21:37:14 -0800 | [diff] [blame] | 157 | struct AbsoluteEncoderProfiledJointStatus { |
| 158 | // Is the subsystem zeroed? |
| 159 | bool zeroed; |
| 160 | |
| 161 | // The state of the subsystem, if applicable. -1 otherwise. |
| 162 | int32_t state; |
| 163 | |
| 164 | // If true, we have aborted. |
| 165 | bool estopped; |
| 166 | |
| 167 | // Position of the joint. |
| 168 | float position; |
| 169 | // Velocity of the joint in units/second. |
| 170 | float velocity; |
| 171 | // Profiled goal position of the joint. |
| 172 | float goal_position; |
| 173 | // Profiled goal velocity of the joint in units/second. |
| 174 | float goal_velocity; |
| 175 | // Unprofiled goal position from absoulte zero of the joint. |
| 176 | float unprofiled_goal_position; |
| 177 | // Unprofiled goal velocity of the joint in units/second. |
| 178 | float unprofiled_goal_velocity; |
| 179 | |
| 180 | // The estimated voltage error. |
| 181 | float voltage_error; |
| 182 | |
| 183 | // The calculated velocity with delta x/delta t |
| 184 | float calculated_velocity; |
| 185 | |
| 186 | // Components of the control loop output |
| 187 | float position_power; |
| 188 | float velocity_power; |
| 189 | float feedforwards_power; |
| 190 | |
| 191 | // State of the estimator. |
| 192 | .frc971.AbsoluteEncoderEstimatorState estimator_state; |
| 193 | }; |
| 194 | |
Tyler Chatow | 1258156 | 2019-01-26 20:42:42 -0800 | [diff] [blame] | 195 | struct StaticZeroingSingleDOFProfiledSubsystemGoal { |
| 196 | double unsafe_goal; |
| 197 | .frc971.ProfileParameters profile_params; |
Austin Schuh | 9fe68f7 | 2019-08-10 19:32:03 -0700 | [diff] [blame^] | 198 | }; |