blob: f78bd5a864ba597f2cd68dd5324e68d9f066e7d1 [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
Tyler Chatowe51334a2019-01-20 16:58:16 -080016queue_group SuperstructureQueue {
17 implements aos.control_loops.ControlLoop;
18
19 message Goal {
Theo Bafrali00e42272019-02-12 01:07:46 -080020 // Meters, 0 = lowest position - mechanical hard stop,
21 // positive = upward
22 .frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemGoal elevator;
23 // 0 = linkage on the sprocket is pointing straight up,
24 // positive = forward
25 .frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemGoal intake;
26 // 0 = Straight up parallel to elevator
27 // Positive rotates toward intake from 0
28 .frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemGoal wrist;
29
30 // Distance stilts extended out of the bottom of the robot. Positive = down.
Theo Bafrali3274a182019-02-17 20:01:38 -080031 // 0 is the height such that the bottom of the stilts is tangent to the
32 // bottom of the middle wheels.
Theo Bafrali00e42272019-02-12 01:07:46 -080033 .frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemGoal stilts;
34
35 // Positive is rollers intaking inward.
36 double roller_voltage;
37
Tyler Chatowe51334a2019-01-20 16:58:16 -080038 SuctionGoal suction;
Tyler Chatowe51334a2019-01-20 16:58:16 -080039 };
40
41 message Status {
42 // All subsystems know their location.
43 bool zeroed;
44
45 // If true, we have aborted. This is the or of all subsystem estops.
46 bool estopped;
47
48 // Whether suction_pressure indicates cargo is held
49 bool has_piece;
50
51 // Status of each subsystem.
Tyler Chatow9867cd72019-02-09 21:46:01 -080052 .frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus elevator;
53 .frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus wrist;
Theo Bafrali00e42272019-02-12 01:07:46 -080054 .frc971.control_loops.AbsoluteEncoderProfiledJointStatus intake;
Tyler Chatow9867cd72019-02-09 21:46:01 -080055 .frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus stilts;
Tyler Chatowe51334a2019-01-20 16:58:16 -080056 };
57
58 message Position {
Austin Schuh461e1182019-02-17 14:56:44 -080059 // Input from pressure sensor in bar
60 // 1 = 1 atm, 0 = full vacuum
61 float suction_pressure;
Tyler Chatowe51334a2019-01-20 16:58:16 -080062
63 // Position of the elevator, 0 at lowest position, positive when up.
64 .frc971.PotAndAbsolutePosition elevator;
65
66 // Position of wrist, 0 when up, positive is rotating toward the front,
67 // over the top.
68 .frc971.PotAndAbsolutePosition wrist;
69
70 // Position of the intake. 0 when rollers are retracted, positive extended.
Alex Perry5fb5ff22019-02-09 21:53:17 -080071 .frc971.AbsolutePosition intake_joint;
Tyler Chatowe51334a2019-01-20 16:58:16 -080072
73 // Position of the stilts, 0 when retracted (defualt), positive lifts robot.
74 .frc971.PotAndAbsolutePosition stilts;
Austin Schuhe2f22482019-04-13 23:05:43 -070075
76 // True if the platform detection sensors detect the platform directly
77 // below the robot right behind the left and right wheels. Useful for
78 // determining when the robot is all the way on the platform.
79 bool platform_left_detect;
80 bool platform_right_detect;
Tyler Chatowe51334a2019-01-20 16:58:16 -080081 };
82
83 message Output {
84 // Voltage sent to motors moving elevator up/down. Positive is up.
85 double elevator_voltage;
86
87 // Voltage sent to wrist motors on elevator to rotate.
88 // Positive rotates over the top towards the front of the robot.
89 double wrist_voltage;
90
91 // Voltage sent to motors on intake joint. Positive extends rollers.
92 double intake_joint_voltage;
93
94 // Voltage sent to rollers on intake. Positive rolls inward.
95 double intake_roller_voltage;
96
Theo Bafrali00e42272019-02-12 01:07:46 -080097 // Voltage sent to motors to move stilts height. Positive moves robot
98 // upward.
Tyler Chatowe51334a2019-01-20 16:58:16 -080099 double stilts_voltage;
100
101 // True opens solenoid (applies suction)
102 // Top/bottom are when wrist is toward the front of the robot
103 bool intake_suction_top;
104 bool intake_suction_bottom;
105
106 // Voltage sent to the vacuum pump motors.
107 double pump_voltage;
108 };
109
110 queue Goal goal;
111 queue Output output;
112 queue Status status;
113 queue Position position;
114};
115
Alex Perry5fb5ff22019-02-09 21:53:17 -0800116queue_group SuperstructureQueue superstructure_queue;