blob: b9b68220b14be811db6eff3c00de6e6448ef494a [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 Schuh3bb9a442014-02-02 16:01:45 -080034 bool intake;
35 };
Austin Schuh4b7b5d02014-02-10 21:20:34 -080036
Austin Schuh3bb9a442014-02-02 16:01:45 -080037 message Position {
Austin Schuh4339ebb2014-02-11 00:56:44 -080038 // All the top claw information.
39 HalfClawPosition top;
40 // All the bottom claw information.
41 HalfClawPosition bottom;
Austin Schuh3bb9a442014-02-02 16:01:45 -080042 };
43
44 message Output {
45 double intake_voltage;
46 double top_claw_voltage;
47 double bottom_claw_voltage;
48 };
49
50 queue Goal goal;
51 queue Position position;
52 queue Output output;
53 queue aos.control_loops.Status status;
54};
55
Austin Schuhcc0bf312014-02-09 00:39:29 -080056queue_group ClawGroup claw_queue_group;