blob: 4f76a57090c27e7d6f31933f7cae32ddb983553d [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 Silvermanaae236a2014-02-17 01:49:39 -08004import "frc971/control_loops/control_loops.q";
Brian Silvermand4417aa2014-01-18 12:45:12 -08005
Ben Fredrickson9590d502014-02-16 06:19:12 +00006queue_group ShooterGroup {
Brian Silvermand4417aa2014-01-18 12:45:12 -08007 implements aos.control_loops.ControlLoop;
8
joe93778a62014-02-15 13:22:14 -08009 message Output {
joe93778a62014-02-15 13:22:14 -080010 double voltage;
Ben Fredrickson1f633ef2014-02-16 05:35:45 +000011 // true: latch engaged, false: latch open
12 bool latch_piston;
13 // true: brake engaged false: brake released
14 bool brake_piston;
joe93778a62014-02-15 13:22:14 -080015 };
Brian Silvermand4417aa2014-01-18 12:45:12 -080016 message Goal {
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000017 // encoder ticks of shot energy.
18 double shot_power;
Brian Silverman8c30bc12014-01-18 12:49:38 -080019 // Shoots as soon as this is true.
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000020 bool shot_requested;
21 bool unload_requested;
Brian Silvermand4417aa2014-01-18 12:45:12 -080022 };
23 message Position {
Brian Silvermanaae236a2014-02-17 01:49:39 -080024 // Gets triggered when the plunger is latched.
25 HallEffectStruct plunger;
26 // Gets triggered when the pusher is all the way back.
27 HallEffectStruct pusher_distal;
28 // Triggers just before pusher_distal.
29 HallEffectStruct pusher_proximal;
30 // Triggers when the latch engages.
31 HallEffectStruct latch;
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000032
Brian Silverman8c30bc12014-01-18 12:49:38 -080033 // In meters, out is positive.
34 double position;
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000035
Brian Silvermanaae236a2014-02-17 01:49:39 -080036 // position at the last positive edge of either of the pusher hall effects.
37 double pusher_posedge_value;
38 // position at the last negative edge of either of the pusher hall effects.
39 double pusher_negedge_value;
Brian Silvermand4417aa2014-01-18 12:45:12 -080040 };
41 message Status {
Brian Silverman8c30bc12014-01-18 12:49:38 -080042 // Whether it's ready to shoot right now.
Brian Silvermand4417aa2014-01-18 12:45:12 -080043 bool ready;
Brian Silverman8c30bc12014-01-18 12:49:38 -080044 // Whether the plunger is in and out of the way of grabbing a ball.
45 bool cocked;
46 // How many times we've shot.
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000047 int32_t shots;
joe93778a62014-02-15 13:22:14 -080048 bool done;
Brian Silvermand4417aa2014-01-18 12:45:12 -080049 };
50
51 queue Goal goal;
52 queue Position position;
joe93778a62014-02-15 13:22:14 -080053 queue Output output;
Brian Silvermand4417aa2014-01-18 12:45:12 -080054 queue Status status;
55};
56
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000057queue_group ShooterGroup shooter_queue_group;