blob: c7ed97d89835c31557efafaef5666519142b2b9f [file] [log] [blame]
Brian Silvermanb601d892015-12-20 18:24:38 -05001package y2014.control_loops;
Brian Silverman17f503e2015-08-02 18:17:18 -07002
John Park33858a32018-09-28 23:05:48 -07003import "aos/controls/control_loops.q";
Brian Silverman17f503e2015-08-02 18:17:18 -07004import "frc971/control_loops/control_loops.q";
5
Austin Schuh493f7af2019-06-29 18:42:12 -07006// Published on ".y2014.control_loops.shooter_queue"
Brian Silvermanbe5ded62015-05-14 00:23:49 -04007queue_group ShooterQueue {
Brian Silverman17f503e2015-08-02 18:17:18 -07008 implements aos.control_loops.ControlLoop;
9
10 message Output {
11 double voltage;
12 // true: latch engaged, false: latch open
13 bool latch_piston;
14 // true: brake engaged false: brake released
15 bool brake_piston;
16 };
17 message Goal {
18 // Shot power in joules.
19 double shot_power;
20 // Shoots as soon as this is true.
21 bool shot_requested;
22 bool unload_requested;
23 bool load_requested;
24 };
25
26 // Back is when the springs are all the way stretched.
27 message Position {
28 // In meters, out is positive.
29 double position;
30
31 // If the latch piston is fired and this hall effect has been triggered, the
32 // plunger is all the way back and latched.
33 bool plunger;
34 // Gets triggered when the pusher is all the way back.
Brian Silvermanb601d892015-12-20 18:24:38 -050035 .frc971.PosedgeOnlyCountedHallEffectStruct pusher_distal;
Brian Silverman17f503e2015-08-02 18:17:18 -070036 // Triggers just before pusher_distal.
Brian Silvermanb601d892015-12-20 18:24:38 -050037 .frc971.PosedgeOnlyCountedHallEffectStruct pusher_proximal;
Brian Silverman17f503e2015-08-02 18:17:18 -070038 // Triggers when the latch engages.
39 bool latch;
40 };
41 message Status {
42 // Whether it's ready to shoot right now.
43 bool ready;
44 // Whether the plunger is in and out of the way of grabbing a ball.
45 // TODO(ben): Populate these!
46 bool cocked;
47 // How many times we've shot.
48 int32_t shots;
49 bool done;
50 // What we think the current position of the hard stop on the shooter is, in
51 // shot power (Joules).
52 double hard_stop_power;
Austin Schuhadf2cde2015-11-08 20:35:16 -080053
54 double absolute_position;
55 double absolute_velocity;
56 uint32_t state;
Brian Silverman17f503e2015-08-02 18:17:18 -070057 };
58
59 queue Goal goal;
60 queue Position position;
61 queue Output output;
62 queue Status status;
63};
64
Brian Silverman17f503e2015-08-02 18:17:18 -070065struct ShooterStateToLog {
66 double absolute_position;
67 double absolute_velocity;
68 uint32_t state;
69 bool latch_sensor;
70 bool proximal;
71 bool distal;
72 bool plunger;
73 bool brake;
74 bool latch_piston;
75};
76
77struct ShooterVoltageToLog {
78 double X_hat;
79 double applied;
80};
81
82struct ShooterMovingGoal {
83 double dx;
84};
85
86struct ShooterChangeCalibration {
87 double encoder;
88 double real_position;
89 double old_position;
90 double new_position;
91 double old_offset;
92 double new_offset;
93};
94
95struct ShooterStatusToLog {
96 double goal;
97 double position;
98};
99
100struct PowerAdjustment {
101 double requested_power;
102 double actual_power;
103};