blob: e0b4531e508b08cd87a51577bf7f2908ba199ae8 [file] [log] [blame]
Austin Schuh09c2b0b2016-02-13 15:53:16 -08001package y2016.control_loops.shooter;
Comran Morshed2a97bc82016-01-16 17:27:01 +00002
3import "aos/common/controls/control_loops.q";
4import "frc971/control_loops/control_loops.q";
5
Austin Schuh09c2b0b2016-02-13 15:53:16 -08006struct 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 Morshed2a97bc82016-01-16 17:27:01 +000015queue_group ShooterQueue {
16 implements aos.control_loops.ControlLoop;
17
Austin Schuh09c2b0b2016-02-13 15:53:16 -080018 // 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 Morshed2a97bc82016-01-16 17:27:01 +000020
Comran Morshedcde50322016-01-18 15:10:36 +000021 message Goal {
Austin Schuh09c2b0b2016-02-13 15:53:16 -080022 // Angular velocity goals in radians/second.
23 double angular_velocity;
Comran Morshedb79c4242016-02-06 18:27:26 +000024
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 Morshed2a97bc82016-01-16 17:27:01 +000027 };
28
29 message Position {
Austin Schuh09c2b0b2016-02-13 15:53:16 -080030 // Wheel angle in radians/second.
Comran Morshedcde50322016-01-18 15:10:36 +000031 double theta_left;
32 double theta_right;
33 };
34
35 message Status {
Austin Schuh09c2b0b2016-02-13 15:53:16 -080036 // Left side status.
37 ShooterSideStatus left;
38 // Right side status.
39 ShooterSideStatus right;
Comran Morshedcde50322016-01-18 15:10:36 +000040
Austin Schuh09c2b0b2016-02-13 15:53:16 -080041 // 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 Morshedcde50322016-01-18 15:10:36 +000044 };
45
46 message Output {
Austin Schuh09c2b0b2016-02-13 15:53:16 -080047 // Voltage in volts of the left and right shooter motors.
Comran Morshedcde50322016-01-18 15:10:36 +000048 double voltage_left;
49 double voltage_right;
Comran Morshedb79c4242016-02-06 18:27:26 +000050
51 // See comments on the identical fields in Goal for details.
52 bool clamp_open;
53 bool push_to_shooter;
Comran Morshed2a97bc82016-01-16 17:27:01 +000054 };
55
56 queue Goal goal;
57 queue Position position;
Comran Morshedcde50322016-01-18 15:10:36 +000058 queue Output output;
Comran Morshed2a97bc82016-01-16 17:27:01 +000059 queue Status status;
60};
61
62queue_group ShooterQueue shooter_queue;