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 | 4339ebb | 2014-02-11 00:56:44 -0800 | [diff] [blame^] | 5 | struct HalfClawPosition { |
| 6 | // The current position of this half of the claw. |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame] | 7 | double position; |
Austin Schuh | 4339ebb | 2014-02-11 00:56:44 -0800 | [diff] [blame^] | 8 | // The value of the front hall effect sensor. |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame] | 9 | bool front_hall_effect; |
Austin Schuh | 4339ebb | 2014-02-11 00:56:44 -0800 | [diff] [blame^] | 10 | // The number of positive and negative edges that have been captured on the |
| 11 | // front hall effect sensor. |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame] | 12 | int32_t front_hall_effect_posedge_count; |
| 13 | int32_t front_hall_effect_negedge_count; |
Austin Schuh | 4339ebb | 2014-02-11 00:56:44 -0800 | [diff] [blame^] | 14 | // The value of the calibration hall effect sensor. |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame] | 15 | bool calibration_hall_effect; |
Austin Schuh | 4339ebb | 2014-02-11 00:56:44 -0800 | [diff] [blame^] | 16 | // The number of positive and negative edges that have been captured on the |
| 17 | // calibration hall effect sensor. |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame] | 18 | int32_t calibration_hall_effect_posedge_count; |
| 19 | int32_t calibration_hall_effect_negedge_count; |
Austin Schuh | 4339ebb | 2014-02-11 00:56:44 -0800 | [diff] [blame^] | 20 | // The value of the back hall effect sensor. |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame] | 21 | bool back_hall_effect; |
Austin Schuh | 4339ebb | 2014-02-11 00:56:44 -0800 | [diff] [blame^] | 22 | // The number of positive and negative edges that have been captured on the |
| 23 | // back hall effect sensor. |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame] | 24 | int32_t back_hall_effect_posedge_count; |
| 25 | int32_t back_hall_effect_negedge_count; |
| 26 | |
| 27 | // The encoder value at the last posedge of any of the claw hall effect |
Austin Schuh | 4339ebb | 2014-02-11 00:56:44 -0800 | [diff] [blame^] | 28 | // sensors (front, calibration, or back). |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame] | 29 | double posedge_value; |
| 30 | // The encoder value at the last negedge of any of the claw hall effect |
Austin Schuh | 4339ebb | 2014-02-11 00:56:44 -0800 | [diff] [blame^] | 31 | // sensors (front, calibration, or back). |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame] | 32 | double negedge_value; |
| 33 | }; |
| 34 | |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 35 | // All angles here are 0 horizontal, positive up. |
Austin Schuh | cc0bf31 | 2014-02-09 00:39:29 -0800 | [diff] [blame] | 36 | queue_group ClawGroup { |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 37 | implements aos.control_loops.ControlLoop; |
| 38 | |
| 39 | message Goal { |
Austin Schuh | cc0bf31 | 2014-02-09 00:39:29 -0800 | [diff] [blame] | 40 | // The angle of the bottom claw. |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 41 | double bottom_angle; |
Austin Schuh | cc0bf31 | 2014-02-09 00:39:29 -0800 | [diff] [blame] | 42 | // How much higher the top claw is. |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 43 | double seperation_angle; |
| 44 | bool intake; |
| 45 | }; |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame] | 46 | |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 47 | message Position { |
Austin Schuh | 4339ebb | 2014-02-11 00:56:44 -0800 | [diff] [blame^] | 48 | // All the top claw information. |
| 49 | HalfClawPosition top; |
| 50 | // All the bottom claw information. |
| 51 | HalfClawPosition bottom; |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | message Output { |
| 55 | double intake_voltage; |
| 56 | double top_claw_voltage; |
| 57 | double bottom_claw_voltage; |
| 58 | }; |
| 59 | |
| 60 | queue Goal goal; |
| 61 | queue Position position; |
| 62 | queue Output output; |
| 63 | queue aos.control_loops.Status status; |
| 64 | }; |
| 65 | |
Austin Schuh | cc0bf31 | 2014-02-09 00:39:29 -0800 | [diff] [blame] | 66 | queue_group ClawGroup claw_queue_group; |