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"; |
Brian Silverman | e0a9546 | 2014-02-17 00:41:09 -0800 | [diff] [blame] | 4 | import "frc971/control_loops/control_loops.q"; |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 5 | |
Austin Schuh | 4339ebb | 2014-02-11 00:56:44 -0800 | [diff] [blame] | 6 | struct HalfClawPosition { |
| 7 | // The current position of this half of the claw. |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame] | 8 | double position; |
Brian Silverman | e0a9546 | 2014-02-17 00:41:09 -0800 | [diff] [blame] | 9 | |
| 10 | // The hall effect sensor at the front limit. |
| 11 | HallEffectStruct front; |
| 12 | // The hall effect sensor in the middle to use for real calibration. |
| 13 | HallEffectStruct calibration; |
| 14 | // The hall effect at the back limit. |
| 15 | HallEffectStruct back; |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame] | 16 | |
| 17 | // 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] | 18 | // sensors (front, calibration, or back). |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame] | 19 | double posedge_value; |
| 20 | // 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] | 21 | // sensors (front, calibration, or back). |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame] | 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. |
Brian Silverman | 7c021c4 | 2014-02-17 15:15:56 -0800 | [diff] [blame] | 33 | double separation_angle; |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 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 | 4339ebb | 2014-02-11 00:56:44 -0800 | [diff] [blame] | 38 | // All the top claw information. |
| 39 | HalfClawPosition top; |
| 40 | // All the bottom claw information. |
| 41 | HalfClawPosition bottom; |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | message Output { |
| 45 | double intake_voltage; |
| 46 | double top_claw_voltage; |
| 47 | double bottom_claw_voltage; |
Austin Schuh | d36c369 | 2014-02-18 21:00:57 -0800 | [diff] [blame^] | 48 | double tusk_voltage; |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 49 | }; |
| 50 | |
| 51 | queue Goal goal; |
| 52 | queue Position position; |
| 53 | queue Output output; |
| 54 | queue aos.control_loops.Status status; |
| 55 | }; |
| 56 | |
Austin Schuh | cc0bf31 | 2014-02-09 00:39:29 -0800 | [diff] [blame] | 57 | queue_group ClawGroup claw_queue_group; |