2
0
mirror of https://github.com/team2059/Dent synced 2024-12-18 20:52:29 -05:00

fixed arcade, added twist

This commit is contained in:
Adam Long 2015-09-20 13:12:36 +00:00
parent 166e0a96b7
commit 9f20b90bcd
2 changed files with 5 additions and 14 deletions

View File

@ -5,24 +5,15 @@ Drive::Drive(): Command("Drive") {
}
void Drive::Initialize() {}
void Drive::Execute() {
double x, y, z;
x = DentRobot::oi->GetLeftStick()->GetRawAxis(0);
y = -DentRobot::oi->GetLeftStick()->GetRawAxis(1);
float x, y, z;
x = -DentRobot::oi->GetLeftStick()->GetRawAxis(0);
y = DentRobot::oi->GetLeftStick()->GetRawAxis(1);
z = DentRobot::oi->GetLeftStick()->GetRawAxis(2);
// Lock the x axis when not holding button 1
//if(DentRobot::oi->GetLeftStick()->GetRawButton(1)){
// x = 0;
//}
//if(DentRobot::oi->GetLeftStick()->GetRawButton(2)){
// y = 0;
//}
//X axis, Y axis, Z axis, sensitivity, speed threshold (usually throttle)
if(DentRobot::oi->GetLeftStick()->GetRawButton(11)) {
x = -x;
y = -y;
}
printf("X:%d\n",x);
printf("Y:%d\n",y);
DentRobot::drivetrain->DriveArcade(x, y, z, 0.9);
}
bool Drive::IsFinished() {

View File

@ -21,8 +21,8 @@ void Drivetrain::DriveArcade(double x, double y, double z, double sensitivity, b
} else {
correctZ = -z * 0.5;
}
leftRear->Set(correctY+correctX);
rightRear->Set(correctY-correctX);
leftRear->Set(correctY+(correctX-correctZ));
rightRear->Set(correctY-(correctX-correctZ));
}
//Used in pretest
void Drivetrain::TestMotor(e_motors motor, double power) {