blob: 417605722cc4068cd171ce20a5b2f18840833c45 [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 {
7 // True = open solenoid (apply suction)
8 // Top/bottom are when wrist is forward
9 bool top;
10 bool bottom;
11};
12
Tyler Chatowe51334a2019-01-20 16:58:16 -080013queue_group SuperstructureQueue {
14 implements aos.control_loops.ControlLoop;
15
16 message Goal {
Theo Bafrali00e42272019-02-12 01:07:46 -080017 // Meters, 0 = lowest position - mechanical hard stop,
18 // positive = upward
19 .frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemGoal elevator;
20 // 0 = linkage on the sprocket is pointing straight up,
21 // positive = forward
22 .frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemGoal intake;
23 // 0 = Straight up parallel to elevator
24 // Positive rotates toward intake from 0
25 .frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemGoal wrist;
26
27 // Distance stilts extended out of the bottom of the robot. Positive = down.
28 // 0 is the height such that the bottom of the stilts is tangent to the bottom
29 // of the middle wheels.
30 .frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemGoal stilts;
31
32 // Positive is rollers intaking inward.
33 double roller_voltage;
34
Tyler Chatowe51334a2019-01-20 16:58:16 -080035 SuctionGoal suction;
Tyler Chatowe51334a2019-01-20 16:58:16 -080036 };
37
38 message Status {
39 // All subsystems know their location.
40 bool zeroed;
41
42 // If true, we have aborted. This is the or of all subsystem estops.
43 bool estopped;
44
45 // Whether suction_pressure indicates cargo is held
46 bool has_piece;
47
48 // Status of each subsystem.
Tyler Chatow9867cd72019-02-09 21:46:01 -080049 .frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus elevator;
50 .frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus wrist;
Theo Bafrali00e42272019-02-12 01:07:46 -080051 .frc971.control_loops.AbsoluteEncoderProfiledJointStatus intake;
Tyler Chatow9867cd72019-02-09 21:46:01 -080052 .frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus stilts;
Tyler Chatowe51334a2019-01-20 16:58:16 -080053 };
54
55 message Position {
Austin Schuh461e1182019-02-17 14:56:44 -080056 // Input from pressure sensor in bar
57 // 1 = 1 atm, 0 = full vacuum
58 float suction_pressure;
Tyler Chatowe51334a2019-01-20 16:58:16 -080059
60 // Position of the elevator, 0 at lowest position, positive when up.
61 .frc971.PotAndAbsolutePosition elevator;
62
63 // Position of wrist, 0 when up, positive is rotating toward the front,
64 // over the top.
65 .frc971.PotAndAbsolutePosition wrist;
66
67 // Position of the intake. 0 when rollers are retracted, positive extended.
Alex Perry5fb5ff22019-02-09 21:53:17 -080068 .frc971.AbsolutePosition intake_joint;
Tyler Chatowe51334a2019-01-20 16:58:16 -080069
70 // Position of the stilts, 0 when retracted (defualt), positive lifts robot.
71 .frc971.PotAndAbsolutePosition stilts;
72 };
73
74 message Output {
75 // Voltage sent to motors moving elevator up/down. Positive is up.
76 double elevator_voltage;
77
78 // Voltage sent to wrist motors on elevator to rotate.
79 // Positive rotates over the top towards the front of the robot.
80 double wrist_voltage;
81
82 // Voltage sent to motors on intake joint. Positive extends rollers.
83 double intake_joint_voltage;
84
85 // Voltage sent to rollers on intake. Positive rolls inward.
86 double intake_roller_voltage;
87
Theo Bafrali00e42272019-02-12 01:07:46 -080088 // Voltage sent to motors to move stilts height. Positive moves robot
89 // upward.
Tyler Chatowe51334a2019-01-20 16:58:16 -080090 double stilts_voltage;
91
92 // True opens solenoid (applies suction)
93 // Top/bottom are when wrist is toward the front of the robot
94 bool intake_suction_top;
95 bool intake_suction_bottom;
96
97 // Voltage sent to the vacuum pump motors.
98 double pump_voltage;
99 };
100
101 queue Goal goal;
102 queue Output output;
103 queue Status status;
104 queue Position position;
105};
106
Alex Perry5fb5ff22019-02-09 21:53:17 -0800107queue_group SuperstructureQueue superstructure_queue;