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"; |
| 4 | |
| 5 | queue_group Claw { |
| 6 | implements aos.control_loops.ControlLoop; |
| 7 | |
| 8 | // NOTE: Unless otherwise specified, assume that all angle measures are in |
| 9 | // radians. An angle of zero means that the appendage is sticking straight out |
| 10 | // horizontally, pointing towards the front of the robot. Rotating the appendage |
| 11 | // up and towards the back of the robot increases the angle, moving it down |
| 12 | // and towards the back decreases it. (Think unit circle.) This rule holds |
| 13 | // true for both angle goals and encoder positions. |
| 14 | // Also note that unless otherwise specified, potentiometer readings are |
| 15 | // from 0V to 5V. As with the encoders, moving up and towards the back |
| 16 | // of the robot increases this value, moving down and towards the back |
| 17 | // decreases it. |
| 18 | // For all output voltage parameters, assume that a positive voltage moves |
| 19 | // the appendage in a direction that increases the value of the encoder, and |
| 20 | // vice versa. (For an output voltage parameter for something without an |
| 21 | // encoder, directions will be individually specified.) |
| 22 | |
| 23 | message Goal { |
| 24 | // Angle of shoulder joint. |
| 25 | double angle; |
| 26 | // Voltage of intake rollers. Positive means sucking in, negative means |
| 27 | // spitting out. |
| 28 | double intake; |
| 29 | |
| 30 | // Should claw be in open or closed position? (true means open.) |
| 31 | bool open; |
| 32 | }; |
| 33 | |
| 34 | message Position { |
| 35 | // Position of shoulder joint from encoder. |
| 36 | double encoder_pos; |
| 37 | // Reading from potentiometer. |
| 38 | double pot_pos; |
| 39 | // Position of encoder at last index pulse. |
| 40 | double last_index; |
| 41 | // Reading from potentiometer at last index pulse. |
| 42 | double last_index_pot; |
| 43 | // A count of how many index pulses we've seen on the shoulder encoder. |
| 44 | uint32_t index_pulses; |
| 45 | }; |
| 46 | |
| 47 | message Output { |
| 48 | // Voltage for intake motors. Positive is sucking in, negative is spitting |
| 49 | // out. |
| 50 | double intake_voltage; |
| 51 | // Voltage for shoulder motors. |
| 52 | double shoulder_voltage; |
| 53 | // Claw in opened or closed position. (true means open.) |
| 54 | bool open; |
| 55 | }; |
| 56 | |
| 57 | message Status { |
| 58 | // Is claw zeroed? |
| 59 | bool zeroed; |
| 60 | // Has claw zeroed and reached goal? |
| 61 | bool done; |
| 62 | }; |
| 63 | |
| 64 | queue Goal goal; |
| 65 | queue Position position; |
| 66 | queue Output output; |
| 67 | queue Status status; |
| 68 | }; |
| 69 | |
| 70 | queue_group Claw claw; |