blob: d19c2b8ac18d384e3de80b19b3c6f312c96d6522 [file] [log] [blame]
Tyler Chatowe51334a2019-01-20 16:58:16 -08001package y2019.control_loops.superstructure;
2
3import "aos/controls/control_loops.q";
4import "frc971/control_loops/profiled_subsystem.q";
5
Tyler Chatowe51334a2019-01-20 16:58:16 -08006struct SuctionGoal {
Sabina Davisc6329342019-03-01 20:44:42 -08007 // True = apply suction
8 bool grab_piece;
9
10 // 0 = ball mode
11 // 1 = disk mode
12
13 int32_t gamepiece_mode;
Tyler Chatowe51334a2019-01-20 16:58:16 -080014};
15
Austin Schuh170f4952019-06-29 18:58:30 -070016// Published on ".y2019.control_loops.superstructure.superstructure_queue"
Tyler Chatowe51334a2019-01-20 16:58:16 -080017queue_group SuperstructureQueue {
18 implements aos.control_loops.ControlLoop;
19
20 message Goal {
Theo Bafrali00e42272019-02-12 01:07:46 -080021 // Meters, 0 = lowest position - mechanical hard stop,
22 // positive = upward
23 .frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemGoal elevator;
24 // 0 = linkage on the sprocket is pointing straight up,
25 // positive = forward
26 .frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemGoal intake;
27 // 0 = Straight up parallel to elevator
28 // Positive rotates toward intake from 0
29 .frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemGoal wrist;
30
31 // Distance stilts extended out of the bottom of the robot. Positive = down.
Theo Bafrali3274a182019-02-17 20:01:38 -080032 // 0 is the height such that the bottom of the stilts is tangent to the
33 // bottom of the middle wheels.
Theo Bafrali00e42272019-02-12 01:07:46 -080034 .frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemGoal stilts;
35
36 // Positive is rollers intaking inward.
37 double roller_voltage;
38
Tyler Chatowe51334a2019-01-20 16:58:16 -080039 SuctionGoal suction;
Tyler Chatowe51334a2019-01-20 16:58:16 -080040 };
41
42 message Status {
43 // All subsystems know their location.
44 bool zeroed;
45
46 // If true, we have aborted. This is the or of all subsystem estops.
47 bool estopped;
48
49 // Whether suction_pressure indicates cargo is held
50 bool has_piece;
51
52 // Status of each subsystem.
Tyler Chatow9867cd72019-02-09 21:46:01 -080053 .frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus elevator;
54 .frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus wrist;
Theo Bafrali00e42272019-02-12 01:07:46 -080055 .frc971.control_loops.AbsoluteEncoderProfiledJointStatus intake;
Tyler Chatow9867cd72019-02-09 21:46:01 -080056 .frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus stilts;
Tyler Chatowe51334a2019-01-20 16:58:16 -080057 };
58
59 message Position {
Austin Schuh461e1182019-02-17 14:56:44 -080060 // Input from pressure sensor in bar
61 // 1 = 1 atm, 0 = full vacuum
62 float suction_pressure;
Tyler Chatowe51334a2019-01-20 16:58:16 -080063
64 // Position of the elevator, 0 at lowest position, positive when up.
65 .frc971.PotAndAbsolutePosition elevator;
66
67 // Position of wrist, 0 when up, positive is rotating toward the front,
68 // over the top.
69 .frc971.PotAndAbsolutePosition wrist;
70
71 // Position of the intake. 0 when rollers are retracted, positive extended.
Alex Perry5fb5ff22019-02-09 21:53:17 -080072 .frc971.AbsolutePosition intake_joint;
Tyler Chatowe51334a2019-01-20 16:58:16 -080073
74 // Position of the stilts, 0 when retracted (defualt), positive lifts robot.
75 .frc971.PotAndAbsolutePosition stilts;
Austin Schuhe2f22482019-04-13 23:05:43 -070076
77 // True if the platform detection sensors detect the platform directly
78 // below the robot right behind the left and right wheels. Useful for
79 // determining when the robot is all the way on the platform.
80 bool platform_left_detect;
81 bool platform_right_detect;
Tyler Chatowe51334a2019-01-20 16:58:16 -080082 };
83
84 message Output {
85 // Voltage sent to motors moving elevator up/down. Positive is up.
86 double elevator_voltage;
87
88 // Voltage sent to wrist motors on elevator to rotate.
89 // Positive rotates over the top towards the front of the robot.
90 double wrist_voltage;
91
92 // Voltage sent to motors on intake joint. Positive extends rollers.
93 double intake_joint_voltage;
94
95 // Voltage sent to rollers on intake. Positive rolls inward.
96 double intake_roller_voltage;
97
Theo Bafrali00e42272019-02-12 01:07:46 -080098 // Voltage sent to motors to move stilts height. Positive moves robot
99 // upward.
Tyler Chatowe51334a2019-01-20 16:58:16 -0800100 double stilts_voltage;
101
102 // True opens solenoid (applies suction)
103 // Top/bottom are when wrist is toward the front of the robot
104 bool intake_suction_top;
105 bool intake_suction_bottom;
106
107 // Voltage sent to the vacuum pump motors.
108 double pump_voltage;
109 };
110
111 queue Goal goal;
112 queue Output output;
113 queue Status status;
114 queue Position position;
115};