Port y2014 bot3 to new control system.
Change-Id: I894277089335e36ea95b52e033056b1a8fb4ca30
diff --git a/y2014_bot3/control_loops/rollers/rollers.cc b/y2014_bot3/control_loops/rollers/rollers.cc
index 8777549..ef895b3 100644
--- a/y2014_bot3/control_loops/rollers/rollers.cc
+++ b/y2014_bot3/control_loops/rollers/rollers.cc
@@ -1,40 +1,45 @@
-#include "bot3/control_loops/rollers/rollers.h"
-#include "bot3/control_loops/rollers/rollers.q.h"
+#include "y2014_bot3/control_loops/rollers/rollers.h"
-namespace bot3 {
+#include "aos/common/logging/logging.h"
+
+namespace y2014_bot3 {
namespace control_loops {
-void RollersLoop::RunIteration(const Rollers::Goal *goal,
- const Rollers::Position * /*position*/,
- Rollers::Output *output,
- Rollers::Status * /*status*/) {
- constexpr double kBot3IntakeForwardVoltage = 12.0;
- constexpr double kBot3IntakeBackwardVoltage = -12.0;
- constexpr double kBot3LowGoalForwardVoltage = 6.0;
- constexpr double kBot3LowGoalBackwardVoltage = -6.0;
+Rollers::Rollers(control_loops::RollersQueue *rollers)
+ : aos::controls::ControlLoop<control_loops::RollersQueue>(rollers) {}
+
+void Rollers::RunIteration(
+ const control_loops::RollersQueue::Goal *goal,
+ const control_loops::RollersQueue::Position * /*position*/,
+ control_loops::RollersQueue::Output *output,
+ control_loops::RollersQueue::Status * /*status*/) {
+ constexpr double k2014Bot3IntakeForwardVoltage = 12.0;
+ constexpr double k2014Bot3IntakeBackwardVoltage = -12.0;
+ constexpr double k2014Bot3LowGoalForwardVoltage = 6.0;
+ constexpr double k2014Bot3LowGoalBackwardVoltage = -6.0;
+
+ if (!output || !goal) {
+ return;
+ }
const int intake = goal->intake;
const int low_spit = goal->low_spit;
const bool human_player = goal->human_player;
- if (!output) {
- return;
- }
-
output->Zero();
switch (low_spit) {
case 1:
// Spit towards front
- output->low_goal_voltage = kBot3LowGoalBackwardVoltage;
- output->front_intake_voltage = kBot3IntakeBackwardVoltage;
- output->back_intake_voltage = -kBot3IntakeForwardVoltage;
+ output->low_goal_voltage = k2014Bot3LowGoalBackwardVoltage;
+ output->front_intake_voltage = k2014Bot3IntakeBackwardVoltage;
+ output->back_intake_voltage = -k2014Bot3IntakeForwardVoltage;
break;
case -1:
// Spit towards back
- output->low_goal_voltage = kBot3LowGoalForwardVoltage;
- output->back_intake_voltage = -kBot3IntakeBackwardVoltage;
- output->front_intake_voltage = kBot3IntakeForwardVoltage;
+ output->low_goal_voltage = k2014Bot3LowGoalForwardVoltage;
+ output->back_intake_voltage = -k2014Bot3IntakeBackwardVoltage;
+ output->front_intake_voltage = k2014Bot3IntakeForwardVoltage;
break;
default:
// Stationary
@@ -46,14 +51,14 @@
// Front intake.
output->front_extended = true;
output->back_extended = false;
- output->front_intake_voltage = kBot3IntakeForwardVoltage;
+ output->front_intake_voltage = k2014Bot3IntakeForwardVoltage;
output->back_intake_voltage = 0.0;
break;
case -1:
// Back intake.
output->back_extended = true;
output->front_extended = false;
- output->back_intake_voltage = -kBot3IntakeForwardVoltage;
+ output->back_intake_voltage = -k2014Bot3IntakeForwardVoltage;
output->front_intake_voltage = 0.0;
break;
default:
@@ -65,10 +70,10 @@
// Intake for human player.
output->front_extended = false;
output->back_extended = false;
- output->front_intake_voltage = kBot3IntakeForwardVoltage;
- output->back_intake_voltage = -kBot3IntakeForwardVoltage;
+ output->front_intake_voltage = k2014Bot3IntakeForwardVoltage;
+ output->back_intake_voltage = -k2014Bot3IntakeForwardVoltage;
}
}
} // namespace control_loops
-} // namespace bot3
+} // namespace y2014_bot3