We are programming the arm with a window motor in java. We are using the potentiometer as reference for the joystick. When the degrees of the potentiometer is greater than the degres of the joystick, the motor will spin until both are in the same degree, and When lower, it will spin to the other position. Always watching the same degrees of the joystick.
we are using this code:
Joystick joystick = new Joystick(1);
Jaguar Motor = new Jaguar(1);
AnalogChannel potentiometer = new AnalogChannel(1);
PIDController controling = new PIDController(0.1, 0.001,0.0, potentiometer, Motor);
}
controling.enable();
while (isOperatorControl()) {
controling.setSetpoint((joystick.getX() + 1.0) * 2.5);
Timer.delay(0.10);
Is not working, we think that may be the potentiometer or the code, so my question is, is this code right? if we change the potentiometer it will work?
sorry for bad English, and if we don’t leave everything clear is because we are not familiar with forum.