2
0
mirror of https://github.com/team2059/Dent synced 2024-12-18 20:52:29 -05:00
dent/Commands/Collector/RollIn.cpp
2015-02-15 17:10:20 -05:00

27 lines
583 B
C++

#include "RollIn.h"
RollIn::RollIn() : Command("RollIn"){
}
void RollIn::Initialize(){
printf("Initialized RollIn\n");
SetTimeout(2.0);
}
void RollIn::Execute(){
double throttle=DentRobot::oi->GetLeftThrottle();
double cvt=throttle*DentRobot::collector->GetSonarDistance()/0.4/5;
if(cvt>=1.0){
DentRobot::collector->MoveRollers(1.0);
}else{
DentRobot::collector->MoveRollers(cvt);
}
}
bool RollIn::IsFinished(){
return IsTimedOut();
}
void RollIn::End(){
DentRobot::collector->MoveRollers(0.0);
}
void RollIn::Interrupted(){
End();
}
// vim: ts=2:sw=2:et