It sounds like you're wanting to use position control only in autonomous mode, and use percent voltage mode for teleop. If this is correct, make sure that you set the control mode back to percent voltage after you disable position control. When you change back to position control mode, you'll have to reset the PID constants as well. Disabling the PID control of the Jaguar does not take it out of position control mode -- it only disables the output. That is, calling set() or setX() on the Jaguar will still be interpreted as a position command and not a percent voltage command.
At the start of autonomous:
Code:
// Switch to Position control mode
jag.changeControlMode(CANJaguar.ControlMode.kPosition);
// Use the potentiometer as the position reference
jag.setPositionReference(CANJaguar.PositionReference.kPotentiometer);
// Set PID gains
jag.setPID(pValue, iValue, dValue);
During autonomous, you can then set a setpoint with setX() and call enableControl() to turn on PID control.
At the beginning of teleop:
Code:
// Switch to percent voltage mode.
jag.changeControlMode(CANJaguar.ControlMode.kPercentVbus);
You can than use setX() to set a percent voltage output in the range of -1.0 to 1.0.
Hope this helps.