Brian Silverman | b601d89 | 2015-12-20 18:24:38 -0500 | [diff] [blame] | 1 | package y2014.control_loops; |
Brian Silverman | 17f503e | 2015-08-02 18:17:18 -0700 | [diff] [blame] | 2 | |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 3 | import "aos/controls/control_loops.q"; |
Brian Silverman | 17f503e | 2015-08-02 18:17:18 -0700 | [diff] [blame] | 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. |
Brian Silverman | b601d89 | 2015-12-20 18:24:38 -0500 | [diff] [blame] | 11 | .frc971.HallEffectStruct front; |
Brian Silverman | 17f503e | 2015-08-02 18:17:18 -0700 | [diff] [blame] | 12 | // The hall effect sensor in the middle to use for real calibration. |
Brian Silverman | b601d89 | 2015-12-20 18:24:38 -0500 | [diff] [blame] | 13 | .frc971.HallEffectStruct calibration; |
Brian Silverman | 17f503e | 2015-08-02 18:17:18 -0700 | [diff] [blame] | 14 | // The hall effect at the back limit. |
Brian Silverman | b601d89 | 2015-12-20 18:24:38 -0500 | [diff] [blame] | 15 | .frc971.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). |
Austin Schuh | b2461f4 | 2019-06-29 18:17:06 -0700 | [diff] [blame] | 19 | // Published on ".y2014.control_loops.claw_queue" |
Brian Silverman | be5ded6 | 2015-05-14 00:23:49 -0400 | [diff] [blame] | 20 | queue_group ClawQueue { |
Brian Silverman | 17f503e | 2015-08-02 18:17:18 -0700 | [diff] [blame] | 21 | implements aos.control_loops.ControlLoop; |
| 22 | |
| 23 | message Goal { |
| 24 | // The angle of the bottom claw. |
| 25 | double bottom_angle; |
| 26 | // How much higher the top claw is. |
| 27 | double separation_angle; |
| 28 | // top claw intake roller |
| 29 | double intake; |
| 30 | // bottom claw tusk centering |
| 31 | double centering; |
| 32 | }; |
| 33 | |
| 34 | message Position { |
| 35 | // All the top claw information. |
| 36 | HalfClawPosition top; |
| 37 | // All the bottom claw information. |
| 38 | HalfClawPosition bottom; |
| 39 | }; |
| 40 | |
| 41 | message Output { |
| 42 | double intake_voltage; |
| 43 | double top_claw_voltage; |
| 44 | double bottom_claw_voltage; |
| 45 | double tusk_voltage; |
| 46 | }; |
| 47 | |
| 48 | message Status { |
| 49 | // True if zeroed enough for the current period (autonomous or teleop). |
| 50 | bool zeroed; |
| 51 | // True if zeroed as much as we will force during autonomous. |
| 52 | bool zeroed_for_auto; |
| 53 | // True if zeroed and within tolerance for separation and bottom angle. |
| 54 | bool done; |
| 55 | // True if zeroed and within tolerance for separation and bottom angle. |
| 56 | // seperation allowance much wider as a ball may be included |
| 57 | bool done_with_ball; |
| 58 | // Dump the values of the state matrix. |
| 59 | double bottom; |
| 60 | double bottom_velocity; |
| 61 | double separation; |
| 62 | double separation_velocity; |
| 63 | }; |
| 64 | |
| 65 | queue Goal goal; |
| 66 | queue Position position; |
| 67 | queue Output output; |
| 68 | queue Status status; |
| 69 | }; |
| 70 | |
Brian Silverman | 17f503e | 2015-08-02 18:17:18 -0700 | [diff] [blame] | 71 | struct ClawPositionToLog { |
| 72 | double top; |
| 73 | double bottom; |
| 74 | }; |