Brian Silverman | d4417aa | 2014-01-18 12:45:12 -0800 | [diff] [blame] | 1 | package frc971.control_loops; |
| 2 | |
Ben Fredrickson | 1e512ff | 2014-02-15 21:36:52 +0000 | [diff] [blame^] | 3 | import "aos/common/control_loop/control_loops.q"; |
Brian Silverman | d4417aa | 2014-01-18 12:45:12 -0800 | [diff] [blame] | 4 | |
| 5 | queue_group ShooterLoop { |
| 6 | implements aos.control_loops.ControlLoop; |
| 7 | |
| 8 | message Goal { |
Ben Fredrickson | 1e512ff | 2014-02-15 21:36:52 +0000 | [diff] [blame^] | 9 | // encoder ticks of shot energy. |
| 10 | double shot_power; |
Brian Silverman | 8c30bc1 | 2014-01-18 12:49:38 -0800 | [diff] [blame] | 11 | // Shoots as soon as this is true. |
Ben Fredrickson | 1e512ff | 2014-02-15 21:36:52 +0000 | [diff] [blame^] | 12 | bool shot_requested; |
| 13 | bool unload_requested; |
Brian Silverman | d4417aa | 2014-01-18 12:45:12 -0800 | [diff] [blame] | 14 | }; |
| 15 | message Position { |
Ben Fredrickson | 1e512ff | 2014-02-15 21:36:52 +0000 | [diff] [blame^] | 16 | // back on the plunger |
| 17 | bool plunger_back_hall_effect; |
| 18 | // truely back on the pusher |
| 19 | bool pusher_distal_hall_effect; |
| 20 | // warning that we are back on the pusher |
| 21 | bool pusher_proximal_hall_effect; |
| 22 | // the latch is closed |
| 23 | bool latch_hall_effect; |
| 24 | |
| 25 | // count of positive edges |
| 26 | int64_t plunger_back_hall_effect_posedge_count; |
| 27 | // count of negative edges |
| 28 | int64_t plunger_back_hall_effect_negedge_count; |
| 29 | // count of positive edges |
| 30 | int64_t pusher_distal_hall_effect_posedge_count; |
| 31 | // count of negative edges |
| 32 | int64_t pusher_distal_hall_effect_negedge_count; |
| 33 | // count of positive edges |
| 34 | int64_t pusher_proximal_hall_effect_posedge_count; |
| 35 | // count of negative edges |
| 36 | int64_t pusher_proximal_hall_effect_negedge_count; |
| 37 | // count of positive edges |
| 38 | int64_t latch_hall_effect_posedge_count; |
| 39 | // count of negative edges |
| 40 | int64_t latch_hall_effect_negedge_count; |
| 41 | |
Brian Silverman | 8c30bc1 | 2014-01-18 12:49:38 -0800 | [diff] [blame] | 42 | // In meters, out is positive. |
| 43 | double position; |
| 44 | double back_calibration; |
Ben Fredrickson | 1e512ff | 2014-02-15 21:36:52 +0000 | [diff] [blame^] | 45 | |
| 46 | // last positive edge |
| 47 | double posedge_value; |
| 48 | // last negative edge |
| 49 | double negedge_value; |
Brian Silverman | d4417aa | 2014-01-18 12:45:12 -0800 | [diff] [blame] | 50 | }; |
Ben Fredrickson | 1e512ff | 2014-02-15 21:36:52 +0000 | [diff] [blame^] | 51 | // I don't think this is needed, but it is here |
| 52 | // so I won't delete it yet. |
Brian Silverman | d4417aa | 2014-01-18 12:45:12 -0800 | [diff] [blame] | 53 | message Status { |
Brian Silverman | 8c30bc1 | 2014-01-18 12:49:38 -0800 | [diff] [blame] | 54 | // Whether it's ready to shoot right now. |
Brian Silverman | d4417aa | 2014-01-18 12:45:12 -0800 | [diff] [blame] | 55 | bool ready; |
Brian Silverman | 8c30bc1 | 2014-01-18 12:49:38 -0800 | [diff] [blame] | 56 | // Whether the plunger is in and out of the way of grabbing a ball. |
| 57 | bool cocked; |
| 58 | // How many times we've shot. |
Ben Fredrickson | 1e512ff | 2014-02-15 21:36:52 +0000 | [diff] [blame^] | 59 | int32_t shots; |
Brian Silverman | d4417aa | 2014-01-18 12:45:12 -0800 | [diff] [blame] | 60 | }; |
| 61 | |
Ben Fredrickson | 1e512ff | 2014-02-15 21:36:52 +0000 | [diff] [blame^] | 62 | message Output { |
| 63 | // desired motor voltage |
| 64 | double voltage; |
| 65 | // true: close latch, false: open latch |
| 66 | double latch_piston; |
| 67 | // true: brake engaded, false: brake release |
| 68 | double brake_piston; |
| 69 | }; |
Brian Silverman | d4417aa | 2014-01-18 12:45:12 -0800 | [diff] [blame] | 70 | queue Goal goal; |
| 71 | queue Position position; |
| 72 | queue aos.control_loops.Output output; |
| 73 | queue Status status; |
| 74 | }; |
| 75 | |
Ben Fredrickson | 1e512ff | 2014-02-15 21:36:52 +0000 | [diff] [blame^] | 76 | queue_group ShooterGroup shooter_queue_group; |