Diana Vandenberg | 69899ed | 2017-01-28 16:57:54 -0800 | [diff] [blame] | 1 | package y2017.control_loops; |
| 2 | |
| 3 | import "aos/common/controls/control_loops.q"; |
| 4 | import "frc971/control_loops/control_loops.q"; |
| 5 | |
| 6 | struct JointState { |
| 7 | // Distance of the joint, in m, from absolute zero. |
| 8 | float distance; |
| 9 | // Linear velocity of the joint in meters/second. |
| 10 | float linear_velocity; |
| 11 | // Profiled goal distance of the joint in meters. |
| 12 | float goal_distance; |
| 13 | // Profiled goal linear velocity of the joint in meters/second. |
| 14 | float goal_linear_velocity; |
| 15 | // Unprofiled goal distance from absoulte zero of the joint in meters. |
| 16 | float unprofiled_goal_distance; |
| 17 | // Unprofiled goal linear velocity of the joint in meters/second. |
| 18 | float unprofiled_goal_linear_velocity; |
| 19 | |
| 20 | // The estimated voltage error. |
| 21 | float voltage_error; |
| 22 | |
| 23 | // The calculated velocity with delta x/delta t |
| 24 | float calculated_velocity; |
| 25 | |
| 26 | // Components of the control loop output |
| 27 | float position_power; |
| 28 | float velocity_power; |
| 29 | float feedforwards_power; |
| 30 | |
| 31 | // State of the estimator. |
| 32 | .frc971.EstimatorState estimator_state; |
| 33 | }; |
| 34 | |
| 35 | queue_group IntakeQueue { |
| 36 | implements aos.control_loops.ControlLoop; |
| 37 | |
| 38 | message Goal { |
| 39 | // Zero on the intake is when the intake is retracted inside the robot, |
| 40 | // unable to intake. Positive is out. |
| 41 | |
| 42 | // Goal distance of the intake. |
| 43 | double distance_intake; |
| 44 | |
| 45 | // Caps on velocity/acceleration for profiling. 0 for the default. |
| 46 | .frc971.ProfileParameters profile_params_intake; |
| 47 | |
| 48 | // Voltage to send to the rollers. Positive is sucking in. |
| 49 | float voltage_rollers; |
| 50 | }; |
| 51 | |
| 52 | message Status { |
| 53 | // Is the intake zeroed? |
| 54 | bool zeroed; |
| 55 | |
| 56 | // If true, we have aborted. |
| 57 | bool estopped; |
| 58 | |
| 59 | // Estimate angles and angular velocities. |
| 60 | JointState intake; |
| 61 | }; |
| 62 | |
| 63 | message Position { |
| 64 | // Position of the intake, zero when the intake is in, positive when it is |
| 65 | // out. |
| 66 | .frc971.PotAndAbsolutePosition intake; |
| 67 | }; |
| 68 | |
| 69 | message Output { |
| 70 | float voltage_intake; |
| 71 | |
| 72 | float voltage_rollers; |
| 73 | }; |
| 74 | |
| 75 | queue Goal goal; |
| 76 | queue Position position; |
| 77 | queue Output output; |
| 78 | queue Status status; |
| 79 | }; |
| 80 | |
| 81 | queue_group IntakeQueue intake_queue; |