blob: 1abd821b33a1d2acccca61cf2339cd807160b6a6 [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";
5
6// Represents states for all of the box-grabbing pistons.
7// true is grabbed and false is retracted for all of them.
8struct GrabberPistons {
9 bool top_front;
10 bool top_back;
11 bool bottom_front;
12 bool bottom_back;
13};
Daniel Petti663fef02015-01-22 21:43:00 -080014
15queue_group Fridge {
16 implements aos.control_loops.ControlLoop;
17
Brian Silverman0a7f6062015-01-24 17:41:33 -050018 // All angles are in radians with 0 sticking straight out horizontally over
19 // the intake (the front). Rotating up and into the robot (towards the back
20 // where boxes are placed) is positive. Positive output voltage moves all
21 // mechanisms in the direction with positive sensor values.
Daniel Petti663fef02015-01-22 21:43:00 -080022
Brian Silverman0a7f6062015-01-24 17:41:33 -050023 // Elevator heights are the vertical distance (in meters) from the top of the
24 // frame (at the front and back) to the axis of the bottom pivot of the arm.
Daniel Petti663fef02015-01-22 21:43:00 -080025
26 message Goal {
Brian Silverman0a7f6062015-01-24 17:41:33 -050027 // Angle of the arm.
Daniel Petti663fef02015-01-22 21:43:00 -080028 double angle;
Brian Silverman0a7f6062015-01-24 17:41:33 -050029 // Height of the elevator.
Daniel Petti663fef02015-01-22 21:43:00 -080030 double height;
31
Brian Silverman0a7f6062015-01-24 17:41:33 -050032 GrabberPistons grabbers;
Daniel Petti663fef02015-01-22 21:43:00 -080033 };
34
35 message Position {
Brian Silverman0a7f6062015-01-24 17:41:33 -050036 PotAndIndexPair arm;
37 PotAndIndexPair elevator;
Daniel Petti663fef02015-01-22 21:43:00 -080038 };
39
40 message Status {
41 // Are both the arm and elevator zeroed?
42 bool zeroed;
43 // Are we zeroed and have reached our goal position on both the arm and
44 // elevator?
45 bool done;
46 };
47
48 message Output {
Brian Silverman0a7f6062015-01-24 17:41:33 -050049 double left_arm;
50 double right_arm;
51 double left_elevator;
52 double right_elevator;
Daniel Petti663fef02015-01-22 21:43:00 -080053
Brian Silverman0a7f6062015-01-24 17:41:33 -050054 GrabberPistons grabbers;
Daniel Petti663fef02015-01-22 21:43:00 -080055 };
56
57 queue Goal goal;
58 queue Position position;
59 queue Output output;
60 queue Status status;
61};