blob: d5c8a73347521102eaf113a92fdd7af92578c503 [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;
75 };
76
77 message Output {
78 // Voltage sent to motors moving elevator up/down. Positive is up.
79 double elevator_voltage;
80
81 // Voltage sent to wrist motors on elevator to rotate.
82 // Positive rotates over the top towards the front of the robot.
83 double wrist_voltage;
84
85 // Voltage sent to motors on intake joint. Positive extends rollers.
86 double intake_joint_voltage;
87
88 // Voltage sent to rollers on intake. Positive rolls inward.
89 double intake_roller_voltage;
90
Theo Bafrali00e42272019-02-12 01:07:46 -080091 // Voltage sent to motors to move stilts height. Positive moves robot
92 // upward.
Tyler Chatowe51334a2019-01-20 16:58:16 -080093 double stilts_voltage;
94
95 // True opens solenoid (applies suction)
96 // Top/bottom are when wrist is toward the front of the robot
97 bool intake_suction_top;
98 bool intake_suction_bottom;
99
100 // Voltage sent to the vacuum pump motors.
101 double pump_voltage;
102 };
103
104 queue Goal goal;
105 queue Output output;
106 queue Status status;
107 queue Position position;
108};
109
Alex Perry5fb5ff22019-02-09 21:53:17 -0800110queue_group SuperstructureQueue superstructure_queue;