I agree with lineskier on all points; it would be simpler to start with arcade drive, then upgrade to mecanum later. On the other hand I can imagine your team wants this to work soon, so here's my interpretation.
First of all, you don't need the while loop. It doesn't hurt, but the system already calls the operatorControl method in a loop - getting rid of it cleans things up.
Secondly, I strongly recommend you use Cartesian drive. It's just much simpler, and I find it's more intuitive to drive (it's a lot like an FPS). Even if you don't plan on directly mapping controls in this way, it's way easier to conceptualize - x and y directions and rotation (just put 0 for the gyro until you understand it).
The other thing is that for simplicity reasons, you should only use the drive method to control the drive system. None of this manual Jaguar control for the drive system - it could conflict with the drive method. (Don't worry about the arm control, that should be fine.)
When I write semi-complex drive code, I like to set variables at the beginning as my drive values. So in this example, I'd set three variables as: xMagnitude, yMagnitude and rotation. Then I'd manipulate these values and after that call the drive method.
By setting variables I can start with a controller input, then adjust them as I see fit. It also makes the code way simpler.
One final thing that is probably a fundamental misconception is that you
need to set values that you want to change (ie. rmagnitude) in the operatorControl method. Otherwise it sets the value to whatever the joystick was at when you start the robot and doesn't change. Values that won't change during the runtime can stay above the method (ie. RobotDrive) (There's a lot of complexities as to why, but that's not important now - let me know if you want more info later.)
So, unless I missed something, here is working code for you:
Code:
public void operatorControl() {
getWatchdog().setEnabled(true);
double xMagnitude = 0; // unless you have a spare axis for this.
double yMagnitude = leftStick.getY();
double rotation = leftStick.getX();
double rmagnitude = rightStick.getY();
if(rmagnitude > 0.0)
{
armLower.set(rmagnitude);
armUpper.set(-rmagnitude);
}
else if (rmagnitude < 0.0)
{
armLower.set(-rmagnitude);
armUpper.set(rmagnitude);
}
else if(leftStick.getRawButton(4)){ // For Strafe Left
xMagnitude = -0.5;
// If you want, you could set yMagnitude or rotation to zero here.
}
else if(leftStick.getRawButton(5)){ // For Strafe Right
xMagnitude = 0.5;
// If you want, you could set yMagnitude or rotation to zero here.
}
}
Timer.delay(0.005); // I don't know why this is here - you don't really
// need to slow anything down
drive.mecanumDrive_Cartesian(xMagnitude, yMagnitude, rotation, 0);
I did make a few assumptions and didn't explain everything, but I hope I communicated most of it to you. Let me know if you have questions.
EDIT: I just realized I didn't do anything about your compressor. Just start it in the autonomous or even the initializer (if you know what that is) and leave it. I don't see a reason to turn it off as the power of the robot should just turn it off.