2015-02-06 13:45:01 -05:00
|
|
|
#include "AutoDrive.h"
|
|
|
|
#include "../../DentRobot.h"
|
2015-02-06 20:38:02 -05:00
|
|
|
// Drive for a short while then stop. Just for testing
|
2015-02-13 17:34:38 -05:00
|
|
|
AutoDrive::AutoDrive(double wait) : Command("AutoDrive"){
|
2015-02-06 13:45:01 -05:00
|
|
|
Requires(DentRobot::drivetrain);
|
2015-02-13 17:34:38 -05:00
|
|
|
SetTimeout(wait);
|
2015-02-13 21:41:38 -05:00
|
|
|
power=NULL;
|
|
|
|
}
|
|
|
|
AutoDrive::AutoDrive(double wait, double p) : Command("AutoDrive"){
|
|
|
|
Requires(DentRobot::drivetrain);
|
|
|
|
SetTimeout(wait);
|
|
|
|
*power=p;
|
2015-02-06 13:45:01 -05:00
|
|
|
}
|
|
|
|
void AutoDrive::Initialize(){
|
|
|
|
}
|
|
|
|
void AutoDrive::Execute(){
|
|
|
|
//X axis, Y axis, Z axis, sensitivity, speed threshold (usually throttle), gyro
|
2015-02-13 21:41:38 -05:00
|
|
|
if(power==NULL){
|
|
|
|
DentRobot::drivetrain->DriveMecanum(0.0,-.75,0.0,0.9,0.0);
|
|
|
|
}else{
|
|
|
|
DentRobot::drivetrain->DriveMecanum(0.0,*power,0.0,0.9,0.0);
|
|
|
|
}
|
2015-02-06 13:45:01 -05:00
|
|
|
}
|
|
|
|
bool AutoDrive::IsFinished(){
|
2015-02-07 17:04:16 -05:00
|
|
|
return IsTimedOut();
|
2015-02-06 13:45:01 -05:00
|
|
|
}
|
|
|
|
void AutoDrive::End(){
|
2015-02-13 22:30:15 -05:00
|
|
|
DentRobot::drivetrain->DriveMecanum(0.0,0.0,0.0,0.9,0.0);
|
2015-02-06 13:45:01 -05:00
|
|
|
}
|
|
|
|
void AutoDrive::Interrupted(){
|
|
|
|
End();
|
|
|
|
}
|
2015-02-08 12:26:15 -05:00
|
|
|
// vim: ts=2:sw=2:et
|