blob: 03dfdad17e69e476a0e4e43a17af7c93dde46dca [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 Schuh4b7b5d02014-02-10 21:20:34 -08005struct Claw {
6 double position;
7 bool front_hall_effect;
8 int32_t front_hall_effect_posedge_count;
9 int32_t front_hall_effect_negedge_count;
10 bool calibration_hall_effect;
11 int32_t calibration_hall_effect_posedge_count;
12 int32_t calibration_hall_effect_negedge_count;
13 bool back_hall_effect;
14 int32_t back_hall_effect_posedge_count;
15 int32_t back_hall_effect_negedge_count;
16
17 // The encoder value at the last posedge of any of the claw hall effect
18 // sensors.
19 double posedge_value;
20 // The encoder value at the last negedge of any of the claw hall effect
21 // sensors.
22 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.
Austin Schuh3bb9a442014-02-02 16:01:45 -080033 double seperation_angle;
34 bool intake;
35 };
Austin Schuh4b7b5d02014-02-10 21:20:34 -080036
Austin Schuh3bb9a442014-02-02 16:01:45 -080037 message Position {
Austin Schuhcc0bf312014-02-09 00:39:29 -080038 // Top claw position relative to power on.
Austin Schuh4b7b5d02014-02-10 21:20:34 -080039 //double top_position;
Austin Schuh3bb9a442014-02-02 16:01:45 -080040
Austin Schuh4b7b5d02014-02-10 21:20:34 -080041 Claw top;
42 Claw bottom;
Austin Schuhcc0bf312014-02-09 00:39:29 -080043
44 // Three Hall Effects with respect to the top claw
Austin Schuh4b7b5d02014-02-10 21:20:34 -080045 //bool top_front_hall_effect;
46 //int32_t top_front_hall_effect_posedge_count;
47 //int32_t top_front_hall_effect_negedge_count;
48 //bool top_calibration_hall_effect;
49 //int32_t top_calibration_hall_effect_posedge_count;
50 //int32_t top_calibration_hall_effect_negedge_count;
51 //bool top_back_hall_effect;
52 //int32_t top_back_hall_effect_posedge_count;
53 //int32_t top_back_hall_effect_negedge_count;
Austin Schuhcc0bf312014-02-09 00:39:29 -080054
55 // The encoder value at the last posedge of any of the top claw hall effect
56 // sensors.
Austin Schuh4b7b5d02014-02-10 21:20:34 -080057 //double top_posedge_value;
Austin Schuhcc0bf312014-02-09 00:39:29 -080058 // The encoder value at the last negedge of any of the top claw hall effect
59 // sensors.
Austin Schuh4b7b5d02014-02-10 21:20:34 -080060 //double top_negedge_value;
Austin Schuh3bb9a442014-02-02 16:01:45 -080061
Austin Schuhcc0bf312014-02-09 00:39:29 -080062 // bottom claw relative position
Austin Schuh4b7b5d02014-02-10 21:20:34 -080063 //double bottom_position;
Austin Schuhcc0bf312014-02-09 00:39:29 -080064
65 // Three Hall Effects with respect to the bottom claw
Austin Schuh4b7b5d02014-02-10 21:20:34 -080066 //bool bottom_front_hall_effect;
67 //int32_t bottom_front_hall_effect_posedge_count;
68 //int32_t bottom_front_hall_effect_negedge_count;
69 //bool bottom_calibration_hall_effect;
70 //int32_t bottom_calibration_hall_effect_posedge_count;
71 //int32_t bottom_calibration_hall_effect_negedge_count;
72 //bool bottom_back_hall_effect;
73 //int32_t bottom_back_hall_effect_posedge_count;
74 //int32_t bottom_back_hall_effect_negedge_count;
Austin Schuhcc0bf312014-02-09 00:39:29 -080075
76 // The encoder value at the last posedge of any of the bottom claw hall
77 // effect sensors.
Austin Schuh4b7b5d02014-02-10 21:20:34 -080078 //double bottom_posedge_value;
Austin Schuhcc0bf312014-02-09 00:39:29 -080079 // The encoder value at the last negedge of any of the bottom claw hall
80 // effect sensors.
Austin Schuh4b7b5d02014-02-10 21:20:34 -080081 //double bottom_negedge_value;
Austin Schuh3bb9a442014-02-02 16:01:45 -080082 };
83
84 message Output {
85 double intake_voltage;
86 double top_claw_voltage;
87 double bottom_claw_voltage;
88 };
89
90 queue Goal goal;
91 queue Position position;
92 queue Output output;
93 queue aos.control_loops.Status status;
94};
95
Austin Schuhcc0bf312014-02-09 00:39:29 -080096queue_group ClawGroup claw_queue_group;