blob: 860854bf5d86ecaa16ba566d49039fc21e50d980 [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
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.
11 HallEffectStruct front;
12 // The hall effect sensor in the middle to use for real calibration.
13 HallEffectStruct calibration;
14 // The hall effect at the back limit.
15 HallEffectStruct back;
16
17 // The encoder value at the last posedge of any of the claw hall effect
18 // sensors (front, calibration, or back).
19 double posedge_value;
20 // The encoder value at the last negedge of any of the claw hall effect
21 // sensors (front, calibration, or back).
22 double negedge_value;
23};
24
25// All angles here are 0 vertical, positive "up" (aka backwards).
26queue_group ClawGroup {
27 implements aos.control_loops.ControlLoop;
28
29 message Goal {
30 // The angle of the bottom claw.
31 double bottom_angle;
32 // How much higher the top claw is.
33 double separation_angle;
34 // top claw intake roller
35 double intake;
36 // bottom claw tusk centering
37 double centering;
38 };
39
40 message Position {
41 // All the top claw information.
42 HalfClawPosition top;
43 // All the bottom claw information.
44 HalfClawPosition bottom;
45 };
46
47 message Output {
48 double intake_voltage;
49 double top_claw_voltage;
50 double bottom_claw_voltage;
51 double tusk_voltage;
52 };
53
54 message Status {
55 // True if zeroed enough for the current period (autonomous or teleop).
56 bool zeroed;
57 // True if zeroed as much as we will force during autonomous.
58 bool zeroed_for_auto;
59 // True if zeroed and within tolerance for separation and bottom angle.
60 bool done;
61 // True if zeroed and within tolerance for separation and bottom angle.
62 // seperation allowance much wider as a ball may be included
63 bool done_with_ball;
64 // Dump the values of the state matrix.
65 double bottom;
66 double bottom_velocity;
67 double separation;
68 double separation_velocity;
69 };
70
71 queue Goal goal;
72 queue Position position;
73 queue Output output;
74 queue Status status;
75};
76
77queue_group ClawGroup claw_queue_group;
78
79struct ClawPositionToLog {
80 double top;
81 double bottom;
82};