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 Fridge { |
| 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 | // NOTE: Elevator heights are defined as follows: The height of the elevator |
| 24 | // is the vertical distance (in meters) between the top of the frame |
| 25 | // (front and back), and the arm pivot axis. A constant specifies the minimum |
| 26 | // value for this distance. |
| 27 | |
| 28 | message Goal { |
| 29 | // Position of the arm in radians. |
| 30 | double angle; |
| 31 | // Height of the elevator in meters. |
| 32 | double height; |
| 33 | |
| 34 | // Should the grabbers be deployed? |
| 35 | bool grabbers_deployed; |
| 36 | }; |
| 37 | |
| 38 | message Position { |
| 39 | // Position of arm from encoder. |
| 40 | double arm_encoder_pos; |
| 41 | // Reading from arm potentiometer. |
| 42 | double arm_pot_pos; |
| 43 | // Position of arm encoder at last index pulse. |
| 44 | double arm_last_index; |
| 45 | // Reading from arm potentiometer at last index pulse. |
| 46 | double arm_last_index_pot; |
| 47 | // A count of how many index pulses we've seen on the arm encoder. |
| 48 | uint32_t arm_index_pulses; |
| 49 | |
| 50 | // Height of left side from encoder. |
| 51 | double left_encoder_pos; |
| 52 | // Reading from left side potentiometer. Directions work the same for this |
| 53 | // as for the encoder. |
| 54 | double left_pot_pos; |
| 55 | // Position of left encoder at last index pulse. |
| 56 | double left_last_index; |
| 57 | // Reading from left potentiometer at last index pulse. |
| 58 | double left_last_index_pot; |
| 59 | // A count of how many index pulses we've seen on the left encoder. |
| 60 | uint32_t left_index_pulses; |
| 61 | |
| 62 | // Height of right side from encoder. Directions are the same as |
| 63 | // for the left side. |
| 64 | double right_encoder_pos; |
| 65 | // Reading from right side potentiometer. Directions work the same for this |
| 66 | // as for the encoder. |
| 67 | double right_pot_pos; |
| 68 | // Position of right encoder at last index pulse. |
| 69 | double right_last_index; |
| 70 | // Reading from right potentiometer at last index pulse. |
| 71 | double right_last_index_pot; |
| 72 | // A count of how many index pulses we've seen on the right encoder. |
| 73 | uint32_t right_index_pulses; |
| 74 | |
| 75 | }; |
| 76 | |
| 77 | message Status { |
| 78 | // Are both the arm and elevator zeroed? |
| 79 | bool zeroed; |
| 80 | // Are we zeroed and have reached our goal position on both the arm and |
| 81 | // elevator? |
| 82 | bool done; |
| 83 | }; |
| 84 | |
| 85 | message Output { |
| 86 | // Voltage of arm motor. |
| 87 | double arm_voltage; |
| 88 | // Voltage of left elevator motor. |
| 89 | double left_voltage; |
| 90 | // Voltage of right elevator motor. |
| 91 | double right_voltage; |
| 92 | |
| 93 | // Are grabber pistons deployed? |
| 94 | bool grabbers_deployed; |
| 95 | }; |
| 96 | |
| 97 | queue Goal goal; |
| 98 | queue Position position; |
| 99 | queue Output output; |
| 100 | queue Status status; |
| 101 | }; |