Austin Schuh | 09c2b0b | 2016-02-13 15:53:16 -0800 | [diff] [blame] | 1 | package y2016.control_loops.shooter; |
Comran Morshed | 2a97bc8 | 2016-01-16 17:27:01 +0000 | [diff] [blame] | 2 | |
| 3 | import "aos/common/controls/control_loops.q"; |
| 4 | import "frc971/control_loops/control_loops.q"; |
| 5 | |
Austin Schuh | 09c2b0b | 2016-02-13 15:53:16 -0800 | [diff] [blame] | 6 | struct ShooterSideStatus { |
| 7 | // True if the shooter side is up to speed and stable. |
| 8 | bool ready; |
| 9 | // The current average velocity in radians/second. |
| 10 | double avg_angular_velocity; |
| 11 | // The current instantaneous filtered velocity in radians/second. |
| 12 | double angular_velocity; |
| 13 | }; |
| 14 | |
Comran Morshed | 2a97bc8 | 2016-01-16 17:27:01 +0000 | [diff] [blame] | 15 | queue_group ShooterQueue { |
| 16 | implements aos.control_loops.ControlLoop; |
| 17 | |
Austin Schuh | 09c2b0b | 2016-02-13 15:53:16 -0800 | [diff] [blame] | 18 | // All angles are in radians, and angular velocities are in radians/second. |
| 19 | // For all angular velocities, positive is shooting the ball out of the robot. |
Comran Morshed | 2a97bc8 | 2016-01-16 17:27:01 +0000 | [diff] [blame] | 20 | |
Comran Morshed | cde5032 | 2016-01-18 15:10:36 +0000 | [diff] [blame] | 21 | message Goal { |
Austin Schuh | 09c2b0b | 2016-02-13 15:53:16 -0800 | [diff] [blame] | 22 | // Angular velocity goals in radians/second. |
| 23 | double angular_velocity; |
Comran Morshed | b79c424 | 2016-02-06 18:27:26 +0000 | [diff] [blame^] | 24 | |
| 25 | bool clamp_open; // True to release our clamp on the ball. |
| 26 | bool push_to_shooter; // True to push the ball into the shooter. |
Comran Morshed | 2a97bc8 | 2016-01-16 17:27:01 +0000 | [diff] [blame] | 27 | }; |
| 28 | |
| 29 | message Position { |
Austin Schuh | 09c2b0b | 2016-02-13 15:53:16 -0800 | [diff] [blame] | 30 | // Wheel angle in radians/second. |
Comran Morshed | cde5032 | 2016-01-18 15:10:36 +0000 | [diff] [blame] | 31 | double theta_left; |
| 32 | double theta_right; |
| 33 | }; |
| 34 | |
| 35 | message Status { |
Austin Schuh | 09c2b0b | 2016-02-13 15:53:16 -0800 | [diff] [blame] | 36 | // Left side status. |
| 37 | ShooterSideStatus left; |
| 38 | // Right side status. |
| 39 | ShooterSideStatus right; |
Comran Morshed | cde5032 | 2016-01-18 15:10:36 +0000 | [diff] [blame] | 40 | |
Austin Schuh | 09c2b0b | 2016-02-13 15:53:16 -0800 | [diff] [blame] | 41 | // True if the shooter is ready. It is better to compare the velocities |
| 42 | // directly so there isn't confusion on if the goal is up to date. |
| 43 | bool ready; |
Comran Morshed | cde5032 | 2016-01-18 15:10:36 +0000 | [diff] [blame] | 44 | }; |
| 45 | |
| 46 | message Output { |
Austin Schuh | 09c2b0b | 2016-02-13 15:53:16 -0800 | [diff] [blame] | 47 | // Voltage in volts of the left and right shooter motors. |
Comran Morshed | cde5032 | 2016-01-18 15:10:36 +0000 | [diff] [blame] | 48 | double voltage_left; |
| 49 | double voltage_right; |
Comran Morshed | b79c424 | 2016-02-06 18:27:26 +0000 | [diff] [blame^] | 50 | |
| 51 | // See comments on the identical fields in Goal for details. |
| 52 | bool clamp_open; |
| 53 | bool push_to_shooter; |
Comran Morshed | 2a97bc8 | 2016-01-16 17:27:01 +0000 | [diff] [blame] | 54 | }; |
| 55 | |
| 56 | queue Goal goal; |
| 57 | queue Position position; |
Comran Morshed | cde5032 | 2016-01-18 15:10:36 +0000 | [diff] [blame] | 58 | queue Output output; |
Comran Morshed | 2a97bc8 | 2016-01-16 17:27:01 +0000 | [diff] [blame] | 59 | queue Status status; |
| 60 | }; |
| 61 | |
| 62 | queue_group ShooterQueue shooter_queue; |