Daniel Petti | 663fef0 | 2015-01-22 21:43:00 -0800 | [diff] [blame] | 1 | package frc971.control_loops; |
| 2 | |
| 3 | import "aos/common/controls/control_loops.q"; |
Brian Silverman | 0a7f606 | 2015-01-24 17:41:33 -0500 | [diff] [blame^] | 4 | import "frc971/control_loops/control_loops.q"; |
Daniel Petti | 663fef0 | 2015-01-22 21:43:00 -0800 | [diff] [blame] | 5 | |
| 6 | queue_group Claw { |
| 7 | implements aos.control_loops.ControlLoop; |
| 8 | |
Brian Silverman | 0a7f606 | 2015-01-24 17:41:33 -0500 | [diff] [blame^] | 9 | // All angles are in radians with 0 sticking straight out the front. Rotating |
| 10 | // up and into the robot is positive. Positive output voltage moves in the |
| 11 | // direction of positive encoder values. |
Daniel Petti | 663fef0 | 2015-01-22 21:43:00 -0800 | [diff] [blame] | 12 | |
| 13 | message Goal { |
Brian Silverman | 0a7f606 | 2015-01-24 17:41:33 -0500 | [diff] [blame^] | 14 | // Angle of wrist joint. |
Daniel Petti | 663fef0 | 2015-01-22 21:43:00 -0800 | [diff] [blame] | 15 | double angle; |
| 16 | // Voltage of intake rollers. Positive means sucking in, negative means |
| 17 | // spitting out. |
| 18 | double intake; |
| 19 | |
Brian Silverman | 0a7f606 | 2015-01-24 17:41:33 -0500 | [diff] [blame^] | 20 | // true to signal the rollers to close. |
| 21 | bool rollers_closed; |
Daniel Petti | 663fef0 | 2015-01-22 21:43:00 -0800 | [diff] [blame] | 22 | }; |
| 23 | |
| 24 | message Position { |
Brian Silverman | 0a7f606 | 2015-01-24 17:41:33 -0500 | [diff] [blame^] | 25 | PotAndIndexPair joint; |
Daniel Petti | 663fef0 | 2015-01-22 21:43:00 -0800 | [diff] [blame] | 26 | }; |
| 27 | |
| 28 | message Output { |
| 29 | // Voltage for intake motors. Positive is sucking in, negative is spitting |
| 30 | // out. |
| 31 | double intake_voltage; |
Brian Silverman | 0a7f606 | 2015-01-24 17:41:33 -0500 | [diff] [blame^] | 32 | // Voltage for claw motor. |
| 33 | double voltage; |
| 34 | |
| 35 | // true to signal the rollers to close. |
| 36 | bool rollers_closed; |
Daniel Petti | 663fef0 | 2015-01-22 21:43:00 -0800 | [diff] [blame] | 37 | }; |
| 38 | |
| 39 | message Status { |
| 40 | // Is claw zeroed? |
| 41 | bool zeroed; |
| 42 | // Has claw zeroed and reached goal? |
| 43 | bool done; |
Brian Silverman | 0a7f606 | 2015-01-24 17:41:33 -0500 | [diff] [blame^] | 44 | |
| 45 | // True iff there has been enough time since we actuated the rollers outward |
| 46 | // that they should be there. |
| 47 | bool rollers_open; |
| 48 | // True iff there has been enough time since we actuated the rollers closed |
| 49 | // that they should be there. |
| 50 | bool rollers_close; |
Daniel Petti | 663fef0 | 2015-01-22 21:43:00 -0800 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | queue Goal goal; |
| 54 | queue Position position; |
| 55 | queue Output output; |
| 56 | queue Status status; |
| 57 | }; |
| 58 | |
| 59 | queue_group Claw claw; |