blob: 7f200a4021136d086a7dbbbd99b1fc85114d345d [file] [log] [blame]
Austin Schuh3bb9a442014-02-02 16:01:45 -08001package frc971.control_loops;
2
3import "aos/common/control_loop/control_loops.q";
Brian Silvermane0a95462014-02-17 00:41:09 -08004import "frc971/control_loops/control_loops.q";
Austin Schuh3bb9a442014-02-02 16:01:45 -08005
Austin Schuh4339ebb2014-02-11 00:56:44 -08006struct HalfClawPosition {
7 // The current position of this half of the claw.
Austin Schuh4b7b5d02014-02-10 21:20:34 -08008 double position;
Brian Silvermane0a95462014-02-17 00:41:09 -08009
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 Schuh4b7b5d02014-02-10 21:20:34 -080016
17 // The encoder value at the last posedge of any of the claw hall effect
Austin Schuh4339ebb2014-02-11 00:56:44 -080018 // sensors (front, calibration, or back).
Austin Schuh4b7b5d02014-02-10 21:20:34 -080019 double posedge_value;
20 // The encoder value at the last negedge of any of the claw hall effect
Austin Schuh4339ebb2014-02-11 00:56:44 -080021 // sensors (front, calibration, or back).
Austin Schuh4b7b5d02014-02-10 21:20:34 -080022 double negedge_value;
23};
24
Austin Schuh3bb9a442014-02-02 16:01:45 -080025// All angles here are 0 horizontal, positive up.
Austin Schuhcc0bf312014-02-09 00:39:29 -080026queue_group ClawGroup {
Austin Schuh3bb9a442014-02-02 16:01:45 -080027 implements aos.control_loops.ControlLoop;
28
29 message Goal {
Austin Schuhcc0bf312014-02-09 00:39:29 -080030 // The angle of the bottom claw.
Austin Schuh3bb9a442014-02-02 16:01:45 -080031 double bottom_angle;
Austin Schuhcc0bf312014-02-09 00:39:29 -080032 // How much higher the top claw is.
Brian Silverman7c021c42014-02-17 15:15:56 -080033 double separation_angle;
Austin Schuh78d55462014-02-23 01:39:30 -080034 // top claw intake roller
Ben Fredrickson2f76ddf2014-02-23 05:58:23 +000035 double intake;
Austin Schuh78d55462014-02-23 01:39:30 -080036 // bottom claw tusk centering
37 double centering;
Austin Schuh3bb9a442014-02-02 16:01:45 -080038 };
Austin Schuh4b7b5d02014-02-10 21:20:34 -080039
Austin Schuh3bb9a442014-02-02 16:01:45 -080040 message Position {
Austin Schuh4339ebb2014-02-11 00:56:44 -080041 // All the top claw information.
42 HalfClawPosition top;
43 // All the bottom claw information.
44 HalfClawPosition bottom;
Austin Schuh3bb9a442014-02-02 16:01:45 -080045 };
46
47 message Output {
48 double intake_voltage;
49 double top_claw_voltage;
50 double bottom_claw_voltage;
Austin Schuhd36c3692014-02-18 21:00:57 -080051 double tusk_voltage;
Austin Schuh3bb9a442014-02-02 16:01:45 -080052 };
53
James Kuszmaul4abaf482014-02-26 21:16:35 -080054 message Status {
55 // True if zeroed and within tolerance for separation and bottom angle.
56 bool done;
Ben Fredrickson81ba2d52014-03-02 08:21:46 +000057 // True if zeroed and within tolerance for separation and bottom angle.
58 // seperation allowance much wider as a ball may be included
59 bool done_with_ball;
James Kuszmaul4abaf482014-02-26 21:16:35 -080060 // Dump the values of the state matrix.
61 double bottom;
62 double bottom_velocity;
63 double separation;
64 double separation_velocity;
65 };
66
Austin Schuh3bb9a442014-02-02 16:01:45 -080067 queue Goal goal;
68 queue Position position;
69 queue Output output;
James Kuszmaul9ead1de2014-02-28 21:24:39 -080070 queue Status status;
Austin Schuh3bb9a442014-02-02 16:01:45 -080071};
72
Austin Schuhcc0bf312014-02-09 00:39:29 -080073queue_group ClawGroup claw_queue_group;