Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 1 | package frc971.control_loops; |
| 2 | |
| 3 | import "aos/common/control_loop/control_loops.q"; |
| 4 | |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame^] | 5 | struct Claw { |
| 6 | double position; |
| 7 | bool front_hall_effect; |
| 8 | int32_t front_hall_effect_posedge_count; |
| 9 | int32_t front_hall_effect_negedge_count; |
| 10 | bool calibration_hall_effect; |
| 11 | int32_t calibration_hall_effect_posedge_count; |
| 12 | int32_t calibration_hall_effect_negedge_count; |
| 13 | bool back_hall_effect; |
| 14 | int32_t back_hall_effect_posedge_count; |
| 15 | int32_t back_hall_effect_negedge_count; |
| 16 | |
| 17 | // The encoder value at the last posedge of any of the claw hall effect |
| 18 | // sensors. |
| 19 | double posedge_value; |
| 20 | // The encoder value at the last negedge of any of the claw hall effect |
| 21 | // sensors. |
| 22 | double negedge_value; |
| 23 | }; |
| 24 | |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 25 | // All angles here are 0 horizontal, positive up. |
Austin Schuh | cc0bf31 | 2014-02-09 00:39:29 -0800 | [diff] [blame] | 26 | queue_group ClawGroup { |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 27 | implements aos.control_loops.ControlLoop; |
| 28 | |
| 29 | message Goal { |
Austin Schuh | cc0bf31 | 2014-02-09 00:39:29 -0800 | [diff] [blame] | 30 | // The angle of the bottom claw. |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 31 | double bottom_angle; |
Austin Schuh | cc0bf31 | 2014-02-09 00:39:29 -0800 | [diff] [blame] | 32 | // How much higher the top claw is. |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 33 | double seperation_angle; |
| 34 | bool intake; |
| 35 | }; |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame^] | 36 | |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 37 | message Position { |
Austin Schuh | cc0bf31 | 2014-02-09 00:39:29 -0800 | [diff] [blame] | 38 | // Top claw position relative to power on. |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame^] | 39 | //double top_position; |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 40 | |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame^] | 41 | Claw top; |
| 42 | Claw bottom; |
Austin Schuh | cc0bf31 | 2014-02-09 00:39:29 -0800 | [diff] [blame] | 43 | |
| 44 | // Three Hall Effects with respect to the top claw |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame^] | 45 | //bool top_front_hall_effect; |
| 46 | //int32_t top_front_hall_effect_posedge_count; |
| 47 | //int32_t top_front_hall_effect_negedge_count; |
| 48 | //bool top_calibration_hall_effect; |
| 49 | //int32_t top_calibration_hall_effect_posedge_count; |
| 50 | //int32_t top_calibration_hall_effect_negedge_count; |
| 51 | //bool top_back_hall_effect; |
| 52 | //int32_t top_back_hall_effect_posedge_count; |
| 53 | //int32_t top_back_hall_effect_negedge_count; |
Austin Schuh | cc0bf31 | 2014-02-09 00:39:29 -0800 | [diff] [blame] | 54 | |
| 55 | // The encoder value at the last posedge of any of the top claw hall effect |
| 56 | // sensors. |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame^] | 57 | //double top_posedge_value; |
Austin Schuh | cc0bf31 | 2014-02-09 00:39:29 -0800 | [diff] [blame] | 58 | // The encoder value at the last negedge of any of the top claw hall effect |
| 59 | // sensors. |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame^] | 60 | //double top_negedge_value; |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 61 | |
Austin Schuh | cc0bf31 | 2014-02-09 00:39:29 -0800 | [diff] [blame] | 62 | // bottom claw relative position |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame^] | 63 | //double bottom_position; |
Austin Schuh | cc0bf31 | 2014-02-09 00:39:29 -0800 | [diff] [blame] | 64 | |
| 65 | // Three Hall Effects with respect to the bottom claw |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame^] | 66 | //bool bottom_front_hall_effect; |
| 67 | //int32_t bottom_front_hall_effect_posedge_count; |
| 68 | //int32_t bottom_front_hall_effect_negedge_count; |
| 69 | //bool bottom_calibration_hall_effect; |
| 70 | //int32_t bottom_calibration_hall_effect_posedge_count; |
| 71 | //int32_t bottom_calibration_hall_effect_negedge_count; |
| 72 | //bool bottom_back_hall_effect; |
| 73 | //int32_t bottom_back_hall_effect_posedge_count; |
| 74 | //int32_t bottom_back_hall_effect_negedge_count; |
Austin Schuh | cc0bf31 | 2014-02-09 00:39:29 -0800 | [diff] [blame] | 75 | |
| 76 | // The encoder value at the last posedge of any of the bottom claw hall |
| 77 | // effect sensors. |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame^] | 78 | //double bottom_posedge_value; |
Austin Schuh | cc0bf31 | 2014-02-09 00:39:29 -0800 | [diff] [blame] | 79 | // The encoder value at the last negedge of any of the bottom claw hall |
| 80 | // effect sensors. |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame^] | 81 | //double bottom_negedge_value; |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 82 | }; |
| 83 | |
| 84 | message Output { |
| 85 | double intake_voltage; |
| 86 | double top_claw_voltage; |
| 87 | double bottom_claw_voltage; |
| 88 | }; |
| 89 | |
| 90 | queue Goal goal; |
| 91 | queue Position position; |
| 92 | queue Output output; |
| 93 | queue aos.control_loops.Status status; |
| 94 | }; |
| 95 | |
Austin Schuh | cc0bf31 | 2014-02-09 00:39:29 -0800 | [diff] [blame] | 96 | queue_group ClawGroup claw_queue_group; |