blob: 233a3eabe9891497478cd8e44f25bc9e9afeb1b3 [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;
Ben Fredrickson2f76ddf2014-02-23 05:58:23 +000034 // top claw intake roller
35 double intake;
36 // 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
54 queue Goal goal;
55 queue Position position;
56 queue Output output;
57 queue aos.control_loops.Status status;
58};
59
Austin Schuhcc0bf312014-02-09 00:39:29 -080060queue_group ClawGroup claw_queue_group;