2
0
mirror of https://github.com/team2059/Dent synced 2025-01-07 22:14:14 -05:00
dent/src/Commands/Drive.cpp

29 lines
816 B
C++
Raw Normal View History

2015-01-17 12:55:51 -05:00
#include "Drive.h"
#include <cmath>
2015-01-17 12:55:51 -05:00
#include "../DentRobot.h"
Drive::Drive() : Command("Drive"){
2015-01-18 14:03:41 +00:00
Requires(DentRobot::drivetrain);
2015-01-17 12:55:51 -05:00
}
void Drive::Initialize(){
}
void Drive::Execute(){
static float sens=0.7;
float x, y, twist;
x=DentRobot::oi->GetLeftStick()->GetRawAxis(0);
y=DentRobot::oi->GetLeftStick()->GetRawAxis(1);
twist=DentRobot::oi->GetLeftStick()->GetRawAxis(2);
if(true){
x=sens*std::pow(x, 3)+(1.0f-sens)*x;
y=sens*std::pow(y, 3)+(1.0f-sens)*y;
}
//DentRobot::drivetrain->DriveMecanum(DentRobot::oi->GetLeftStick()->GetRawAxis(2), DentRobot::oi->GetLeftStick()->GetRawAxis(1), DentRobot::oi->GetLeftStick()->GetRawAxis(0));
DentRobot::drivetrain->DriveMecanum(x, y, twist);
2015-01-17 12:55:51 -05:00
}
bool Drive::IsFinished(){
return false;
}
void Drive::End(){
}
void Drive::Interrupted(){
}