Robototes2412
16-02-2010, 11:55
I wrote this after looking at some documentation someone wrote up.
public void mechanumDrive(double v, double r, double s){
/*
* You all love Dr. Tran, so Try His mega-awesome MECANUM DRIVE!!!
*/
double FLval; double FRval; double RLval; double RRval;
FLval = v - r - s;
FRval = v + r + s;
RLval = v - r + s;
RRval = v + r - s;
FLjag.set(FLval);
FRjag.set(FRval);
LRjag.set(RLval);
RRjag.set(RRval);
/*if (leftStick.getRawButton(2)) {
v = v * Math.sqrt(2.0);
double dirInRad = (s + 45.0) * 3.14159 / 180.0;
double cosD = Math.cos(dirInRad);
double sinD = Math.sin(dirInRad);
FLval = sinD * v - r;
FRval = cosD * v + r;
RLval = sinD * v + r;
RRval = cosD * v - r;
FLjag.set(FLval);
FRjag.set(FRval);
LRjag.set(RLval);
RRjag.set(RRval);
}*/
}
void rawStrafe(String direction, double speed) {
direction.toLowerCase();
if (direction.compareTo("left") == 0) {
FLjag.set(-speed);
FRjag.set(speed);
RRjag.set(-speed);
LRjag.set(speed);
} else if (direction.compareTo("right") == 0) {
FLjag.set(speed);
FRjag.set(-speed);
RRjag.set(speed);
LRjag.set(-speed);
}
}
I cannot get either if these to strafe. what happens when I try is the wheels "stick" in place (thats about the best way I can describe it)
public void mechanumDrive(double v, double r, double s){
/*
* You all love Dr. Tran, so Try His mega-awesome MECANUM DRIVE!!!
*/
double FLval; double FRval; double RLval; double RRval;
FLval = v - r - s;
FRval = v + r + s;
RLval = v - r + s;
RRval = v + r - s;
FLjag.set(FLval);
FRjag.set(FRval);
LRjag.set(RLval);
RRjag.set(RRval);
/*if (leftStick.getRawButton(2)) {
v = v * Math.sqrt(2.0);
double dirInRad = (s + 45.0) * 3.14159 / 180.0;
double cosD = Math.cos(dirInRad);
double sinD = Math.sin(dirInRad);
FLval = sinD * v - r;
FRval = cosD * v + r;
RLval = sinD * v + r;
RRval = cosD * v - r;
FLjag.set(FLval);
FRjag.set(FRval);
LRjag.set(RLval);
RRjag.set(RRval);
}*/
}
void rawStrafe(String direction, double speed) {
direction.toLowerCase();
if (direction.compareTo("left") == 0) {
FLjag.set(-speed);
FRjag.set(speed);
RRjag.set(-speed);
LRjag.set(speed);
} else if (direction.compareTo("right") == 0) {
FLjag.set(speed);
FRjag.set(-speed);
RRjag.set(speed);
LRjag.set(-speed);
}
}
I cannot get either if these to strafe. what happens when I try is the wheels "stick" in place (thats about the best way I can describe it)