Tyler Chatow | e51334a | 2019-01-20 16:58:16 -0800 | [diff] [blame] | 1 | package y2019.control_loops.superstructure; |
| 2 | |
| 3 | import "aos/controls/control_loops.q"; |
| 4 | import "frc971/control_loops/profiled_subsystem.q"; |
| 5 | |
Tyler Chatow | e51334a | 2019-01-20 16:58:16 -0800 | [diff] [blame] | 6 | struct SuctionGoal { |
Sabina Davis | c632934 | 2019-03-01 20:44:42 -0800 | [diff] [blame] | 7 | // True = apply suction |
| 8 | bool grab_piece; |
| 9 | |
| 10 | // 0 = ball mode |
| 11 | // 1 = disk mode |
| 12 | |
| 13 | int32_t gamepiece_mode; |
Tyler Chatow | e51334a | 2019-01-20 16:58:16 -0800 | [diff] [blame] | 14 | }; |
| 15 | |
Austin Schuh | 170f495 | 2019-06-29 18:58:30 -0700 | [diff] [blame] | 16 | // Published on ".y2019.control_loops.superstructure.superstructure_queue" |
Tyler Chatow | e51334a | 2019-01-20 16:58:16 -0800 | [diff] [blame] | 17 | queue_group SuperstructureQueue { |
| 18 | implements aos.control_loops.ControlLoop; |
| 19 | |
| 20 | message Goal { |
Theo Bafrali | 00e4227 | 2019-02-12 01:07:46 -0800 | [diff] [blame] | 21 | // 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 Bafrali | 3274a18 | 2019-02-17 20:01:38 -0800 | [diff] [blame] | 32 | // 0 is the height such that the bottom of the stilts is tangent to the |
| 33 | // bottom of the middle wheels. |
Theo Bafrali | 00e4227 | 2019-02-12 01:07:46 -0800 | [diff] [blame] | 34 | .frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemGoal stilts; |
| 35 | |
| 36 | // Positive is rollers intaking inward. |
| 37 | double roller_voltage; |
| 38 | |
Tyler Chatow | e51334a | 2019-01-20 16:58:16 -0800 | [diff] [blame] | 39 | SuctionGoal suction; |
Tyler Chatow | e51334a | 2019-01-20 16:58:16 -0800 | [diff] [blame] | 40 | }; |
| 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 Chatow | 9867cd7 | 2019-02-09 21:46:01 -0800 | [diff] [blame] | 53 | .frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus elevator; |
| 54 | .frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus wrist; |
Theo Bafrali | 00e4227 | 2019-02-12 01:07:46 -0800 | [diff] [blame] | 55 | .frc971.control_loops.AbsoluteEncoderProfiledJointStatus intake; |
Tyler Chatow | 9867cd7 | 2019-02-09 21:46:01 -0800 | [diff] [blame] | 56 | .frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus stilts; |
Tyler Chatow | e51334a | 2019-01-20 16:58:16 -0800 | [diff] [blame] | 57 | }; |
| 58 | |
| 59 | message Position { |
Austin Schuh | 461e118 | 2019-02-17 14:56:44 -0800 | [diff] [blame] | 60 | // Input from pressure sensor in bar |
| 61 | // 1 = 1 atm, 0 = full vacuum |
| 62 | float suction_pressure; |
Tyler Chatow | e51334a | 2019-01-20 16:58:16 -0800 | [diff] [blame] | 63 | |
| 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 Perry | 5fb5ff2 | 2019-02-09 21:53:17 -0800 | [diff] [blame] | 72 | .frc971.AbsolutePosition intake_joint; |
Tyler Chatow | e51334a | 2019-01-20 16:58:16 -0800 | [diff] [blame] | 73 | |
| 74 | // Position of the stilts, 0 when retracted (defualt), positive lifts robot. |
| 75 | .frc971.PotAndAbsolutePosition stilts; |
Austin Schuh | e2f2248 | 2019-04-13 23:05:43 -0700 | [diff] [blame] | 76 | |
| 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 Chatow | e51334a | 2019-01-20 16:58:16 -0800 | [diff] [blame] | 82 | }; |
| 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 Bafrali | 00e4227 | 2019-02-12 01:07:46 -0800 | [diff] [blame] | 98 | // Voltage sent to motors to move stilts height. Positive moves robot |
| 99 | // upward. |
Tyler Chatow | e51334a | 2019-01-20 16:58:16 -0800 | [diff] [blame] | 100 | 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 | }; |