Brian Silverman | 17f503e | 2015-08-02 18:17:18 -0700 | [diff] [blame] | 1 | package frc971.control_loops; |
| 2 | |
| 3 | import "aos/common/controls/control_loops.q"; |
| 4 | import "frc971/control_loops/control_loops.q"; |
| 5 | |
| 6 | struct HalfClawPosition { |
| 7 | // The current position of this half of the claw. |
| 8 | double position; |
| 9 | |
| 10 | // The hall effect sensor at the front limit. |
| 11 | HallEffectStruct front; |
| 12 | // The hall effect sensor in the middle to use for real calibration. |
| 13 | HallEffectStruct calibration; |
| 14 | // The hall effect at the back limit. |
| 15 | HallEffectStruct back; |
Brian Silverman | 17f503e | 2015-08-02 18:17:18 -0700 | [diff] [blame] | 16 | }; |
| 17 | |
| 18 | // All angles here are 0 vertical, positive "up" (aka backwards). |
| 19 | queue_group ClawGroup { |
| 20 | implements aos.control_loops.ControlLoop; |
| 21 | |
| 22 | message Goal { |
| 23 | // The angle of the bottom claw. |
| 24 | double bottom_angle; |
| 25 | // How much higher the top claw is. |
| 26 | double separation_angle; |
| 27 | // top claw intake roller |
| 28 | double intake; |
| 29 | // bottom claw tusk centering |
| 30 | double centering; |
| 31 | }; |
| 32 | |
| 33 | message Position { |
| 34 | // All the top claw information. |
| 35 | HalfClawPosition top; |
| 36 | // All the bottom claw information. |
| 37 | HalfClawPosition bottom; |
| 38 | }; |
| 39 | |
| 40 | message Output { |
| 41 | double intake_voltage; |
| 42 | double top_claw_voltage; |
| 43 | double bottom_claw_voltage; |
| 44 | double tusk_voltage; |
| 45 | }; |
| 46 | |
| 47 | message Status { |
| 48 | // True if zeroed enough for the current period (autonomous or teleop). |
| 49 | bool zeroed; |
| 50 | // True if zeroed as much as we will force during autonomous. |
| 51 | bool zeroed_for_auto; |
| 52 | // True if zeroed and within tolerance for separation and bottom angle. |
| 53 | bool done; |
| 54 | // True if zeroed and within tolerance for separation and bottom angle. |
| 55 | // seperation allowance much wider as a ball may be included |
| 56 | bool done_with_ball; |
| 57 | // Dump the values of the state matrix. |
| 58 | double bottom; |
| 59 | double bottom_velocity; |
| 60 | double separation; |
| 61 | double separation_velocity; |
| 62 | }; |
| 63 | |
| 64 | queue Goal goal; |
| 65 | queue Position position; |
| 66 | queue Output output; |
| 67 | queue Status status; |
| 68 | }; |
| 69 | |
| 70 | queue_group ClawGroup claw_queue_group; |
| 71 | |
| 72 | struct ClawPositionToLog { |
| 73 | double top; |
| 74 | double bottom; |
| 75 | }; |