Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   potentiometer (http://www.chiefdelphi.com/forums/showthread.php?t=111207)

luanrookie 14-01-2013 13:39

potentiometer
 
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:

Quote:

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.

Alan Anderson 14-01-2013 14:02

Re: potentiometer
 
The X axis of a joystick is the left-right axis. Is that what you wanted to use?

Jon Stratis 14-01-2013 14:15

Re: potentiometer
 
Get a multimeter and check the voltage the potentiometer is giving you. for different arm positions.

Also, the potentiometer is plugged into the Analog Breakout board, right?

luanrookie 16-01-2013 11:52

Re: potentiometer
 
Yes, but when we run the program, the motor does not stop when the joystick and potentiometer are equal, he keeps turning and stopping and going back to spinning the opposite side.

Joe Ross 16-01-2013 11:58

Re: potentiometer
 
How did you determine your PID constants? Sounds like you need to do some tuning.

Ether 16-01-2013 12:12

Re: potentiometer
 
Quote:

Originally Posted by luanrookie (Post 1216531)
Yes, but when we run the program, the motor does not stop when the joystick and potentiometer are equal, he keeps turning and stopping and going back to spinning the opposite side.

Do some debugging. Look at the error term when "the joystick and potentiometer are equal". If the error is not zero, you've got a scaling or offset problem between your setpoint and your process variable.




All times are GMT -5. The time now is 02:15.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi