blob: 830ab84f4a2937354aa9dc45ecc73a0666dbe811 [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;
Austin Schuh60c56662014-02-17 14:37:19 -080013 // true: brake engaged false: brake released
Ben Fredrickson1f633ef2014-02-16 05:35:45 +000014 bool brake_piston;
joe93778a62014-02-15 13:22:14 -080015 };
Brian Silvermand4417aa2014-01-18 12:45:12 -080016 message Goal {
Austin Schuh60c56662014-02-17 14:37:19 -080017 // Shot power in joules.
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000018 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 };
Austin Schuh60c56662014-02-17 14:37:19 -080023
24 // Back is when the springs are all the way stretched.
Brian Silvermand4417aa2014-01-18 12:45:12 -080025 message Position {
Austin Schuh60c56662014-02-17 14:37:19 -080026 // If the latch piston is fired and this hall effect has been triggered, the
27 // plunger is all the way back and latched.
28 bool plunger;
Brian Silvermanaae236a2014-02-17 01:49:39 -080029 // Gets triggered when the pusher is all the way back.
Austin Schuh60c56662014-02-17 14:37:19 -080030 PosedgeOnlyCountedHallEffectStruct pusher_distal;
Brian Silvermanaae236a2014-02-17 01:49:39 -080031 // Triggers just before pusher_distal.
Austin Schuh60c56662014-02-17 14:37:19 -080032 PosedgeOnlyCountedHallEffectStruct pusher_proximal;
Brian Silvermanaae236a2014-02-17 01:49:39 -080033 // Triggers when the latch engages.
Austin Schuh60c56662014-02-17 14:37:19 -080034 bool latch;
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000035
Brian Silverman8c30bc12014-01-18 12:49:38 -080036 // In meters, out is positive.
37 double position;
Brian Silvermand4417aa2014-01-18 12:45:12 -080038 };
39 message Status {
Brian Silverman8c30bc12014-01-18 12:49:38 -080040 // Whether it's ready to shoot right now.
Brian Silvermand4417aa2014-01-18 12:45:12 -080041 bool ready;
Brian Silverman8c30bc12014-01-18 12:49:38 -080042 // Whether the plunger is in and out of the way of grabbing a ball.
43 bool cocked;
44 // How many times we've shot.
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000045 int32_t shots;
joe93778a62014-02-15 13:22:14 -080046 bool done;
Brian Silvermand4417aa2014-01-18 12:45:12 -080047 };
48
49 queue Goal goal;
50 queue Position position;
joe93778a62014-02-15 13:22:14 -080051 queue Output output;
Brian Silvermand4417aa2014-01-18 12:45:12 -080052 queue Status status;
53};
54
Ben Fredrickson1e512ff2014-02-15 21:36:52 +000055queue_group ShooterGroup shooter_queue_group;