blob: 07a06469fa7ce8afb6a13008126de099646f6c66 [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
Ben Fredrickson6b5ba792015-01-25 17:14:40 -080015queue_group FridgeQueue {
Daniel Petti663fef02015-01-22 21:43:00 -080016 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
Austin Schuh703b8d42015-02-01 14:56:34 -080032 // Angular velocity of the arm.
33 double angular_velocity;
34 // Linear velocity of the elevator.
35 double velocity;
36
37 // TODO(austin): Do I need acceleration here too?
38
Brian Silverman0a7f6062015-01-24 17:41:33 -050039 GrabberPistons grabbers;
Daniel Petti663fef02015-01-22 21:43:00 -080040 };
41
42 message Position {
Brian Silverman0a7f6062015-01-24 17:41:33 -050043 PotAndIndexPair arm;
44 PotAndIndexPair elevator;
Daniel Petti663fef02015-01-22 21:43:00 -080045 };
46
47 message Status {
48 // Are both the arm and elevator zeroed?
49 bool zeroed;
50 // Are we zeroed and have reached our goal position on both the arm and
51 // elevator?
52 bool done;
Ben Fredrickson6b5ba792015-01-25 17:14:40 -080053
54 // Angle of the arm.
55 double angle;
56 // Height of the elevator.
57 double height;
58 // state of the grabber pistons
59 GrabberPistons grabbers;
Austin Schuh703b8d42015-02-01 14:56:34 -080060
61 // TODO(austin): Internal state.
62 bool estopped;
Daniel Petti663fef02015-01-22 21:43:00 -080063 };
64
65 message Output {
Brian Silverman0a7f6062015-01-24 17:41:33 -050066 double left_arm;
67 double right_arm;
68 double left_elevator;
69 double right_elevator;
Daniel Petti663fef02015-01-22 21:43:00 -080070
Brian Silverman0a7f6062015-01-24 17:41:33 -050071 GrabberPistons grabbers;
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};
Daniel Petti8bb86eb2015-01-26 17:09:58 -080079
Ben Fredrickson6b5ba792015-01-25 17:14:40 -080080queue_group FridgeQueue fridge_queue;