blob: e75ffed58c190912ad5942945eff070ea0610590 [file] [log] [blame]
#include "y2017_bot3/control_loops/superstructure/superstructure.h"
#include "aos/commonmath.h"
#include "aos/controls/control_loops.q.h"
#include "aos/logging/logging.h"
namespace y2017_bot3 {
namespace control_loops {
namespace superstructure {
Superstructure::Superstructure(::aos::EventLoop *event_loop,
const ::std::string &name)
: aos::controls::ControlLoop<control_loops::SuperstructureQueue>(event_loop,
name) {}
void Superstructure::RunIteration(
const control_loops::SuperstructureQueue::Goal *unsafe_goal,
const control_loops::SuperstructureQueue::Position * /*position*/,
control_loops::SuperstructureQueue::Output *output,
control_loops::SuperstructureQueue::Status * /*status*/) {
// Write out all the voltages.
if (output) {
output->voltage_rollers = 0.0;
output->hanger_voltage = 0.0;
output->fingers_out = false;
if (unsafe_goal) {
// Intake.
output->voltage_rollers = unsafe_goal->voltage_rollers;
// Fire piston to release gear.
output->fingers_out = unsafe_goal->fingers_out;
// Spin Hanger.
output->hanger_voltage = unsafe_goal->hanger_voltage;
}
}
}
} // namespace superstructure
} // namespace control_loops
} // namespace y2017_bot3