Comran Morshed | 25f81a0 | 2016-01-23 13:40:10 +0000 | [diff] [blame] | 1 | package y2016.control_loops; |
| 2 | |
| 3 | import "aos/common/controls/control_loops.q"; |
| 4 | import "frc971/control_loops/control_loops.q"; |
| 5 | |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame^] | 6 | struct JointState { |
| 7 | // Angle of the joint in radians. |
| 8 | double angle; |
| 9 | // Angular velocity of the joint in radians/second. |
| 10 | float angular_velocity; |
| 11 | // Profiled goal angle of the joint in radians. |
| 12 | double goal_angle; |
| 13 | // Profiled goal angular velocity of the joint in radians/second. |
| 14 | double goal_angular_velocity; |
| 15 | |
| 16 | // State of the estimator. |
| 17 | .frc971.EstimatorState estimator_state; |
| 18 | }; |
| 19 | |
Comran Morshed | 25f81a0 | 2016-01-23 13:40:10 +0000 | [diff] [blame] | 20 | queue_group SuperstructureQueue { |
| 21 | implements aos.control_loops.ControlLoop; |
| 22 | |
| 23 | message Goal { |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame^] | 24 | // Zero on the intake is when the horizontal tube stock members are level |
| 25 | // with the ground. This will be essentially when we are in the intaking |
| 26 | // position. Positive is up. The angle is measured relative to the top |
| 27 | // of the robot frame. |
| 28 | // Zero on the shoulder is horizontal. Positive is up. The angle is |
| 29 | // measured relative to the top of the robot frame. |
| 30 | // Zero on the wrist is horizontal and landed in the bellypan. Positive is |
| 31 | // up. The angle is measured relative to the top of the robot frame. |
| 32 | |
| 33 | // Goal angles and angular velocities of the superstructure subsystems. |
| 34 | double angle_intake; |
| 35 | double angle_shoulder; |
| 36 | // In relation to the ground plane. |
| 37 | double angle_wrist; |
| 38 | |
| 39 | // Caps on velocity/acceleration for profiling. 0 for the default. |
| 40 | float max_angular_velocity_intake; |
| 41 | float max_angular_velocity_shoulder; |
| 42 | float max_angular_velocity_wrist; |
| 43 | |
| 44 | float max_angular_acceleration_intake; |
| 45 | float max_angular_acceleration_shoulder; |
| 46 | float max_angular_acceleration_wrist; |
Comran Morshed | 25f81a0 | 2016-01-23 13:40:10 +0000 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | message Status { |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame^] | 50 | // Are the superstructure subsystems zeroed? |
| 51 | bool zeroed; |
| 52 | |
| 53 | // If true, we have aborted. |
| 54 | bool estopped; |
| 55 | |
| 56 | // The internal state of the state machine. |
| 57 | int32_t state; |
| 58 | |
| 59 | |
| 60 | // Estimated angles and angular velocities of the superstructure subsystems. |
| 61 | JointState intake; |
| 62 | JointState shoulder; |
| 63 | JointState wrist; |
Comran Morshed | 25f81a0 | 2016-01-23 13:40:10 +0000 | [diff] [blame] | 64 | }; |
| 65 | |
| 66 | message Position { |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame^] | 67 | // Zero for the intake potentiometer value is horizontal, and positive is |
| 68 | // up. |
| 69 | // Zero for the shoulder potentiometer value is horizontal, and positive is |
| 70 | // up. |
| 71 | // Zero for the wrist potentiometer value is parallel to the arm and with |
| 72 | // the shooter wheels pointed towards the shoulder joint. This is measured |
| 73 | // relative to the arm, not the ground, not like the world we actually |
| 74 | // present to users. |
| 75 | .frc971.PotAndIndexPosition intake; |
| 76 | .frc971.PotAndIndexPosition shoulder; |
| 77 | .frc971.PotAndIndexPosition wrist; |
| 78 | }; |
| 79 | |
| 80 | message Output { |
| 81 | double voltage_intake; |
| 82 | double voltage_shoulder; |
| 83 | double voltage_wrist; |
Comran Morshed | 25f81a0 | 2016-01-23 13:40:10 +0000 | [diff] [blame] | 84 | }; |
| 85 | |
| 86 | queue Goal goal; |
| 87 | queue Position position; |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame^] | 88 | queue Output output; |
Comran Morshed | 25f81a0 | 2016-01-23 13:40:10 +0000 | [diff] [blame] | 89 | queue Status status; |
| 90 | }; |
| 91 | |
| 92 | queue_group SuperstructureQueue superstructure_queue; |