blob: 66e30362533c9c8af9267206714805b079a2657f [file] [log] [blame]
Austin Schuh3bb9a442014-02-02 16:01:45 -08001package frc971.control_loops;
2
3import "aos/common/control_loop/control_loops.q";
4
Austin Schuh4339ebb2014-02-11 00:56:44 -08005struct HalfClawPosition {
6 // The current position of this half of the claw.
Austin Schuh4b7b5d02014-02-10 21:20:34 -08007 double position;
Austin Schuh4339ebb2014-02-11 00:56:44 -08008 // The value of the front hall effect sensor.
Austin Schuh4b7b5d02014-02-10 21:20:34 -08009 bool front_hall_effect;
Austin Schuh4339ebb2014-02-11 00:56:44 -080010 // The number of positive and negative edges that have been captured on the
11 // front hall effect sensor.
Austin Schuh4b7b5d02014-02-10 21:20:34 -080012 int32_t front_hall_effect_posedge_count;
13 int32_t front_hall_effect_negedge_count;
Austin Schuh4339ebb2014-02-11 00:56:44 -080014 // The value of the calibration hall effect sensor.
Austin Schuh4b7b5d02014-02-10 21:20:34 -080015 bool calibration_hall_effect;
Austin Schuh4339ebb2014-02-11 00:56:44 -080016 // The number of positive and negative edges that have been captured on the
17 // calibration hall effect sensor.
Austin Schuh4b7b5d02014-02-10 21:20:34 -080018 int32_t calibration_hall_effect_posedge_count;
19 int32_t calibration_hall_effect_negedge_count;
Austin Schuh4339ebb2014-02-11 00:56:44 -080020 // The value of the back hall effect sensor.
Austin Schuh4b7b5d02014-02-10 21:20:34 -080021 bool back_hall_effect;
Austin Schuh4339ebb2014-02-11 00:56:44 -080022 // The number of positive and negative edges that have been captured on the
23 // back hall effect sensor.
Austin Schuh4b7b5d02014-02-10 21:20:34 -080024 int32_t back_hall_effect_posedge_count;
25 int32_t back_hall_effect_negedge_count;
26
27 // The encoder value at the last posedge of any of the claw hall effect
Austin Schuh4339ebb2014-02-11 00:56:44 -080028 // sensors (front, calibration, or back).
Austin Schuh4b7b5d02014-02-10 21:20:34 -080029 double posedge_value;
30 // The encoder value at the last negedge of any of the claw hall effect
Austin Schuh4339ebb2014-02-11 00:56:44 -080031 // sensors (front, calibration, or back).
Austin Schuh4b7b5d02014-02-10 21:20:34 -080032 double negedge_value;
33};
34
Austin Schuh3bb9a442014-02-02 16:01:45 -080035// All angles here are 0 horizontal, positive up.
Austin Schuhcc0bf312014-02-09 00:39:29 -080036queue_group ClawGroup {
Austin Schuh3bb9a442014-02-02 16:01:45 -080037 implements aos.control_loops.ControlLoop;
38
39 message Goal {
Austin Schuhcc0bf312014-02-09 00:39:29 -080040 // The angle of the bottom claw.
Austin Schuh3bb9a442014-02-02 16:01:45 -080041 double bottom_angle;
Austin Schuhcc0bf312014-02-09 00:39:29 -080042 // How much higher the top claw is.
Austin Schuh3bb9a442014-02-02 16:01:45 -080043 double seperation_angle;
44 bool intake;
45 };
Austin Schuh4b7b5d02014-02-10 21:20:34 -080046
Austin Schuh3bb9a442014-02-02 16:01:45 -080047 message Position {
Austin Schuh4339ebb2014-02-11 00:56:44 -080048 // All the top claw information.
49 HalfClawPosition top;
50 // All the bottom claw information.
51 HalfClawPosition bottom;
Austin Schuh3bb9a442014-02-02 16:01:45 -080052 };
53
54 message Output {
55 double intake_voltage;
56 double top_claw_voltage;
57 double bottom_claw_voltage;
58 };
59
60 queue Goal goal;
61 queue Position position;
62 queue Output output;
63 queue aos.control_loops.Status status;
64};
65
Austin Schuhcc0bf312014-02-09 00:39:29 -080066queue_group ClawGroup claw_queue_group;