Add Climber class and tests
For now, it is a simple pass through.
Change-Id: I5274b03f6ade23fbc98713cf8ed849866a85b429
diff --git a/y2020/control_loops/superstructure/climber.cc b/y2020/control_loops/superstructure/climber.cc
new file mode 100644
index 0000000..bb449da
--- /dev/null
+++ b/y2020/control_loops/superstructure/climber.cc
@@ -0,0 +1,23 @@
+#include "y2020/control_loops/superstructure/climber.h"
+
+#include <algorithm>
+
+#include "y2020/control_loops/superstructure/superstructure_goal_generated.h"
+#include "y2020/control_loops/superstructure/superstructure_output_generated.h"
+
+namespace y2020 {
+namespace control_loops {
+namespace superstructure {
+
+void Climber::Iterate(const Goal *unsafe_goal, OutputT *output) {
+ if (unsafe_goal && output) {
+ // Pass through the voltage request from the user. Backwards isn't
+ // supported, so prevent that.
+ output->climber_voltage =
+ std::clamp(unsafe_goal->climber_voltage(), 0.0f, 12.0f);
+ }
+}
+
+} // namespace superstructure
+} // namespace control_loops
+} // namespace y2020