blob: 1afdd8563d46ea5747e4c61f80d2a57bd7274a8c [file] [log] [blame]
Brian Silvermanb601d892015-12-20 18:24:38 -05001package y2014.control_loops;
Brian Silverman17f503e2015-08-02 18:17:18 -07002
3import "aos/common/controls/control_loops.q";
4import "frc971/control_loops/control_loops.q";
5
6struct HalfClawPosition {
7 // The current position of this half of the claw.
8 double position;
9
10 // The hall effect sensor at the front limit.
Brian Silvermanb601d892015-12-20 18:24:38 -050011 .frc971.HallEffectStruct front;
Brian Silverman17f503e2015-08-02 18:17:18 -070012 // The hall effect sensor in the middle to use for real calibration.
Brian Silvermanb601d892015-12-20 18:24:38 -050013 .frc971.HallEffectStruct calibration;
Brian Silverman17f503e2015-08-02 18:17:18 -070014 // The hall effect at the back limit.
Brian Silvermanb601d892015-12-20 18:24:38 -050015 .frc971.HallEffectStruct back;
Brian Silverman17f503e2015-08-02 18:17:18 -070016};
17
18// All angles here are 0 vertical, positive "up" (aka backwards).
Brian Silvermanbe5ded62015-05-14 00:23:49 -040019queue_group ClawQueue {
Brian Silverman17f503e2015-08-02 18:17:18 -070020 implements aos.control_loops.ControlLoop;
21
22 message Goal {
23 // The angle of the bottom claw.
24 double bottom_angle;
25 // How much higher the top claw is.
26 double separation_angle;
27 // top claw intake roller
28 double intake;
29 // bottom claw tusk centering
30 double centering;
31 };
32
33 message Position {
34 // All the top claw information.
35 HalfClawPosition top;
36 // All the bottom claw information.
37 HalfClawPosition bottom;
38 };
39
40 message Output {
41 double intake_voltage;
42 double top_claw_voltage;
43 double bottom_claw_voltage;
44 double tusk_voltage;
45 };
46
47 message Status {
48 // True if zeroed enough for the current period (autonomous or teleop).
49 bool zeroed;
50 // True if zeroed as much as we will force during autonomous.
51 bool zeroed_for_auto;
52 // True if zeroed and within tolerance for separation and bottom angle.
53 bool done;
54 // True if zeroed and within tolerance for separation and bottom angle.
55 // seperation allowance much wider as a ball may be included
56 bool done_with_ball;
57 // Dump the values of the state matrix.
58 double bottom;
59 double bottom_velocity;
60 double separation;
61 double separation_velocity;
62 };
63
64 queue Goal goal;
65 queue Position position;
66 queue Output output;
67 queue Status status;
68};
69
Brian Silvermanbe5ded62015-05-14 00:23:49 -040070queue_group ClawQueue claw_queue;
Brian Silverman17f503e2015-08-02 18:17:18 -070071
72struct ClawPositionToLog {
73 double top;
74 double bottom;
75};