Austin Schuh | 87c1063 | 2017-02-05 19:02:17 -0800 | [diff] [blame^] | 1 | #include "y2017/control_loops/superstructure/superstructure.h" |
| 2 | |
| 3 | #include "aos/common/controls/control_loops.q.h" |
| 4 | #include "aos/common/logging/logging.h" |
| 5 | #include "y2017/constants.h" |
| 6 | #include "y2017/control_loops/superstructure/hood/hood.h" |
| 7 | |
| 8 | namespace y2017 { |
| 9 | namespace control_loops { |
| 10 | namespace superstructure { |
| 11 | |
| 12 | Superstructure::Superstructure( |
| 13 | control_loops::SuperstructureQueue *superstructure_queue) |
| 14 | : aos::controls::ControlLoop<control_loops::SuperstructureQueue>( |
| 15 | superstructure_queue) {} |
| 16 | |
| 17 | void Superstructure::RunIteration( |
| 18 | const control_loops::SuperstructureQueue::Goal *unsafe_goal, |
| 19 | const control_loops::SuperstructureQueue::Position *position, |
| 20 | control_loops::SuperstructureQueue::Output *output, |
| 21 | control_loops::SuperstructureQueue::Status *status) { |
| 22 | if (WasReset()) { |
| 23 | LOG(ERROR, "WPILib reset, restarting\n"); |
| 24 | hood_.Reset(); |
| 25 | } |
| 26 | |
| 27 | hood_.Iterate(unsafe_goal != nullptr ? &(unsafe_goal->hood) : nullptr, |
| 28 | &(position->hood), |
| 29 | output != nullptr ? &(output->voltage_hood) : nullptr, |
| 30 | &(status->hood)); |
| 31 | } |
| 32 | |
| 33 | } // namespace superstructure |
| 34 | } // namespace control_loops |
| 35 | } // namespace y2017 |