2015-02-13 19:40:23 -05:00
|
|
|
#include "RollIn.h"
|
2015-03-07 13:27:11 -05:00
|
|
|
RollIn::RollIn(double speed) : Command("RollIn"){
|
|
|
|
rawSpeed=speed;
|
2015-02-02 12:14:27 -05:00
|
|
|
}
|
2015-02-13 19:40:23 -05:00
|
|
|
void RollIn::Initialize(){
|
|
|
|
printf("Initialized RollIn\n");
|
2015-02-06 20:38:02 -05:00
|
|
|
SetTimeout(2.0);
|
2015-02-02 12:14:27 -05:00
|
|
|
}
|
2015-02-13 19:40:23 -05:00
|
|
|
void RollIn::Execute(){
|
2015-02-21 08:43:19 -05:00
|
|
|
double cvt=(rawSpeed)*DentRobot::collector->GetSonarDistance()/0.4;
|
2015-02-15 17:10:20 -05:00
|
|
|
if(cvt>=1.0){
|
|
|
|
DentRobot::collector->MoveRollers(1.0);
|
|
|
|
}else{
|
2015-02-28 02:22:43 -05:00
|
|
|
DentRobot::collector->MoveRollers(cvt*1.5);
|
2015-02-15 17:10:20 -05:00
|
|
|
}
|
2015-02-02 12:14:27 -05:00
|
|
|
}
|
2015-02-13 19:40:23 -05:00
|
|
|
bool RollIn::IsFinished(){
|
2015-02-14 16:16:03 -05:00
|
|
|
return IsTimedOut();
|
2015-02-02 12:14:27 -05:00
|
|
|
}
|
2015-02-13 19:40:23 -05:00
|
|
|
void RollIn::End(){
|
2015-02-04 20:57:33 -05:00
|
|
|
DentRobot::collector->MoveRollers(0.0);
|
2015-02-02 12:14:27 -05:00
|
|
|
}
|
2015-02-13 19:40:23 -05:00
|
|
|
void RollIn::Interrupted(){
|
2015-02-02 20:08:04 -05:00
|
|
|
End();
|
2015-02-02 12:14:27 -05:00
|
|
|
}
|
2015-02-08 12:26:15 -05:00
|
|
|
// vim: ts=2:sw=2:et
|