Brian Silverman | 17f503e | 2015-08-02 18:17:18 -0700 | [diff] [blame] | 1 | package frc971.control_loops; |
| 2 | |
| 3 | import "aos/common/controls/control_loops.q"; |
| 4 | import "frc971/control_loops/control_loops.q"; |
| 5 | |
Brian Silverman | be5ded6 | 2015-05-14 00:23:49 -0400 | [diff] [blame] | 6 | queue_group ShooterQueue { |
Brian Silverman | 17f503e | 2015-08-02 18:17:18 -0700 | [diff] [blame] | 7 | implements aos.control_loops.ControlLoop; |
| 8 | |
| 9 | message Output { |
| 10 | double voltage; |
| 11 | // true: latch engaged, false: latch open |
| 12 | bool latch_piston; |
| 13 | // true: brake engaged false: brake released |
| 14 | bool brake_piston; |
| 15 | }; |
| 16 | message Goal { |
| 17 | // Shot power in joules. |
| 18 | double shot_power; |
| 19 | // Shoots as soon as this is true. |
| 20 | bool shot_requested; |
| 21 | bool unload_requested; |
| 22 | bool load_requested; |
| 23 | }; |
| 24 | |
| 25 | // Back is when the springs are all the way stretched. |
| 26 | message Position { |
| 27 | // In meters, out is positive. |
| 28 | double position; |
| 29 | |
| 30 | // If the latch piston is fired and this hall effect has been triggered, the |
| 31 | // plunger is all the way back and latched. |
| 32 | bool plunger; |
| 33 | // Gets triggered when the pusher is all the way back. |
| 34 | PosedgeOnlyCountedHallEffectStruct pusher_distal; |
| 35 | // Triggers just before pusher_distal. |
| 36 | PosedgeOnlyCountedHallEffectStruct pusher_proximal; |
| 37 | // Triggers when the latch engages. |
| 38 | bool latch; |
| 39 | }; |
| 40 | message Status { |
| 41 | // Whether it's ready to shoot right now. |
| 42 | bool ready; |
| 43 | // Whether the plunger is in and out of the way of grabbing a ball. |
| 44 | // TODO(ben): Populate these! |
| 45 | bool cocked; |
| 46 | // How many times we've shot. |
| 47 | int32_t shots; |
| 48 | bool done; |
| 49 | // What we think the current position of the hard stop on the shooter is, in |
| 50 | // shot power (Joules). |
| 51 | double hard_stop_power; |
Austin Schuh | adf2cde | 2015-11-08 20:35:16 -0800 | [diff] [blame^] | 52 | |
| 53 | double absolute_position; |
| 54 | double absolute_velocity; |
| 55 | uint32_t state; |
Brian Silverman | 17f503e | 2015-08-02 18:17:18 -0700 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | queue Goal goal; |
| 59 | queue Position position; |
| 60 | queue Output output; |
| 61 | queue Status status; |
| 62 | }; |
| 63 | |
Brian Silverman | be5ded6 | 2015-05-14 00:23:49 -0400 | [diff] [blame] | 64 | queue_group ShooterQueue shooter_queue; |
Brian Silverman | 17f503e | 2015-08-02 18:17:18 -0700 | [diff] [blame] | 65 | |
| 66 | struct ShooterStateToLog { |
| 67 | double absolute_position; |
| 68 | double absolute_velocity; |
| 69 | uint32_t state; |
| 70 | bool latch_sensor; |
| 71 | bool proximal; |
| 72 | bool distal; |
| 73 | bool plunger; |
| 74 | bool brake; |
| 75 | bool latch_piston; |
| 76 | }; |
| 77 | |
| 78 | struct ShooterVoltageToLog { |
| 79 | double X_hat; |
| 80 | double applied; |
| 81 | }; |
| 82 | |
| 83 | struct ShooterMovingGoal { |
| 84 | double dx; |
| 85 | }; |
| 86 | |
| 87 | struct ShooterChangeCalibration { |
| 88 | double encoder; |
| 89 | double real_position; |
| 90 | double old_position; |
| 91 | double new_position; |
| 92 | double old_offset; |
| 93 | double new_offset; |
| 94 | }; |
| 95 | |
| 96 | struct ShooterStatusToLog { |
| 97 | double goal; |
| 98 | double position; |
| 99 | }; |
| 100 | |
| 101 | struct PowerAdjustment { |
| 102 | double requested_power; |
| 103 | double actual_power; |
| 104 | }; |