blob: e1d444d3468ec7a64ce9dc1116253479e13b3b99 [file] [log] [blame]
Austin Schuh88af0852016-12-04 20:31:32 -08001package y2015.control_loops;
Daniel Petti663fef02015-01-22 21:43:00 -08002
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.
Brian Silvermanbb799712015-03-29 16:14:01 -040017 float angular_velocity;
Austin Schuhbd5308a2015-02-28 21:48:44 -080018 // Maximum profile velocity, or 0 for the default.
Brian Silvermanbb799712015-03-29 16:14:01 -040019 float max_velocity;
Austin Schuhbd5308a2015-02-28 21:48:44 -080020 // Maximum profile acceleration, or 0 for the default.
Brian Silvermanbb799712015-03-29 16:14:01 -040021 float max_acceleration;
Daniel Petti663fef02015-01-22 21:43:00 -080022 // Voltage of intake rollers. Positive means sucking in, negative means
23 // spitting out.
24 double intake;
25
Brian Silverman0a7f6062015-01-24 17:41:33 -050026 // true to signal the rollers to close.
27 bool rollers_closed;
Daniel Petti663fef02015-01-22 21:43:00 -080028 };
29
30 message Position {
Austin Schuh88af0852016-12-04 20:31:32 -080031 .frc971.PotAndIndexPosition joint;
Daniel Petti663fef02015-01-22 21:43:00 -080032 };
33
34 message Output {
35 // Voltage for intake motors. Positive is sucking in, negative is spitting
36 // out.
37 double intake_voltage;
Brian Silverman0a7f6062015-01-24 17:41:33 -050038 // Voltage for claw motor.
39 double voltage;
40
41 // true to signal the rollers to close.
42 bool rollers_closed;
Daniel Petti663fef02015-01-22 21:43:00 -080043 };
44
45 message Status {
46 // Is claw zeroed?
47 bool zeroed;
Daniel Petti9cf68c82015-02-14 14:57:17 -080048 // Did the claw estop?
49 bool estopped;
50 // The internal state of the claw state machine.
51 uint32_t state;
Austin Schuh88af0852016-12-04 20:31:32 -080052 .frc971.EstimatorState zeroing_state;
Brian Silverman0a7f6062015-01-24 17:41:33 -050053
Austin Schuhbd5308a2015-02-28 21:48:44 -080054 // Estimated angle of wrist joint.
Ben Fredrickson6b5ba792015-01-25 17:14:40 -080055 double angle;
Austin Schuhbd5308a2015-02-28 21:48:44 -080056 // Estimated angular velocity of wrist.
Brian Silvermanbb799712015-03-29 16:14:01 -040057 float angular_velocity;
Austin Schuhbd5308a2015-02-28 21:48:44 -080058
Austin Schuhc3b48df2015-02-22 21:31:37 -080059 // Goal angle of wrist joint.
60 double goal_angle;
Brian Silvermanbb799712015-03-29 16:14:01 -040061 float goal_velocity;
Ben Fredrickson6b5ba792015-01-25 17:14:40 -080062 // Voltage of intake rollers. Positive means sucking in, negative means
63 // spitting out.
64 double intake;
65
Brian Silverman0a7f6062015-01-24 17:41:33 -050066 // True iff there has been enough time since we actuated the rollers outward
67 // that they should be there.
68 bool rollers_open;
69 // True iff there has been enough time since we actuated the rollers closed
70 // that they should be there.
Daniel Petti9cf68c82015-02-14 14:57:17 -080071 bool rollers_closed;
Daniel Petti663fef02015-01-22 21:43:00 -080072 };
73
74 queue Goal goal;
75 queue Position position;
76 queue Output output;
77 queue Status status;
78};
79
Ben Fredrickson6b5ba792015-01-25 17:14:40 -080080queue_group ClawQueue claw_queue;
81