blob: e05f7796ba5306c89d6ec6c3734cec885588be74 [file] [log] [blame]
Daniel Petti663fef02015-01-22 21:43:00 -08001package frc971.control_loops;
2
3import "aos/common/controls/control_loops.q";
Brian Silverman0a7f6062015-01-24 17:41:33 -05004import "frc971/control_loops/control_loops.q";
Daniel Petti663fef02015-01-22 21:43:00 -08005
Ben Fredrickson6b5ba792015-01-25 17:14:40 -08006queue_group ClawQueue {
Daniel Petti663fef02015-01-22 21:43:00 -08007 implements aos.control_loops.ControlLoop;
8
Brian Silverman0a7f6062015-01-24 17:41:33 -05009 // All angles are in radians with 0 sticking straight out the front. Rotating
10 // up and into the robot is positive. Positive output voltage moves in the
11 // direction of positive encoder values.
Daniel Petti663fef02015-01-22 21:43:00 -080012
13 message Goal {
Brian Silverman0a7f6062015-01-24 17:41:33 -050014 // Angle of wrist joint.
Daniel Petti663fef02015-01-22 21:43:00 -080015 double angle;
Daniel Petti9cf68c82015-02-14 14:57:17 -080016 // Angular velocity of wrist.
17 double angular_velocity;
Daniel Petti663fef02015-01-22 21:43:00 -080018 // Voltage of intake rollers. Positive means sucking in, negative means
19 // spitting out.
20 double intake;
21
Brian Silverman0a7f6062015-01-24 17:41:33 -050022 // true to signal the rollers to close.
23 bool rollers_closed;
Daniel Petti663fef02015-01-22 21:43:00 -080024 };
25
26 message Position {
Daniel Petti3d2a3132015-01-25 09:40:03 -080027 PotAndIndexPosition joint;
Daniel Petti663fef02015-01-22 21:43:00 -080028 };
29
30 message Output {
31 // Voltage for intake motors. Positive is sucking in, negative is spitting
32 // out.
33 double intake_voltage;
Brian Silverman0a7f6062015-01-24 17:41:33 -050034 // Voltage for claw motor.
35 double voltage;
36
37 // true to signal the rollers to close.
38 bool rollers_closed;
Daniel Petti663fef02015-01-22 21:43:00 -080039 };
40
41 message Status {
42 // Is claw zeroed?
43 bool zeroed;
Daniel Petti9cf68c82015-02-14 14:57:17 -080044 // Did the claw estop?
45 bool estopped;
46 // The internal state of the claw state machine.
47 uint32_t state;
Daniel Pettiab274232015-02-16 19:15:34 -080048 EstimatorState zeroing_state;
Brian Silverman0a7f6062015-01-24 17:41:33 -050049
Ben Fredrickson6b5ba792015-01-25 17:14:40 -080050 // Angle of wrist joint.
51 double angle;
Austin Schuhc3b48df2015-02-22 21:31:37 -080052 // Goal angle of wrist joint.
53 double goal_angle;
Ben Fredrickson6b5ba792015-01-25 17:14:40 -080054 // Voltage of intake rollers. Positive means sucking in, negative means
55 // spitting out.
56 double intake;
57
Brian Silverman0a7f6062015-01-24 17:41:33 -050058 // True iff there has been enough time since we actuated the rollers outward
59 // that they should be there.
60 bool rollers_open;
61 // True iff there has been enough time since we actuated the rollers closed
62 // that they should be there.
Daniel Petti9cf68c82015-02-14 14:57:17 -080063 bool rollers_closed;
Daniel Petti663fef02015-01-22 21:43:00 -080064 };
65
66 queue Goal goal;
67 queue Position position;
68 queue Output output;
69 queue Status status;
70};
71
Ben Fredrickson6b5ba792015-01-25 17:14:40 -080072queue_group ClawQueue claw_queue;
73