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