blob: 00149a80eb89561d3dc1026364ff810905b2591b [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.
Austin Schuh7eecd7c2016-02-28 21:59:05 -080026 // True to push the ball into the shooter.
27 // If we are in the act of shooting with a goal velocity != 0, wait until it
28 // is up to speed, push the ball into the shooter, and then wait until it
29 // spins up and down before letting the piston be released.
30 bool push_to_shooter;
Comran Morshed2a97bc82016-01-16 17:27:01 +000031 };
32
33 message Position {
Austin Schuh09c2b0b2016-02-13 15:53:16 -080034 // Wheel angle in radians/second.
Comran Morshedcde50322016-01-18 15:10:36 +000035 double theta_left;
36 double theta_right;
37 };
38
39 message Status {
Austin Schuh09c2b0b2016-02-13 15:53:16 -080040 // Left side status.
41 ShooterSideStatus left;
42 // Right side status.
43 ShooterSideStatus right;
Comran Morshedcde50322016-01-18 15:10:36 +000044
Austin Schuh09c2b0b2016-02-13 15:53:16 -080045 // True if the shooter is ready. It is better to compare the velocities
46 // directly so there isn't confusion on if the goal is up to date.
47 bool ready;
Comran Morshedcde50322016-01-18 15:10:36 +000048 };
49
50 message Output {
Austin Schuh09c2b0b2016-02-13 15:53:16 -080051 // Voltage in volts of the left and right shooter motors.
Comran Morshedcde50322016-01-18 15:10:36 +000052 double voltage_left;
53 double voltage_right;
Comran Morshedb79c4242016-02-06 18:27:26 +000054
55 // See comments on the identical fields in Goal for details.
56 bool clamp_open;
57 bool push_to_shooter;
Austin Schuhe0729a62016-03-12 21:54:17 -080058
59 // If true, the lights are on.
60 bool lights_on;
Comran Morshed2a97bc82016-01-16 17:27:01 +000061 };
62
63 queue Goal goal;
64 queue Position position;
Comran Morshedcde50322016-01-18 15:10:36 +000065 queue Output output;
Comran Morshed2a97bc82016-01-16 17:27:01 +000066 queue Status status;
67};
68
69queue_group ShooterQueue shooter_queue;