John Park | 0a245a0 | 2020-02-02 14:10:15 -0800 | [diff] [blame] | 1 | #include "y2020/control_loops/superstructure/climber.h" |
| 2 | |
| 3 | #include <algorithm> |
| 4 | |
| 5 | #include "y2020/control_loops/superstructure/superstructure_goal_generated.h" |
| 6 | #include "y2020/control_loops/superstructure/superstructure_output_generated.h" |
| 7 | |
| 8 | namespace y2020 { |
| 9 | namespace control_loops { |
| 10 | namespace superstructure { |
| 11 | |
| 12 | void Climber::Iterate(const Goal *unsafe_goal, OutputT *output) { |
| 13 | if (unsafe_goal && output) { |
| 14 | // Pass through the voltage request from the user. Backwards isn't |
| 15 | // supported, so prevent that. |
| 16 | output->climber_voltage = |
| 17 | std::clamp(unsafe_goal->climber_voltage(), 0.0f, 12.0f); |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | } // namespace superstructure |
| 22 | } // namespace control_loops |
| 23 | } // namespace y2020 |