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:
parent
166e0a96b7
commit
9f20b90bcd
@ -5,24 +5,15 @@ Drive::Drive(): Command("Drive") {
|
|||||||
}
|
}
|
||||||
void Drive::Initialize() {}
|
void Drive::Initialize() {}
|
||||||
void Drive::Execute() {
|
void Drive::Execute() {
|
||||||
double x, y, z;
|
float x, y, z;
|
||||||
x = DentRobot::oi->GetLeftStick()->GetRawAxis(0);
|
x = -DentRobot::oi->GetLeftStick()->GetRawAxis(0);
|
||||||
y = -DentRobot::oi->GetLeftStick()->GetRawAxis(1);
|
y = DentRobot::oi->GetLeftStick()->GetRawAxis(1);
|
||||||
z = DentRobot::oi->GetLeftStick()->GetRawAxis(2);
|
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)
|
//X axis, Y axis, Z axis, sensitivity, speed threshold (usually throttle)
|
||||||
if(DentRobot::oi->GetLeftStick()->GetRawButton(11)) {
|
if(DentRobot::oi->GetLeftStick()->GetRawButton(11)) {
|
||||||
x = -x;
|
x = -x;
|
||||||
y = -y;
|
y = -y;
|
||||||
}
|
}
|
||||||
printf("X:%d\n",x);
|
|
||||||
printf("Y:%d\n",y);
|
|
||||||
DentRobot::drivetrain->DriveArcade(x, y, z, 0.9);
|
DentRobot::drivetrain->DriveArcade(x, y, z, 0.9);
|
||||||
}
|
}
|
||||||
bool Drive::IsFinished() {
|
bool Drive::IsFinished() {
|
||||||
|
@ -21,8 +21,8 @@ void Drivetrain::DriveArcade(double x, double y, double z, double sensitivity, b
|
|||||||
} else {
|
} else {
|
||||||
correctZ = -z * 0.5;
|
correctZ = -z * 0.5;
|
||||||
}
|
}
|
||||||
leftRear->Set(correctY+correctX);
|
leftRear->Set(correctY+(correctX-correctZ));
|
||||||
rightRear->Set(correctY-correctX);
|
rightRear->Set(correctY-(correctX-correctZ));
|
||||||
}
|
}
|
||||||
//Used in pretest
|
//Used in pretest
|
||||||
void Drivetrain::TestMotor(e_motors motor, double power) {
|
void Drivetrain::TestMotor(e_motors motor, double power) {
|
||||||
|
Loading…
Reference in New Issue
Block a user