2015-02-07 09:17:20 -05:00
|
|
|
#include "CheckDrive.h"
|
|
|
|
#include <cmath>
|
|
|
|
#include "Commands/CommandGroup.h"
|
|
|
|
#include "../../DentRobot.h"
|
|
|
|
#include "../../RobotMap.h"
|
2015-03-09 07:25:11 -04:00
|
|
|
CheckDrive::CheckDrive(int motorID): CommandGroup("CheckDrive"){
|
2015-02-07 09:17:20 -05:00
|
|
|
Requires(DentRobot::drivetrain);
|
2015-02-13 11:08:19 -05:00
|
|
|
motor = motorID;
|
2015-02-07 09:17:20 -05:00
|
|
|
}
|
|
|
|
void CheckDrive::Initialize(){
|
|
|
|
SetTimeout(1.0);
|
|
|
|
}
|
|
|
|
void CheckDrive::Execute(){
|
|
|
|
switch(motor){
|
2015-03-09 18:23:28 -04:00
|
|
|
case DRIVE_FRONT_LEFT:
|
2015-02-27 15:44:18 -05:00
|
|
|
DentRobot::drivetrain->TestMotor(DentRobot::drivetrain->FRONTLEFT, 1);
|
2015-02-07 09:17:20 -05:00
|
|
|
break;
|
2015-03-09 18:23:28 -04:00
|
|
|
case DRIVE_FRONT_RIGHT:
|
2015-02-27 15:44:18 -05:00
|
|
|
DentRobot::drivetrain->TestMotor(DentRobot::drivetrain->FRONTRIGHT, 1);
|
2015-02-07 09:17:20 -05:00
|
|
|
break;
|
2015-03-09 18:23:28 -04:00
|
|
|
case DRIVE_BACK_LEFT:
|
2015-02-27 15:44:18 -05:00
|
|
|
DentRobot::drivetrain->TestMotor(DentRobot::drivetrain->BACKLEFT, 1);
|
2015-02-07 09:17:20 -05:00
|
|
|
break;
|
2015-03-09 18:23:28 -04:00
|
|
|
case DRIVE_BACK_RIGHT:
|
2015-02-27 15:44:18 -05:00
|
|
|
DentRobot::drivetrain->TestMotor(DentRobot::drivetrain->BACKRIGHT, 1);
|
2015-02-07 09:17:20 -05:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bool CheckDrive::IsFinished(){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
void CheckDrive::End(){
|
|
|
|
}
|
|
|
|
void CheckDrive::Interrupted(){
|
|
|
|
End();
|
|
|
|
}
|