blob: ea53b2c4d811003989d6cc27a92509594e1ce8d6 [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
5queue_group ShooterLoop {
6 implements aos.control_loops.ControlLoop;
7
8 message Goal {
Ben Fredrickson1e512ff2014-02-15 21:36:52 +00009 // encoder ticks of shot energy.
10 double shot_power;
Brian Silverman8c30bc12014-01-18 12:49:38 -080011 // Shoots as soon as this is true.
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000012 bool shot_requested;
13 bool unload_requested;
Brian Silvermand4417aa2014-01-18 12:45:12 -080014 };
15 message Position {
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000016 // back on the plunger
17 bool plunger_back_hall_effect;
18 // truely back on the pusher
19 bool pusher_distal_hall_effect;
20 // warning that we are back on the pusher
21 bool pusher_proximal_hall_effect;
22 // the latch is closed
23 bool latch_hall_effect;
24
25 // count of positive edges
26 int64_t plunger_back_hall_effect_posedge_count;
27 // count of negative edges
28 int64_t plunger_back_hall_effect_negedge_count;
29 // count of positive edges
30 int64_t pusher_distal_hall_effect_posedge_count;
31 // count of negative edges
32 int64_t pusher_distal_hall_effect_negedge_count;
33 // count of positive edges
34 int64_t pusher_proximal_hall_effect_posedge_count;
35 // count of negative edges
36 int64_t pusher_proximal_hall_effect_negedge_count;
37 // count of positive edges
38 int64_t latch_hall_effect_posedge_count;
39 // count of negative edges
40 int64_t latch_hall_effect_negedge_count;
41
Brian Silverman8c30bc12014-01-18 12:49:38 -080042 // In meters, out is positive.
43 double position;
44 double back_calibration;
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000045
46 // last positive edge
47 double posedge_value;
48 // last negative edge
49 double negedge_value;
Brian Silvermand4417aa2014-01-18 12:45:12 -080050 };
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000051 // I don't think this is needed, but it is here
52 // so I won't delete it yet.
Brian Silvermand4417aa2014-01-18 12:45:12 -080053 message Status {
Brian Silverman8c30bc12014-01-18 12:49:38 -080054 // Whether it's ready to shoot right now.
Brian Silvermand4417aa2014-01-18 12:45:12 -080055 bool ready;
Brian Silverman8c30bc12014-01-18 12:49:38 -080056 // Whether the plunger is in and out of the way of grabbing a ball.
57 bool cocked;
58 // How many times we've shot.
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000059 int32_t shots;
Brian Silvermand4417aa2014-01-18 12:45:12 -080060 };
61
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000062 message Output {
63 // desired motor voltage
64 double voltage;
65 // true: close latch, false: open latch
66 double latch_piston;
67 // true: brake engaded, false: brake release
68 double brake_piston;
69 };
Brian Silvermand4417aa2014-01-18 12:45:12 -080070 queue Goal goal;
71 queue Position position;
72 queue aos.control_loops.Output output;
73 queue Status status;
74};
75
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000076queue_group ShooterGroup shooter_queue_group;