blob: 670b10fd9ec0008a71f25f3bd5022e4a5fa12a33 [file] [log] [blame]
Brian Silvermand4417aa2014-01-18 12:45:12 -08001package frc971.control_loops;
2
Ben Fredrickson1e512ff2014-02-15 21:36:52 +00003import "aos/common/control_loop/control_loops.q";
Brian Silvermand4417aa2014-01-18 12:45:12 -08004
Ben Fredrickson9590d502014-02-16 06:19:12 +00005queue_group ShooterGroup {
Brian Silvermand4417aa2014-01-18 12:45:12 -08006 implements aos.control_loops.ControlLoop;
7
joe93778a62014-02-15 13:22:14 -08008 message Output {
joe93778a62014-02-15 13:22:14 -08009 double voltage;
Ben Fredrickson1f633ef2014-02-16 05:35:45 +000010 // true: latch engaged, false: latch open
11 bool latch_piston;
12 // true: brake engaged false: brake released
13 bool brake_piston;
joe93778a62014-02-15 13:22:14 -080014 };
Brian Silvermand4417aa2014-01-18 12:45:12 -080015 message Goal {
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000016 // encoder ticks of shot energy.
17 double shot_power;
Brian Silverman8c30bc12014-01-18 12:49:38 -080018 // Shoots as soon as this is true.
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000019 bool shot_requested;
20 bool unload_requested;
Brian Silvermand4417aa2014-01-18 12:45:12 -080021 };
22 message Position {
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000023 // back on the plunger
24 bool plunger_back_hall_effect;
25 // truely back on the pusher
26 bool pusher_distal_hall_effect;
27 // warning that we are back on the pusher
28 bool pusher_proximal_hall_effect;
29 // the latch is closed
30 bool latch_hall_effect;
Ben Fredricksonce137562014-02-17 03:23:48 +000031 // the brake is closed
32 bool brake_hall_effect;
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000033
34 // count of positive edges
35 int64_t plunger_back_hall_effect_posedge_count;
36 // count of negative edges
37 int64_t plunger_back_hall_effect_negedge_count;
38 // count of positive edges
39 int64_t pusher_distal_hall_effect_posedge_count;
40 // count of negative edges
41 int64_t pusher_distal_hall_effect_negedge_count;
42 // count of positive edges
43 int64_t pusher_proximal_hall_effect_posedge_count;
44 // count of negative edges
45 int64_t pusher_proximal_hall_effect_negedge_count;
46 // count of positive edges
47 int64_t latch_hall_effect_posedge_count;
48 // count of negative edges
49 int64_t latch_hall_effect_negedge_count;
50
Brian Silverman8c30bc12014-01-18 12:49:38 -080051 // In meters, out is positive.
52 double position;
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000053
54 // last positive edge
55 double posedge_value;
56 // last negative edge
57 double negedge_value;
Brian Silvermand4417aa2014-01-18 12:45:12 -080058 };
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000059 // I don't think this is needed, but it is here
60 // so I won't delete it yet.
Brian Silvermand4417aa2014-01-18 12:45:12 -080061 message Status {
Brian Silverman8c30bc12014-01-18 12:49:38 -080062 // Whether it's ready to shoot right now.
Brian Silvermand4417aa2014-01-18 12:45:12 -080063 bool ready;
Brian Silverman8c30bc12014-01-18 12:49:38 -080064 // Whether the plunger is in and out of the way of grabbing a ball.
65 bool cocked;
66 // How many times we've shot.
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000067 int32_t shots;
joe93778a62014-02-15 13:22:14 -080068 bool done;
Brian Silvermand4417aa2014-01-18 12:45:12 -080069 };
70
71 queue Goal goal;
72 queue Position position;
joe93778a62014-02-15 13:22:14 -080073 queue Output output;
Brian Silvermand4417aa2014-01-18 12:45:12 -080074 queue Status status;
75};
76
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000077queue_group ShooterGroup shooter_queue_group;