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 | 78d5546 | 2014-02-23 01:39:30 -0800 | [diff] [blame] | 34 | // top claw intake roller |
Ben Fredrickson | 2f76ddf | 2014-02-23 05:58:23 +0000 | [diff] [blame] | 35 | double intake; |
Austin Schuh | 78d5546 | 2014-02-23 01:39:30 -0800 | [diff] [blame] | 36 | // bottom claw tusk centering |
| 37 | double centering; |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 38 | }; |
Austin Schuh | 4b7b5d0 | 2014-02-10 21:20:34 -0800 | [diff] [blame] | 39 | |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 40 | message Position { |
Austin Schuh | 4339ebb | 2014-02-11 00:56:44 -0800 | [diff] [blame] | 41 | // All the top claw information. |
| 42 | HalfClawPosition top; |
| 43 | // All the bottom claw information. |
| 44 | HalfClawPosition bottom; |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 45 | }; |
| 46 | |
| 47 | message Output { |
| 48 | double intake_voltage; |
| 49 | double top_claw_voltage; |
| 50 | double bottom_claw_voltage; |
Austin Schuh | d36c369 | 2014-02-18 21:00:57 -0800 | [diff] [blame] | 51 | double tusk_voltage; |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 52 | }; |
| 53 | |
James Kuszmaul | 4abaf48 | 2014-02-26 21:16:35 -0800 | [diff] [blame] | 54 | message Status { |
Austin Schuh | 4f8633f | 2014-03-02 13:59:46 -0800 | [diff] [blame^] | 55 | // True if zeroed. |
| 56 | bool zeroed; |
James Kuszmaul | 4abaf48 | 2014-02-26 21:16:35 -0800 | [diff] [blame] | 57 | // True if zeroed and within tolerance for separation and bottom angle. |
| 58 | bool done; |
Ben Fredrickson | 81ba2d5 | 2014-03-02 08:21:46 +0000 | [diff] [blame] | 59 | // True if zeroed and within tolerance for separation and bottom angle. |
Austin Schuh | 4f8633f | 2014-03-02 13:59:46 -0800 | [diff] [blame^] | 60 | // seperation allowance much wider as a ball may be included |
Ben Fredrickson | 81ba2d5 | 2014-03-02 08:21:46 +0000 | [diff] [blame] | 61 | bool done_with_ball; |
James Kuszmaul | 4abaf48 | 2014-02-26 21:16:35 -0800 | [diff] [blame] | 62 | // Dump the values of the state matrix. |
| 63 | double bottom; |
| 64 | double bottom_velocity; |
| 65 | double separation; |
| 66 | double separation_velocity; |
| 67 | }; |
| 68 | |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 69 | queue Goal goal; |
| 70 | queue Position position; |
| 71 | queue Output output; |
James Kuszmaul | 9ead1de | 2014-02-28 21:24:39 -0800 | [diff] [blame] | 72 | queue Status status; |
Austin Schuh | 3bb9a44 | 2014-02-02 16:01:45 -0800 | [diff] [blame] | 73 | }; |
| 74 | |
Austin Schuh | cc0bf31 | 2014-02-09 00:39:29 -0800 | [diff] [blame] | 75 | queue_group ClawGroup claw_queue_group; |