2015-03-21 10:24:33 -04:00
|
|
|
#include "RollVar.h"
|
2015-07-31 12:52:15 -04:00
|
|
|
RollVar::RollVar(double speedVal): Command("RollVar") {
|
2015-03-23 10:52:02 -04:00
|
|
|
speed = speedVal;
|
2015-03-21 10:24:33 -04:00
|
|
|
}
|
2015-07-31 12:52:15 -04:00
|
|
|
void RollVar::Initialize() {
|
2015-03-21 10:24:33 -04:00
|
|
|
printf("Initialized RollVar\n");
|
|
|
|
SetTimeout(2.0);
|
|
|
|
Requires(DentRobot::drivetrain);
|
|
|
|
}
|
2015-07-31 12:52:15 -04:00
|
|
|
void RollVar::Execute() {
|
2015-03-21 07:23:29 -04:00
|
|
|
DentRobot::collector->MoveLeftRoller(1-(speed*(DentRobot::oi->GetLeftStick()->GetRawAxis(2)+1)/2));
|
|
|
|
DentRobot::collector->MoveRightRoller(-(speed*(DentRobot::oi->GetLeftStick()->GetRawAxis(2)+1)/2));
|
2015-03-21 10:24:33 -04:00
|
|
|
DentRobot::collector->MoveBottomRollers(speed*1.0);
|
|
|
|
}
|
2015-07-31 12:52:15 -04:00
|
|
|
bool RollVar::IsFinished() {
|
2015-03-21 10:24:33 -04:00
|
|
|
return IsTimedOut();
|
|
|
|
}
|
2015-07-31 12:52:15 -04:00
|
|
|
void RollVar::End() {
|
2015-03-21 10:24:33 -04:00
|
|
|
DentRobot::collector->MoveRollers(0.0);
|
|
|
|
}
|
2015-07-31 12:52:15 -04:00
|
|
|
void RollVar::Interrupted() {
|
2015-03-21 10:24:33 -04:00
|
|
|
End();
|
|
|
|
}
|
|
|
|
// vim: ts=2:sw=2:et
|