blob: 010544177f122e7b30792242889394060046e264 [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;
52 // Voltage of intake rollers. Positive means sucking in, negative means
53 // spitting out.
54 double intake;
55
Brian Silverman0a7f6062015-01-24 17:41:33 -050056 // True iff there has been enough time since we actuated the rollers outward
57 // that they should be there.
58 bool rollers_open;
59 // True iff there has been enough time since we actuated the rollers closed
60 // that they should be there.
Daniel Petti9cf68c82015-02-14 14:57:17 -080061 bool rollers_closed;
Daniel Petti663fef02015-01-22 21:43:00 -080062 };
63
64 queue Goal goal;
65 queue Position position;
66 queue Output output;
67 queue Status status;
68};
69
Ben Fredrickson6b5ba792015-01-25 17:14:40 -080070queue_group ClawQueue claw_queue;
71