blob: 00c38c416b46ca0d6e6ce49e04666e440a5fd61b [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;
Brian Silverman0a7f6062015-01-24 17:41:33 -050048
Ben Fredrickson6b5ba792015-01-25 17:14:40 -080049 // Angle of wrist joint.
50 double angle;
51 // Voltage of intake rollers. Positive means sucking in, negative means
52 // spitting out.
53 double intake;
54
Brian Silverman0a7f6062015-01-24 17:41:33 -050055 // True iff there has been enough time since we actuated the rollers outward
56 // that they should be there.
57 bool rollers_open;
58 // True iff there has been enough time since we actuated the rollers closed
59 // that they should be there.
Daniel Petti9cf68c82015-02-14 14:57:17 -080060 bool rollers_closed;
Daniel Petti663fef02015-01-22 21:43:00 -080061 };
62
63 queue Goal goal;
64 queue Position position;
65 queue Output output;
66 queue Status status;
67};
68
Ben Fredrickson6b5ba792015-01-25 17:14:40 -080069queue_group ClawQueue claw_queue;
70