Austin Schuh | 88af085 | 2016-12-04 20:31:32 -0800 | [diff] [blame] | 1 | package y2015.control_loops; |
Daniel Petti | 663fef0 | 2015-01-22 21:43:00 -0800 | [diff] [blame] | 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 | |
Ben Fredrickson | 6b5ba79 | 2015-01-25 17:14:40 -0800 | [diff] [blame] | 6 | queue_group ClawQueue { |
Daniel Petti | 663fef0 | 2015-01-22 21:43:00 -0800 | [diff] [blame] | 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; |
Daniel Petti | 9cf68c8 | 2015-02-14 14:57:17 -0800 | [diff] [blame] | 16 | // Angular velocity of wrist. |
Brian Silverman | bb79971 | 2015-03-29 16:14:01 -0400 | [diff] [blame] | 17 | float angular_velocity; |
Austin Schuh | bd5308a | 2015-02-28 21:48:44 -0800 | [diff] [blame] | 18 | // Maximum profile velocity, or 0 for the default. |
Brian Silverman | bb79971 | 2015-03-29 16:14:01 -0400 | [diff] [blame] | 19 | float max_velocity; |
Austin Schuh | bd5308a | 2015-02-28 21:48:44 -0800 | [diff] [blame] | 20 | // Maximum profile acceleration, or 0 for the default. |
Brian Silverman | bb79971 | 2015-03-29 16:14:01 -0400 | [diff] [blame] | 21 | float max_acceleration; |
Daniel Petti | 663fef0 | 2015-01-22 21:43:00 -0800 | [diff] [blame] | 22 | // Voltage of intake rollers. Positive means sucking in, negative means |
| 23 | // spitting out. |
| 24 | double intake; |
| 25 | |
Brian Silverman | 0a7f606 | 2015-01-24 17:41:33 -0500 | [diff] [blame] | 26 | // true to signal the rollers to close. |
| 27 | bool rollers_closed; |
Daniel Petti | 663fef0 | 2015-01-22 21:43:00 -0800 | [diff] [blame] | 28 | }; |
| 29 | |
| 30 | message Position { |
Austin Schuh | 88af085 | 2016-12-04 20:31:32 -0800 | [diff] [blame] | 31 | .frc971.PotAndIndexPosition joint; |
Daniel Petti | 663fef0 | 2015-01-22 21:43:00 -0800 | [diff] [blame] | 32 | }; |
| 33 | |
| 34 | message Output { |
| 35 | // Voltage for intake motors. Positive is sucking in, negative is spitting |
| 36 | // out. |
| 37 | double intake_voltage; |
Brian Silverman | 0a7f606 | 2015-01-24 17:41:33 -0500 | [diff] [blame] | 38 | // Voltage for claw motor. |
| 39 | double voltage; |
| 40 | |
| 41 | // true to signal the rollers to close. |
| 42 | bool rollers_closed; |
Daniel Petti | 663fef0 | 2015-01-22 21:43:00 -0800 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | message Status { |
| 46 | // Is claw zeroed? |
| 47 | bool zeroed; |
Daniel Petti | 9cf68c8 | 2015-02-14 14:57:17 -0800 | [diff] [blame] | 48 | // Did the claw estop? |
| 49 | bool estopped; |
| 50 | // The internal state of the claw state machine. |
| 51 | uint32_t state; |
Austin Schuh | 88af085 | 2016-12-04 20:31:32 -0800 | [diff] [blame] | 52 | .frc971.EstimatorState zeroing_state; |
Brian Silverman | 0a7f606 | 2015-01-24 17:41:33 -0500 | [diff] [blame] | 53 | |
Austin Schuh | bd5308a | 2015-02-28 21:48:44 -0800 | [diff] [blame] | 54 | // Estimated angle of wrist joint. |
Ben Fredrickson | 6b5ba79 | 2015-01-25 17:14:40 -0800 | [diff] [blame] | 55 | double angle; |
Austin Schuh | bd5308a | 2015-02-28 21:48:44 -0800 | [diff] [blame] | 56 | // Estimated angular velocity of wrist. |
Brian Silverman | bb79971 | 2015-03-29 16:14:01 -0400 | [diff] [blame] | 57 | float angular_velocity; |
Austin Schuh | bd5308a | 2015-02-28 21:48:44 -0800 | [diff] [blame] | 58 | |
Austin Schuh | c3b48df | 2015-02-22 21:31:37 -0800 | [diff] [blame] | 59 | // Goal angle of wrist joint. |
| 60 | double goal_angle; |
Brian Silverman | bb79971 | 2015-03-29 16:14:01 -0400 | [diff] [blame] | 61 | float goal_velocity; |
Ben Fredrickson | 6b5ba79 | 2015-01-25 17:14:40 -0800 | [diff] [blame] | 62 | // Voltage of intake rollers. Positive means sucking in, negative means |
| 63 | // spitting out. |
| 64 | double intake; |
| 65 | |
Brian Silverman | 0a7f606 | 2015-01-24 17:41:33 -0500 | [diff] [blame] | 66 | // True iff there has been enough time since we actuated the rollers outward |
| 67 | // that they should be there. |
| 68 | bool rollers_open; |
| 69 | // True iff there has been enough time since we actuated the rollers closed |
| 70 | // that they should be there. |
Daniel Petti | 9cf68c8 | 2015-02-14 14:57:17 -0800 | [diff] [blame] | 71 | bool rollers_closed; |
Daniel Petti | 663fef0 | 2015-01-22 21:43:00 -0800 | [diff] [blame] | 72 | }; |
| 73 | |
| 74 | queue Goal goal; |
| 75 | queue Position position; |
| 76 | queue Output output; |
| 77 | queue Status status; |
| 78 | }; |
| 79 | |
Ben Fredrickson | 6b5ba79 | 2015-01-25 17:14:40 -0800 | [diff] [blame] | 80 | queue_group ClawQueue claw_queue; |
| 81 | |