Austin Schuh | 6d1ee0c | 2015-11-21 14:36:04 -0800 | [diff] [blame] | 1 | #include "y2015_bot3/control_loops/intake/intake.h" |
Comran Morshed | fab3200 | 2015-08-30 14:48:54 +0000 | [diff] [blame] | 2 | |
Austin Schuh | 6d1ee0c | 2015-11-21 14:36:04 -0800 | [diff] [blame] | 3 | #include "y2015_bot3/control_loops/intake/intake.q.h" |
Comran Morshed | fab3200 | 2015-08-30 14:48:54 +0000 | [diff] [blame] | 4 | |
Austin Schuh | 6d1ee0c | 2015-11-21 14:36:04 -0800 | [diff] [blame] | 5 | namespace y2015_bot3 { |
Comran Morshed | fab3200 | 2015-08-30 14:48:54 +0000 | [diff] [blame] | 6 | namespace control_loops { |
| 7 | |
| 8 | Intake::Intake(control_loops::IntakeQueue *intake) |
| 9 | : aos::controls::ControlLoop<control_loops::IntakeQueue>(intake) {} |
| 10 | |
| 11 | void Intake::RunIteration( |
| 12 | const control_loops::IntakeQueue::Goal *goal, |
| 13 | const control_loops::IntakeQueue::Position * /*position*/, |
| 14 | control_loops::IntakeQueue::Output *output, |
| 15 | control_loops::IntakeQueue::Status * /*status*/) { |
Comran Morshed | fab3200 | 2015-08-30 14:48:54 +0000 | [diff] [blame] | 16 | if (output != nullptr) { |
| 17 | output->Zero(); |
| 18 | |
Austin Schuh | 40855b0 | 2015-09-28 00:34:24 +0000 | [diff] [blame] | 19 | if (goal != nullptr) { |
| 20 | output->intake = goal->movement; |
| 21 | output->claw_closed = goal->claw_closed; |
| 22 | } else { |
| 23 | output->intake = 0.0; |
| 24 | output->claw_closed = false; |
| 25 | } |
Comran Morshed | fab3200 | 2015-08-30 14:48:54 +0000 | [diff] [blame] | 26 | } |
| 27 | } |
| 28 | |
| 29 | } // namespace control_loops |
Austin Schuh | 6d1ee0c | 2015-11-21 14:36:04 -0800 | [diff] [blame] | 30 | } // namespace y2015_bot3 |